Open neresus opened 6 months ago
I notice your device has GP17 set to control antenna switch TX/RX. Low enables transmit, high for receive. I'd be pretty sure my code, which is a fixed version of LMIC to use SPI channel 1 instead of 0 does not know about that.
Have you tried any Waveshare examples? Their demo code (https://www.waveshare.com/wiki/RP2040-LoRa) might operate the GP17 RX/TX switch properly and solve your problem.
I try use that code but it stops on init lora line and thats all... Pico LoRaWAN - OTAA - Temperature + LED Initilizating LoRaWAN ...
your core works after init otaa I also change spi1 to spi0 and back. Also try different pinouts all what can be done but with no luck. kingdom for working code...
My code doesn't operate the antenna switch so its probably stuck in RX mode if the default value of GPIO17 is High
Well, I've spent half an hour going through the Waveshare demo code. It does define the switch:-
board-config.h: #define RADIO_ANT_SWITCH_POWER 17
BUT I can only find it used ( SX126xAntSwOff(); and SX126xAntSwOn();) in the ping-pong example. So, that ciode should work but it's for two devices sending ping-pong messages between themselves.
Unless the OTAA example leaves the antenna in transmit mode, which it shouldn't, then it isn't going to work with LoRaWAN which expects a receive window to be opened after a TX for the server to tell the node it's operating parameters.
So what can you do next? Well, firstly I'd email Waveshare - good luck with that one - their track record for working demo code sucks IMHO. They'll probably tell you your OTAA keys are wrong like they did with me. You'd have to be very detailed in explaining what you have tried.
Or you could modify my code by creating two functions similar to those used by the Wavshare code then add them in before each call to send/receive data. It's not something I'd want to do as I'm working on a time consuming project of my own. I have slightly renamed these to make it clear which to use before a TX/RX.
void SX126xAntSwRx( void )
{
GpioInit( &AntPow, RADIO_ANT_SWITCH_POWER, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );
}
void SX126xAntSwTx( void )
{
GpioInit( &AntPow, RADIO_ANT_SWITCH_POWER, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
}
Good Luck. Sorry I can't be more helpful.
Hello! Any news about this? I have the same problem. @neresus were you finally able to solve the problem?
Hello! I use another code and there can join to TTN. But no luck with Chirpstack. It's not useful for mine project I use it for meshtastic.
Hello! I use another code and there can join to TTN. But no luck with Chirpstack. It's not useful for mine project I use it for meshtastic.
Do you have any reference to the code that you used to join TTN? Thanks in advance!
I have bad news I forgot link. But project have name rp2040-lora-code. I am pretty sure it's working and sending temperature.
Hello I try to use this code for connect to lora network with wavwshare lora-hf. But MLME Join log message shows only Tx timeout. I set pinout as described on waveshare site https://www.waveshare.com/w/upload/8/82/RP2040-LoRa_Pinout.jpg .mosi = 15, .miso = 24, .sck = 14, .nss = 13 .reset = 23, .busy = 18, .dio1 = 16 I tested all revisions but no luck with connection.
129 LmHandlerMsgDisplay.c DisplayNetworkParametersUpdate() DevEui : 00-00-00-00-20-20-20-20 JoinEui : 00-00-00-00-00-00-00-00 Pin : 00-00-00-00
success! Joining LoRaWAN network ...
=========== MLME-Request ============
MLME_JOIN
=====================================
STATUS : OK ...
=========== MLME-Confirm ============
STATUS : Tx timeout