Browse Source

fix RAK11200 variant: pin corrections and convention alignment

- Fix I2C pins in variant.h (GPIO21/22 → GPIO4/5 per datasheet)
- Fix GPS UART pins in platformio.ini (UART0 1/3 → UART1 21/19)
- Fix radio_set_tx_power signature (uint8_t → int8_t)
- Remove conflicting duplicate defines between variant.h and Board.h
(P_LORA_BUSY was RADIOLIB_NC vs 13, ADC_MULTIPLIER was 1.85 vs 5761)
- Remove stale LoRa/WisBlock defines from variant.h (Board.h is
authoritative)
- Remove "ethernet" and "can" from board JSON connectivity
- Use static SPIClass for radio init (matches Heltec V3 convention)
- Remove build_unflags=-Os (keep size optimization for 4MB flash)

Verified against RAK11200/RAK13300 datasheets
pull/1925/head
Wessel Nieboer 3 months ago
parent
commit
fe179c4d45
No known key found for this signature in database GPG Key ID: 929C8E45E33B5FD2
  1. 4
      boards/wiscore_rak11200.json
  2. 6
      variants/rak11200/platformio.ini
  3. 11
      variants/rak11200/target.cpp
  4. 2
      variants/rak11200/target.h
  5. 53
      variants/rak11200/variant.h

4
boards/wiscore_rak11200.json

@ -13,9 +13,7 @@
},
"connectivity": [
"wifi",
"bluetooth",
"ethernet",
"can"
"bluetooth"
],
"frameworks": [
"arduino",

6
variants/rak11200/platformio.ini

@ -2,8 +2,6 @@
extends = esp32_base
board = wiscore_rak11200
board_build.partitions = min_spiffs.csv ; get around 4mb flash limit
build_unflags = -Os
build_type = release
build_flags =
${esp32_base.build_flags}
${sensor_base.build_flags}
@ -12,8 +10,8 @@ build_flags =
-D RAK_BOARD
-D PIN_BOARD_SCL=5
-D PIN_BOARD_SDA=4
-D PIN_GPS_TX=1
-D PIN_GPS_RX=3
-D PIN_GPS_TX=21
-D PIN_GPS_RX=19
-D PIN_GPS_EN=-1
-D PIN_OLED_RESET=-1
-D RADIO_CLASS=CustomSX1262

11
variants/rak11200/target.cpp

@ -17,7 +17,12 @@ RAK11200Board board;
#endif
#endif
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
#if defined(P_LORA_SCLK)
static SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);
#else
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY);
#endif
WRAPPER_CLASS radio_driver(radio, board);
@ -36,7 +41,7 @@ bool radio_init() {
rtc_clock.begin(Wire);
#if defined(P_LORA_SCLK)
return radio.std_init(&SPI);
return radio.std_init(&spi);
#else
return radio.std_init();
#endif
@ -53,7 +58,7 @@ void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) {
radio.setCodingRate(cr);
}
void radio_set_tx_power(uint8_t dbm) {
void radio_set_tx_power(int8_t dbm) {
radio.setOutputPower(dbm);
}

2
variants/rak11200/target.h

@ -23,5 +23,5 @@ extern EnvironmentSensorManager sensors;
bool radio_init();
uint32_t radio_get_rng_seed();
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
void radio_set_tx_power(uint8_t dbm);
void radio_set_tx_power(int8_t dbm);
mesh::LocalIdentity radio_new_identity();

53
variants/rak11200/variant.h

@ -1,63 +1,26 @@
#pragma once
// RAK11200 WisBlock ESP32 Pin Definitions
// Reference: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Datasheet/
// Reference: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK13300/Datasheet/
// I2C Interface (Main board I2C)
#define I2C_SDA 21
#define I2C_SCL 22
// I2C Interface (I2C1 on WisBlock connector pins 19/20)
#define I2C_SDA 4 // GPIO4
#define I2C_SCL 5 // GPIO5
// GPS Interface
#define GPS_TX_PIN 1
#define GPS_RX_PIN 3
// GPS Interface (UART1)
#define GPS_TX_PIN 21
#define GPS_RX_PIN 19
#define PIN_GPS_EN -1
#define GPS_POWER_TOGGLE
#define GPS_BAUD_RATE 9600
// User Interface
#define BUTTON_PIN 34 // WB_SW1 - User button
#define BATTERY_PIN 36 // WB_A0 - Battery voltage measurement pin
#define ADC_CHANNEL ADC1_GPIO36_CHANNEL
#define ADC_MULTIPLIER 1.85 // Adjust based on voltage divider
#define LED_PIN 12 // WB_LED1 - Status LED
#define LED_PIN_2 2 // WB_LED2 - Secondary LED
// LoRa radio module pins for RAK11200 + RAK13300 SX1262
#define P_LORA_DIO_1 22 // WB_IO6 - DIO1 interrupt pin
#define P_LORA_NSS 32 // WB_CS - SPI Chip Select
#define P_LORA_RESET 23 // WB_IO4 - Reset pin
#define P_LORA_BUSY RADIOLIB_NC // Not connected - using DIO2 for RF switching
#define P_LORA_SCLK 33 // SPI Clock
#define P_LORA_MISO 35 // SPI MISO
#define P_LORA_MOSI 25 // SPI MOSI
// LoRa radio configuration
#define USE_SX1262
#define SX126X_MAX_POWER 22
#define SX126X_DIO2_AS_RF_SWITCH true
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define SX126X_CURRENT_LIMIT 140
// Compatibility defines for variant file configuration structure
#define LORA_CS P_LORA_NSS
#define LORA_SCK P_LORA_SCLK
#define LORA_MOSI P_LORA_MOSI
#define LORA_MISO P_LORA_MISO
#define LORA_DIO1 P_LORA_DIO_1
// WisBlock GPIO mapping for RAK11200
#define WB_IO1 14 // GPIO14
#define WB_IO2 27 // GPIO27
#define WB_IO3 26 // GPIO26
#define WB_IO4 23 // GPIO23
#define WB_IO5 13 // GPIO13
#define WB_IO6 22 // GPIO22
#define WB_SW1 34 // GPIO34 - Switch/Button
#define WB_A0 36 // GPIO36 - Analog input
#define WB_A1 39 // GPIO39 - Analog input
#define WB_CS 32 // GPIO32 - SPI Chip Select
#define WB_LED1 12 // GPIO12 - LED1
#define WB_LED2 2 // GPIO2 - LED2
// Board identification
#define RAK_11200
#define RAK_BOARD

Loading…
Cancel
Save