New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pro8MHz board does join but does not transfer messages #17
Comments
Hi @SensorsIot,
I see the EV_JOINING event in your output but not a corresponding EV_JOINED. This means that the node is not yet joined.
What 'LoRa Radio Node board with an 328 chip' exactly did you use? You appear to have selected the pro8mhzatmega328 ('pro-mini') boardid in LMIC-node. Did you:
Yes, I have LMIC-node working on TTN V3 (TTS V3 CE) with both Arduino Pro-Mini (clone) and BSFrance LoRa32u4 II. In addition I also sucessfully tested the Pro-Mini with MCCI LMIC using its included FYI: LMIC-node was successfully tested with all its supported boards on both TTN V2 and TTN V3 (TTS V3 CE). For TTN V3 OTAA device settings I used: It works fine (including downlinks) for my pro-mini(s). Below the serial output:
Here with display disabled. Timing of the first events is now more similar to the timing in your output (I use a shorter doWork interval for testing though):
Yes, for using MCCI LMIC with LMIC-node the memory on ATmega328 and ATmega32u4 is just too small. But you can run MCCI LMIC with its included Don't forget to add setting clock error to 30000 ppm (1965) in ttn-otaa.ino or else it won't join. // LMIC init
os_init();
// Reset the MAC state. Session and pending data transfers will be discarded.
LMIC_reset();
#define LMIC_CLOCK_ERROR_PPM 30000
#if LMIC_CLOCK_ERROR_PPM > 4000
// Allow clock error percentage to be > 0.4%
#define LMIC_ENABLE_arbitrary_clock_error 1
#endif
uint32_t clockError = (LMIC_CLOCK_ERROR_PPM / 100) * (MAX_CLOCK_ERROR / 100) / 100;
LMIC_setClockError(clockError); After compilation PlatformIO shows the following memory usage:
Output from
|
Hi @Sensorslot and @lnlp !! This thread helped me to get a Pro Mini work on TTS V3 stack (tested OK with OTAA) Flash : 80% So Mega 328(pro mini) and TTS V3 are OK, I can confirm with your help !! LMIC.node tested OK on a Ttgo LoRa Oled V1 borad for new OTAA or ABP V3 devices Best Regards |
Thank you for both answers. I tried now again with the 328 chip as well as with TTGO boards and discovered strange things: Sometimes the payload is transferred ok with both boards (using this sketch, 328 with the old library, and the TTGO with the new library). First, I tried with OTAA. Often, I saw that the join request was accepted by TTNV3 but my node did not transmit the payload. I have to say: I want to use deep sleep and for the moment I often reset my board to simulate this effect. Unfortunately, I did not find a deep-sleep example that does not re-join every time. Such an example would be extremely important because most LoRa sensors use deep sleep. |
With this sketch you mean LMIC-node?
Again, what 328 board exactly? Previous questions:
You seem not willing to provide details asked for. Without details, exact type of board, console data etc. it will be very difficult to try help determine what the possible cause of your problem is.
Deep sleep implementation and behavior dependends on the type of microcontroller and often also dependends on the rest of the hardware on the (development) board. As LMIC-node is a relatively basic cross-platform example application for showing how to use the LMIC library, adding support for deep sleep for different families of microcontrollers would be a huge project in its own. Also the (MCCI) LMIC library currently does not have builtin (generic) support to save and restore LMIC state that could be used for (e.g. ESP32) deep sleep. Therefore deep sleep is not supported in LMIC-node.
I guess these simulations mainly target behavior of ESP32 chips which do not maintain their memory/state during deep sleep.
Possibly the ttn-esp32 library mentioned in below topic contains an example and can provide help for LMIC with ESP32 deep sleep: https://www.thethingsnetwork.org/forum/t/overview-of-lorawan-libraries-howto/24692
Please note that ABP on V3 is not exactly the same as on V2. It is more strict and requires additional device settings to be specified when adding the device in the TTS console (or via CLI tools). In the console, part of these required parameters must be manually added; they are not automatically set by default. For now (and without additional details) your problems appear not to be caused by an issue in LMIC-node. |
8mA during deep-sleep with this exemple as is on a TTGO Oled LoRa V1 |
You were right. I found the problem (it took quite a while and is the reason for my late answer): DIO1 was connected to a different pin (from an old project). Now OTAA works with the TTGO board. |
Thanks for your feedback.
The link to the "How to migrate ABP Devices..." contains information that may still be useful for you. |
And now I got it also working on the pro mini 3.3v board. Thank you, lnlp: The sketch really needed your addition #define LMIC_CLOCK_ERROR_PPM 30000 Unfortunately, I do not know what it is for:-( But it worked also with my TTGO board. What is the reason it is not included in the example file? I created an example that stores the LMIC variables to EEPROM (I switch the board completely off and it starts only once a day). |
@SensorsIot Maybe LMIC also uses it on a lower level to allow for a higher tolerance in tracing the chirp frequency hopping? Edit: |
@SensorsIot
If with "the example file" you mean
DO NOT set ClockError for boards that do not need it (e.g. TTGO boards) as it will only make things worse, not better. For all boards supported by LMIC-node you can check if ClockError is used (set) or not by checking the board's Board Support File (BSF). The README.md states to check BSF files for important information about a board. Excerpt from the // LMIC Clock Error
// This is only needed for slower 8-bit MCUs (e.g. 8MHz ATmega328 and ATmega32u4).
// Value is defined in parts per million (of MAX_CLOCK_ERROR).
// Value 30000 was determined empirically.
#ifndef LMIC_CLOCK_ERROR_PPM
#define LMIC_CLOCK_ERROR_PPM 30000
#endif Excerpt from the // LMIC Clock Error
// This is only needed for slower 8-bit MCUs (e.g. 8MHz ATmega328 and ATmega32u4).
// Value is defined in parts per million (of MAX_CLOCK_ERROR).
// #ifndef LMIC_CLOCK_ERROR_PPM
// #define LMIC_CLOCK_ERROR_PPM 0
// #endif @ALL |
Thank you for your explanations. Now I understand better. I like your code and it runs well on ESPs. A lot of people still used 8 bit CPUs for their projects because the ESPs use quite some power. This is why I searched for a solution to use the newest LMIC library and V3. I learned that I have to recommend the OTAA example for this situation, which is ok with me. |
It's a pity that the ESP32 is often blamed for being power hungry, while this is true when run at full speed and using Wifi/BT. For deep sleep it should be possible to go as low as 10 to 20 uA. But unfortunately most (Chinese) ESP32 development boards are not designed for efficient battery powered operation using deep sleep (but that you already knew 🙂). While this does still not match popular ARM chips, it is already way better than "using quite some power". Maybe some case for one of your videos?: A bare ESP32 module with 4 MB flash without PSRAM, running at 10 MHz, not using Wifi/BT, with SX1276/RFM95 LoRa module using the MCCI LMIC library. BTW, did you notice the ESP32 low-power topic? |
I agree with your analysis that the board often is the problem and not the chip. Maybe it would be an idea to do a test for the best LoRa board. Contenders would then also be the Pi Pico, an 328p, and maybe an STM Blue or Blackpill and an ESP32. |
Not sure if the MCCI LMIC library allows access to the OTAA keys etc. |
I think many people would like that. My goal for LMIC-node was to make using LMIC simple and accessible to a wide audience, while preventing them from running into invisible walls and having to go through steep learning curves first. Based on the feedback LMIC-node seems to succeed in that goal quite well. |
For the moment I only saved the LMIC structure in EEPROM and reload it after boot (another project saves it in RTC memory for deep sleep). For the moment this works. But I only have a few hours of experience. I also saw a parameter that joins automatically from time to time. I plan to investigate this matter a little more. |
It already reads and stores all OTAA and ABP related LoRaWAN keys so that should not be an issue.
This functionality is on the LMIC Development Plans list but no further details have been made available yet. |
I wanted to use a LoRa Radio Node board with an 328 chip and OTA on the V3 stack. It uses the old LMIC library and joins, but does not transfer messages. Serial stops after:
LMIC-node
Device-id: pro-mini
LMIC library: Classic [Deprecated]
Activation: OTAA
Interval: 60 seconds
Clock Error: 30000 ppm (1965)
000000000817: Event: EV_JOINING
000000000882: doWork job started
Unfortunately, the memory is too small to use the new MCCI library. Was anybody successful to use an "Arduino-like" board on the V3 stack?
The text was updated successfully, but these errors were encountered: