SX1262 LoRa Node Module for Raspberry Pi Pico, LoRaWAN (CE08628)

This is a placeholder topic for “SX1262 LoRa Node Module for Raspberry Pi Pico, LoRaWAN” comments.

This is a SX1262 LoRa Node Module For Raspberry Pi Pico with LoRaWAN Support

Read more

1 Like

Just wondering if this module includes an antenna or if it needs to be purchased separately.

1 Like

@Nigel164388 From product page, so Yes.

Shipping List

  • 1x LoRa node module
  • 1x Interface cable
  • 1x RF antenna
  • 1x 600mAh LiPo battery
1 Like

Hi Nigel,

Hats off to Jim for pasting through that list, the third image on the product page shows exactly what it looks like as well!

Liam

2 Likes

Headsup for anyone attempting to use the demo provided by waveshare, there’s an updated library at GitHub - ArmDeveloperEcosystem/lorawan-library-for-pico: Enable LoRaWAN communications on your Raspberry Pi Pico or any RP2040 based board. 📡 which resolves compiler errors.

3 Likes

Welcome to the forum Michael!

Thank you for sharing, you will save your fellow makers time troubleshooting down the line!

Thanks Jack,
I still haven’t got it connecting to TTN, but at least it’s compiling…

Has anyone got this HAT working on a raspi pico connected to the things network using python?

It looks like the waveshare docs still only have C arduino drivers.
Some light research has turned up nothing promising for MicroPython. It looks ripe for the porting, but the library structure is kind of intimidating to reverse-engineer.

I decided to have a go porting this shield over to Micropython and ran into some hurdles. I sent the following to waveshare for help and their response was less then helpful, also below. Is anyone able to help out?
Hi,
I’m am trying to port the SX1262 from C to Micropython and a I have couple of questions that have come up.

  1. I’m setting up device identifiers (DevEUI, and potentially JoinEUI/AppEUI for OTAA) for LoRaWAN on a module using the X1262 chip. Is the ‘Node Address’ register (0x06CD) appropriate for storing the 64-bit DevEUI? Are there any other registers particularly well-suited for this purpose?
  2. If using OTAA, where is the recommended location to store the 128-bit (16-byte) AppKey on the SX1262? Are there registers suitable for this?
  3. Are there any specific usage limitations, address filtering rules, or special behaviors documented for the ‘Node Address’ register (and any others you might suggest) that would prevent their use for storing generic device identification data?
  4. Do you have any available documentation or examples from Waveshare on configuring an SX1262 module specifically for LoRaWAN operation?
  5. Are there any known recommendations or specific register usage patterns for LoRaWAN networks that I should be aware of when configuring my module?

Waveshare Response.
We currently provide C programs and python programs. We do not provide micro python programs. Please click the link below to download:

[https://www.waveshare.net/w/upload/a/a1/Sx126x_lorawan_hat_code.zip]

Best wish!

1 Like

Hi Adam,

Sounds like a great project!!

PS: Core has a neat factory ep going through a few details on writing a driver:

All of the memory locations in the register map will have some function in running the module, if you’re looking for a place to store them it might be best on an external SPI flash IC.
Typically EUI’s are stored on the microcontroller side rather than in the radio

A rough description can be found here about using those registers:


(An external function is setting these bits)

Again the microcontroller side of things is meant to hold on to all of the LoRaWAN related keys and identifiers.

Waveshare has some demo code in the resources section of their wiki for the Node, that would also be the best starting point for making the micropython driver.

LoRaWAN has a list of standards that nodes, gateways and anything else on network have to follow: LoRaWAN for Developers - LoRa Alliance®

A lot goes into writing a driver! It’s good that they have a starting platform with Arduino, but ultimately they get to pick their market.

I recall Core stocking an E5 LoRa Model - though I am unsure if Seeed/Core have developed LoRaWAN code for Pico/Micropython.

1 Like

Thanks for your help Liam, I’ll keep cracking on with it and see how I go.

2 Likes

Hello Everyone, I’m trying to use the Waveshare sample code and get it to connect to Chirpstack running locally. So far I’ve got it to build, fixed a bug where sscanf wasn’t converting the bytes to chars properly, the messages are being sent to chirpstack and are failing on the MIC being incorrect, I’ve tried a few different combinations of DevEuis/JoinEuis and app ids and nothing seems to be working?
Has anyone found a set of ids that work with Chirpstack?

1 Like

I can get it to work if I put all zeros everywhere, not ideal but a step in the right direction.

As I have not even looked at the code and the way that modules work, My key question is how is the MIC getting added? Is this something the code does for you, or are you expected to do that your self.

remember the MIC is a Message Integrity Check and will use one of your keys. If you want to give me some sample data and keys I can see what I think the MIC should be and/or give some examples if needed to help you debug.

I just got it to work. The MIC is calculated, it is some combination of the DeviceEUI and Application Key or OTAA Key and fed through a AES algorithm to get to 4 bytes, I’m a bit hazy on the details and my brain is a bit fried from trying to get this to work for the last 2 days.
For those who come after me, to get this to work, once you get it to actually compile you then need to go to lorawan.c and go to the funtion OnNetworkParametersChange, about line 392.
In there you’ll find a lot of code that looks like:
sscanf(device_eui + i * 2, “%2hhx”, &deviceEui[i]);
This wasn’t working for some reason, the format string just wasn’t working, so I changed this to:
unsigned in tmp=0;
sscanf(device_eui + (i*2), “%02x”, &tmp);
deviceEui[i] = tmp;
I did this for all the sscanfs, replacing the variable names as needed and once I got this all done I was able to get my Pico talking to Chirpstack through a LoRaWAN gatway.
This was done using this GitHub - siuwahzhong/lorawan-library-for-pico: Enable LoRaWAN communications on your Raspberry Pi Pico or any RP2040 based board. 📡 repository.

Good to hear.
I have all mynown cose for my test lorawan server, so had to get the encryption and MIC working to see what the data is. But too kuch to quote without checking code and notes :slight_smile:

Has anyone tried to get it working through arduino library sx126x-arduino

@Craig121119 Can you please share the code that you used to get the node to connect to Chirpstack

I’d like to, but since I did this on the clock the source code isn’t mine, I’ll check with my client, then I need to work out where this actually is. If I can do those 2 things then I’ll put it up on github and post a link back here.

2 Likes

Hi I got it connected to Chirpstack and is able to send data but could not do so with TTN I think the issue is with the packet forwarder used by the gateway

1 Like