Skip to content

Commit

Permalink
Fix RF switching logic on rp2040-lora board. (#4486)
Browse files Browse the repository at this point in the history
* Fix LED pinout for T-Echo board marked v1.0, date 2021-6-28

* Merge PR #420

* Fixed double and missing Default class.

* Use correct format specifier and fixed typo.

* Removed duplicate code.

* Fix error: #if with no expression

* Fix warning: extra tokens at end of #endif directive.

* Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board.

---------

Co-authored-by: Ben Meadors <[email protected]>
  • Loading branch information
Mictronics and thebentern authored Aug 17, 2024
1 parent 5ff1078 commit e37acae
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions variants/rp2040-lora/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// rxd = 9

#define EXT_NOTIFY_OUT 22
#define BUTTON_PIN 17
#undef BUTTON_PIN // Pin 17 used for antenna switching via DIO4

#define LED_PIN PIN_LED

Expand All @@ -32,23 +32,28 @@

// https://www.waveshare.com/rp2040-lora.htm
// https://www.waveshare.com/img/devkit/RP2040-LoRa-HF/RP2040-LoRa-HF-details-11.jpg
#define LORA_SCK 14 // 10
#define LORA_MISO 24 // 12
#define LORA_MOSI 15 // 11
#define LORA_CS 13 // 3

#define LORA_DIO0 RADIOLIB_NC
#define LORA_RESET 23 // 15
#define LORA_DIO1 16 // 20
#define LORA_DIO2 18 // 2
#define LORA_DIO3 RADIOLIB_NC
#define LORA_DIO4 17
#define LORA_SCK 14 // GPIO14
#define LORA_MISO 24 // GPIO24
#define LORA_MOSI 15 // GPIO15
#define LORA_CS 13 // GPIO13

#define LORA_DIO0 RADIOLIB_NC // No GPIO connection
#define LORA_RESET 23 // GPIO23
#define LORA_BUSY 18 // GPIO18
#define LORA_DIO1 16 // GPIO16
#define LORA_DIO2 RADIOLIB_NC // Antenna switching, no GPIO connection
#define LORA_DIO3 RADIOLIB_NC // No GPIO connection
#define LORA_DIO4 17 // GPIO17

// On rp2040-lora board the antenna switch is wired and works with complementary-pin control logic.
// See PE4259 datasheet page 4

#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_BUSY LORA_BUSY
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO2_AS_RF_SWITCH // Antenna switch CTRL
#define SX126X_RXEN LORA_DIO4 // Antenna switch !CTRL via GPIO17
// #define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif

0 comments on commit e37acae

Please sign in to comment.