Waveshare Pi Pico SX1262 Hat Demo

Hello there.

I’ve got a little project I’m working on that I’m looking to utilize a Waveshare Pi Pico SX1262 hat but I could use some help.

I have a Pi 3B that I installed an Elecrow LR1302 hat on and flashed with the FULL Gateway OS. I ended up having to set the module as a SEEED WM1302 in the Concentratord but it seems to be working fine.

Unfortunately, the demo code for the Waveshare Pi Pico SX1262 is just atrocious. I wish I looked into it before buying this thing. I managed to correct the several errors in the demo code based on the commits to the main branch of the repo linked in the wiki and finally got my Pi Pico connected to my gateway.

So, it’s able to send packets to my gateway, but it seems I’m not able to receive them. Or at least, they aren’t always received correctly. I’ve got it printing to serial and it’s supposed to print to an LCD screen I wired up every time it receives anything with the following from the demo code:

// wait for up to 30 seconds for an event
if (lorawan_process_timeout_ms(30000) == 0) {
    // check if a downlink message was received
    receive_length = lorawan_receive(receive_buffer, sizeof(receive_buffer), &receive_port);
    if (receive_length > -1) {
        printf("received a %d byte message on port %d: ", receive_length, receive_port);
                
        //Create Strings to send to screen.
        sprintf(string, "RcvPkt: %d, Len: %d", packetRecvCount++, receive_length);
        PrintText(string); //create new screen in memory
        sprintf(string, "RSSI: %u", SX126xGetRssiInst());
        PrintText(string);
        LCD_1IN3_Display(BlackImage); //Update Screen
        memset(string, '\0', sizeof(string));//Clear Print string buffer

        for (int i = 0; i < receive_length; i++) {
            printf("%02x", receive_buffer[i]);
        }
        printf("\n");

        // the first byte of the received message controls the on board LED
        gpio_put(PICO_DEFAULT_LED_PIN, receive_buffer[0]);
    }
}

But I never really see it fire and nothing has ever printed to the screen or over serial from this function. I’ve tried sending packets directly from the ChirpStack Browser and I’ve never seen them come through either, but I do see a “txack” event in the browser event log.

The only thing I do see occasionally is a Downlink print from the debug code like the one below:

###### =====   UPLINK FRAME        7   ===== ######

CLASS       : A

TX PORT     : 2
TX DATA     : UNCONFIRMED
18 

DATA RATE   : DR_0
U/L FREQ    : 902900000
TX POWER    : 0
CHANNEL MASK: 00FF 0000 0000 0000 0001 


###### ========== MCPS-Indication ========== ######
STATUS      : OK

###### =====  DOWNLINK FRAME        0  ===== ######
RX WINDOW   : 1
RX PORT     : 0

DATA RATE   : DR_10
RX RSSI     : -62
RX SNR      : 8

sending internal temperature: 24 C (0x18)... 
###### =========== MCPS-Request ============ ######
######           MCPS_UNCONFIRMED            ######
###### ===================================== ######
STATUS      : OK
success!

Has anyone else used this Pi Pico sx1262 hat from Waveshare and been able to get it to work correctly? Or do you have any suggestions on how what I should look into next?

The Waveshare wiki mentions a python sdk and demo code, but I couldn’t find anything on that the python demo. So, if you have any info on that, I’d love to see it.

Here’s a picture of my janky setup for fun:

Curious if you made any progress on this, I’m at a similar point.

  1. Flashed GW w/ a RAK5146 on Pi4 - success
  2. Attempting to configure OTTA w/ a Waveshare sx1262 LoRaWAN hat - no success

The sx1262 module seems to require manual DevEUI, AppKey, and JoinEUI which i’ve ran to calculate and included in a .py. Debug output looks successful, however I’m unable to add the module to the gateway.

Any progress from anyone on a similar setup?

I have not made much more progress. I’m pretty new to this all and the learning curve feels pretty vertical. The demo code doesn’t seem to perform the join handshake with the gateway correctly (if at all). The gateway accepts the request from the pico which allows the gateway to receive packets, but the pico doesn’t generate the key or something it’s supposed to make(from joinaccept packet?). I assume this is why it won’t reconnected after a power-cycle or receive any packets.

I did find this micropython lib that seems promising. It’s written for the EU868 band though and I need US915. Also, you need to setup frequencies, data rates, payload size, and everything manually for the US915 band in the code. I haven’t had time with full time work and school and being sick to delve into this anymore than getting my screen working again in micropython.

I’ll need to read the LoRaWAN regional parameter documents it refers to and decipher what those values are supposed to be for the US915 band before I can try running the python code on my pico.