WiFi LoRa 32 v3 - LoRa SPI Pins

Hi Folks,
I have the above mentioned Board and I am struggling for days to setup the LoRa node.
According to the Schematics, the LoRa Pin are: NSS 8, SCK 9, MOSI 10, MISO 11, RST 12, BUSY 13 and DIO1 14.

loran = uLoRa(
cs = 8,
sck = 9,
mosi = 10,
miso = 11,
irq = 14,
rst = 12,
ttn_config = LoRaWAN_CONFIG,
datarate = LORA_DATARATE,
fport = 1
)

I get the error: File “ulora.py”, line 128, in init
TypeError: Can not detect LoRa Module. Please check wiring!.

I would be very grateful if anyone can help me get LoRa working in Micropython.

Thanks.

Best regards

Hi @tssave, welcome to the forum.
I’d like to point out a couple of things:

  • The uLora library states that it works with SX127x chips, while the V3 boards use the SX1262.
  • LoRaWAN in micropython is generally not available. If I’m not mistaken, there’s also an experimental library by bnnorman which may work, but for actual working stacks, C++ is definitely recommended. RadioLib should be viable to get working or at least I can supply you with a sketch that does the device part such that you only need to do the TTN part.

Cheers

Thank you for taking your time for this.
The LoRaWAN is is just my ttn configuration.
I would appreciate your RadioLib solution, if it is not too difficult for me to implement.
If I could just get the actual pins for the SPI that would bring me further.
Thanks again!

Your pinout looks completely spot-on, it’s just the library that doesn’t support the SX1262 that’s on the V3 board.

Make sure that you use version 6.3.0 of RadioLib. And then you can initialize the module as follows:

SX1262 radio = new Module(8, 14, 12, 13);   // NSS/CS, DIO1, RST, BUSY

SPI should automatically work correctly, but if you still get errors about the radio module not found, you could try the following:

SPIClass spiSX(SPI);
SPISettings spiSettings(2000000, MSBFIRST, SPI_MODE0);
SX1262 radio = new Module(8, 14, 12, 13, spiSX, spiSettings);   // NSS/CS, DIO1, RST, BUSY

And in the setup(), before calling radio.begin(), add the following line:

spiSX.begin(9, 11, 10, 8);          // SCK/CLK, MISO, MOSI, NSS/CS

With that, you should be able to use this example. Make sure you read the comments, especially about the AppKey and NwkKey, but if you fill in the right keys and register your device as LoRaWAN v1.1 (revA) on TTN, you should be able to get it working!

Note that it does require a TTN-connected gateway in range; if that is not the case, you will not be able to join the network.

Thank you so much for your assistance with this. Appreciate it very much!

1 Like

Hi,

sorry for the intrusion, but I’m very interested in the conversation.
I have the same board indicated in the thread subject and I need some information.

I’ve been trying to get the board to communicate with my Lorawan network, implemented with Chirpstack for days, but I’m going crazy…

I’m using jgromes’ RadioLib library and exactly the example you indicated.
From your experience, do you know if it has been tested successfully with this card (V3 sx1262) and the parameters you indicated?

On my chirpstack side, I can see the LoRaWAN frame of the “joinrequest” arrive but then I receive an error for “UPLINK_MIC” followed by an error code -6 (RADIOLIB_ERR_RX_TIMEOUT) from the library.
the UPLINK error seems to be an error in the identification parameters, but something doesn’t add up to me, with the same parameters, using the LoRaWAN_App library, I can communicate correctly and without using LoRaWAN v1.1 but 1.0.x.

I can attach my sketch… from your experience what could I’m doing wrong?
I’m going in endless circles and I don’t understand if I’m making mistakes or the library isn’t ready for this radio and lorawan module yet.

Thank you

Hi @evon800c and welcome!
Here is the original RadioLib announcement: https://www.thethingsnetwork.org/forum/t/radiolib-open-beta-a-new-lorawan-v1-1-stack/65534?u=stevencellist
As you can see, it has been tested on V3 / SX1262 boards (very extensively)! My main board during development was the Wireless Stick Lite V3.

The main thing you should pay attention to is the comment in the code regarding the NwkKey and AppKey: the console will tell you it’s one while the code will require the other. Somehow these are swapped wrt the official LoRaWAN specs.

Please check that these are correct, and let me know if you think these are all done well but the problem persists. If you share a screenshot of your console and a code snippet, you can share everything apart from (part of the) AppKey as that is the actual thing you should protect and isn’t publicly accessible.

Hi,
now it seems to be working… but before singing victory to myself, I need to check what I was doing wrong.
For now, thanks for your availability.

Davide

1 Like