ArmDeveloperEcosystem / lorawan-library-for-pico

Enable LoRaWAN communications on your Raspberry Pi Pico or any RP2040 based board. 📡
BSD 3-Clause "New" or "Revised" License
146 stars 49 forks source link

SX1276Read(REG_LR_VERSION) returns 0 #31

Closed wboerhout closed 2 years ago

wboerhout commented 2 years ago

A new gateway was opened near my home, so I am re-opening my LoraWAN project.

I have cloned the repository and have built the examples. Changing only the region in config.h and the device and app key.

In the "hello_otaa" and the "otaa_temperature_led" example, initialization fails consistently in lorawan.c at SX1276Read(REG_LR_VERSION)

The function returns 0, so the test against 0x12 fails. Hardware: Raspberry Pi Pico, Waveshare Pico-LoRa-SX126x module.

What am I missing?

wboerhout commented 2 years ago

Well, this software is promoted by Waveshare for this SX1262 board, but the software says that it is for a different SX1272 board. That board has a different pinout.

It might be possible to redefine the pinout (the README suggests it), but it is unclear to me where and how to redefine the GPIO functions.

gomond commented 2 years ago

https://github.com/siuwahzhong/lorawan-library-for-pico this is the correct supported code......

wboerhout commented 2 years ago

Same difference. I see the references to sx1262 but no instructions whatsoever how to direct the build for that module.

I am familiar with make, but not with CMake-based build systems. Is there a magic incantation in either to set de default region to EU868 and the module (&pinout) to sx1262 instead of the default sx1276 ?

wboerhout commented 2 years ago

I tried to set the PINs manually in the erase_nvm example, where the init is also done. Same error.

wboerhout commented 2 years ago

OK. I cloned the fork you mentioned. This only has the otaa_tem... example. building it gave several compilation errors, one omitted comma in a struct, one with suggestions how to fix them. I did the obvious and now the init succeeds, and the module keeps trying to join the network. Another status altogether. Thanks for your help!