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: