ESP32 & SX1262 Radio - working?

I’ve been running an ESP8266 and SX1276 for my greenhouse data for two years now (OTAA).

I now need to switch to an ESP32 (more I/Os) and an SX1262.

Has anyone already got this pair working under the Arduino IDE Radiolib or LMIC?

My initial tests with Radiolib version 7.5.0 failed, and I found this statement online that I find hard to believe: “In RadioLib 7.5.0, there is NO public uplink function at all The LoRaWAN implementation in 7.5.0 is unfinished and cannot send uplinks from user code. This is whysendUplink() → removed, uplink() → protected, No replacement exists. This is a known issue in RadioLib 7.5.0.“

Help would be very appricated :slight_smile:
Peter

Where on earth did you find that statement?

If it was an AI response, then :man_shrugging: you sorta get what you asked for.

If you care to look at the actual RadioLib docs there are examples for ESP32 with how to notes written by @CaptainAwesome as well as persistence examples so you can power off the ESP32 and a whole raft of automagic board configuration facilities and, well, everything.

Searching on here for RadioLib would have yielding a number of responses, including ones from the primary developer and his trusty sidekick. The last post was that RadioLib now passes all pre-certification tests, so is as good as, if not better than many other implementations out there.

That has got to be AI because I can’t find any part of that quote on the web, and 7.5.0 hasn’t been out that long. While that statement would at best makes sense for something like 6.6.0 when the separate uplink/downlink functions were removed in favour of a replacement that does the same and more.

Just look at the LoRaWAN examples in RadioLib and read the notes :slight_smile: and if things are unclear, please feel free to open a discussion on the repository on what could be improved.

(And a note that LMIC nowadays does actually support the SX1262, if you want to use their library instead.)

Thanks, that confirms my opinion about the AI; I knew it couldn’t be right.

Of course, I searched the forum for ESP32, SX1262, and RadioLib. Unfortunately, the six posts I found didn’t help.

I looked through the examples in the RadioLib (LoRaWAN, SX1262), but I guess I got lost after ABP, Class C, and Multicast…
I went through the examples again, and “LoRaWAN Starter” seems to be the right one.

I’ll post the working sketch as an example in the Arduino forum; it fits probably better than here.

Anyway, your answer came faster than the AI’s, impressive!

Thanks for your help, and have a good evening.

Peter

There’s a reason for that.

The people answering you are where AI gets its answers from because we are the people that created the reality - the original developers, the subject matter experts, the people that first knew the truth because they made it, the ones that created the source code, the examples and the notes.

We are where AI gets it’s answers from, which it then dilutes through the prism of posts from people that post suspect stuff which, to be honest, like you did.

Consequently, your original post adds to the body of knowledge used by AI, a closed loop of information from AI that gets posted which is read by AI that then reinforces the AI.

Hopefully many people can learn from this.

I sometimes wish I could enforce a special order other than alphabetical order.. :frowning:

people looking at the big picture rather than going for the first

:chipmunk:

oooooooooo shiny.


Will do some thinking about names, but overall, it’s not a 20+ list. Self-sabotage by being over-caffeinated is where it’s at.

1 Like

The alphabetical order is fine; I was expecting the example “LoRaWAN_OTAA” after “LoRaWAN_ABP”. OTAA isn’t mentioned in the extensive beginner notes. I should have looked directly at LoRaWAN_Starter.ino; my mistake.

I’ve now adapted the example sketch and achieved a join for the ESP32 + SX1262.

However, only once. The next time I turned on the ESP32, I got the error “devnonce has already been used”.

It seems things have become stricter with LoRaWAN 1.1.0 (my last information was from 1.0.2).

It’s a bit troublesome during development to have to reset the devnonce in the console every time before turning on the MCU. Therefore, I programmed the ESP32 to remember the last devnonce.

Where would be the best place to post the finished example sketch + config.h? Here, in the IDE forum, or on GitHub?

Peter

It would be interesting to see how you’ve done it, but as this is a universal problem that is discussed in @CaptainAwesomes amazing notes.md, it is already catered for both by way of turning off the DevNonce checks during development because during development, this is an issue for all platforms.

More subtly than the bold faced assumption that OTAA is the way to go (it is) which means we just assumed peeps would head for the Starter or the Reference sketches, is the extensive ESP32 only examples you can get here: GitHub - radiolib-org/radiolib-persistence: Utility functions for enabling persistence, mainly for LoRaWAN support in RadioLib and the magical auto-pin-configulator here: GitHub - radiolib-org/RadioBoards: Crowd-sourced database of radio module pinouts.

It’s only really ESP32 that HAS to save all the join & counter info, most other platforms have a deep sleep mode that retains RAM.

I’ve got a few commercial devices out in the field using a variety of different MCU platforms which is how @stevencellist (developer) and @CaptainAwesome (test victim bunny) bottomed out the vast majority of issues by end of 2024, particularly for the ESP32 and the rather nice Heltec CT-62 module.

Subsequently, Mr Cellist has resolved the corner, insane & just-plain-stupid cases to ensure it passes the pre-certification tests prescribed by the LoRa Alliance.

The certification tests are identical but are performed with more expensive computers in an anabolic-steroid chamber to justify the removal of £/$/€10,000 from your bank account. I’ve yet to figure why this is required if you follow the published reference designs to the nearest milli so that the RF is demonstrably good and, well, the firmware works to the tests which is not necessarily the same as the specs. As Semtech provide two reference codes bases, I’m totally at a loss as to what is being tested if you use either of them as the basis of your code. Although we know now that the Semtech code doesn’t always pass all the tests, go figure.

We haven’t got as far as publishing TR007 code, because M won’t authorise it.

Tl;DR: Already fixed, but feel free to post your code in the Discussions section of the repro as it helps junior younger coders like Steven learn from others. :wink:

I’ll ask CA to update the notes regarding ESP32 persistence and pin-maps.

PS, when embarking on something that should be obvious for the stack, go for decaf and ask here or on the repro as it’s likely been done already.

Thanks for the links, the solution functionally corresponds to my code, except for the deep-sleep handling. I don’t use the mode, because the MCU is connected to a photovoltaic with a 230Ah battery (for the robotic lawnmower). A few mA don’t matter…

However, I will adapt the “official” devnonce sketch to be on the secure side. Well, after 30 years on an OS370, I guess I’ll never become a good C++ or MCU programmer :smiling_face_with_tear: .

To adapt the documentation regarding persistence for really beginners or people like me, which touch this technology every 2 years, would be fine :blush:.

Anyway, I’m going to start on the PCB development now.

Peter

There was GCC for the 370, so no real excuses!