Skip to content
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

Bootloop with TTGO LoRa32 V2.1.6 board with platform-espressif32 v4.30 and higher #45

Open
hekopath opened this issue May 26, 2022 · 27 comments
Labels
workaround Workaround needed

Comments

@hekopath
Copy link

hekopath commented May 26, 2022

Update: See further below for a more complete description of the workaround.


I have observed a bootloop after using the latest espressif32 plattform with a ttgo_lora32_v21 board.
My personal workaround was to specify the previous version in the env section for my board variant.

[env:ttgo_lora32_v21]
platform = [email protected]

Can anybody confirm this problem?

Tested with the current main branch (v.1.3.0 version fail to build because of #41 )

@damanti-me
Copy link

Thanks for your workaround - i have the same board and get the same issue with latest espressif32.

@lnlp
Copy link
Owner

lnlp commented Jul 1, 2022

@hekopath @damanti-me

I tried to reproduce the issue with both the TTGO LoRa32 V2.0 and TTGO T-Beam V0.5 boards and both worked fine, without showing the issue. I only have the V2.0 of this board and none of the V2.1.x versions.

For the test I upgraded all platforms and libraries (pio pkg update). Platform Espressif32 was then updated from v4.2.0 to v5.0.0.
I then removed (delete) the platform Epressif32 installation to start with a 'clean' situation.
I replaced all platform=espressif32 instances in platformio.ini with [email protected], selected board-id ttgo_lora32_v2 and then pressed 'Upload'.

This initiated install of the Espressif32 v4.3.0 platform.
The build and upload both succeeded and I was able to run LMIC-node using Espressif32 v4.3.0 on both the TTGO LoRa32 V2.0 and TTGO T-Beam V0.5.

Below output for the TTGO LoRa32 V2.0 while using Espressif32 v4.3.0:

Build

Processing ttgo_lora32_v2 (platform: [email protected]; board: ttgo-lora32-v2; framework: arduino)
------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/ttgo-lora32-v2.html
PLATFORM: Espressif 32 (4.3.0) > TTGO LoRa32-OLED V2
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20003.220626 (2.0.3)
 - tool-esptoolpy @ 1.30300.0 (3.3.0)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 35 compatible libraries
Scanning dependencies...
Dependency Graph
|-- U8g2 @ 2.33.8
|   |-- SPI @ 2.0.0
|   |-- Wire @ 2.0.0
|-- EasyLed @ 1.1.0
|-- MCCI LoRaWAN LMIC library @ 4.1.1
|   |-- SPI @ 2.0.0
|-- Wire @ 2.0.0
|-- SPI @ 2.0.0
Building in release mode
...
...
Linking .pio\build\ttgo_lora32_v2\firmware.elf
Retrieving maximum program size .pio\build\ttgo_lora32_v2\firmware.elf
Checking size .pio\build\ttgo_lora32_v2\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   5.7% (used 18564 bytes from 327680 bytes)
Flash: [==        ]  21.7% (used 284329 bytes from 1310720 bytes)
Building .pio\build\ttgo_lora32_v2\firmware.bin
esptool.py v3.3
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.

Upload

Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM6
Uploading .pio\build\ttgo_lora32_v2\firmware.bin
esptool.py v3.3
Serial port COM6
Connecting......
Chip is ESP32-PICO-D4 (revision 1)
Features: WiFi, BT, Dual Core, Embedded Flash, Coding Scheme None
Crystal is 40MHz
MAC: d8:a0:1d:40:45:c4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00055fff...
Compressed 17088 bytes to 11848...
Writing at 0x00001000... (100 %)
Wrote 17088 bytes (11848 compressed) at 0x00001000 in 0.4 seconds (effective 355.7 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 128...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.1 seconds (effective 488.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 686.3 kbit/s)...
Hash of data verified.
Compressed 284720 bytes to 162996...
Writing at 0x00010000... (10 %)
Writing at 0x000198eb... (20 %)
Writing at 0x000233b2... (30 %)
Writing at 0x00028739... (40 %)
Writing at 0x0002d9f9... (50 %)
Writing at 0x00032f4d... (60 %)
Writing at 0x00038d3a... (70 %)
Writing at 0x00043127... (80 %)
Writing at 0x0004adfc... (90 %)
Writing at 0x00050251... (100 %)
Wrote 284720 bytes (162996 compressed) at 0x00010000 in 2.6 seconds (effective 886.2 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
=========================== [SUCCESS] Took 52.15 seconds ===========================

Running

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4

LMIC-node

Device-id:     ttgo-lora32-v2
LMIC library:  MCCI
Activation:    OTAA
Interval:      60 seconds

000000027871:  Event: EV_JOINING

000000029733:  doWork job started
000000385513:  Event: EV_TXSTART
000000708409:  Event: EV_JOINED
...

So is this bootloop issue with Espressif32 v4.3.0 specifically related to the TTGO LoRa32 V2.1.6 board or could there be other reasons that caused the issue for you?

By the way, Espressif32 v5.0.0 is already available. Are you still experiencing the same bootloop issue with v5.0.0?
Don't forget to replace any [email protected] instances in platformio.ini with platform=espressif32 again before testing.

@damanti-me
Copy link

damanti-me commented Jul 1, 2022

thank you for your time and investigation.
I repeated the process with different versions of Espressif32 library. For both (v5.0.0, v4.4.0 and v4.3.0) i get the bootloop. And 4.2.0 is working for me. So it seems to be related to Espressif32 lib. If you tell me other ways to verify im would be glad to help.

@hekopath
Copy link
Author

hekopath commented Jul 1, 2022

To not alter the environment to much i just upgraded within PlatformIo

Platform Manager: Updating espressif32 @ 4.3.0
Platform Manager: Removing espressif32 @ 4.3.0
Platform Manager: [email protected] has been removed!      
Platform Manager: Installing platformio/espressif32 @ 5.0.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Platform Manager: [email protected] has been installed!

The base of this test is still the main banch from 26th May.
Only modified the lorawan-keys.h
And now with removed @4.2.0 Tag

Build

Processing ttgo_lora32_v21 (platform: [email protected]; board: ttgo-lora32-v21; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/ttgo-lora32-v21.html
PLATFORM: Espressif 32 (4.2.0) > TTGO LoRa32-OLED v2.1.6
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20002.0 (2.0.2)
 - tool-esptoolpy @ 1.30300.0 (3.3.0)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 35 compatible libraries
Scanning dependencies...
Dependency Graph
|-- U8g2 @ 2.33.8
|   |-- SPI @ 2.0.0
|   |-- Wire @ 2.0.0
|-- EasyLed @ 1.1.0
|-- MCCI LoRaWAN LMIC library @ 4.1.1
|   |-- SPI @ 2.0.0
|-- Wire @ 2.0.0
|-- SPI @ 2.0.0
Building in release mode
Compiling .pio\build\ttgo_lora32_v21\src\LMIC-node.cpp.o
Generating partitions .pio\build\ttgo_lora32_v21\partitions.bin
Compiling .pio\build\ttgo_lora32_v21\lib19a\SPI\SPI.cpp.o
Compiling .pio\build\ttgo_lora32_v21\lib287\Wire\Wire.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\U8g2lib.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\U8x8lib.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\mui.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\mui_u8g2.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_bitmap.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_box.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_buffer.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_button.c.o
Archiving .pio\build\ttgo_lora32_v21\lib19a\libSPI.a
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_circle.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_cleardisplay.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_d_memory.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_d_setup.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_font.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_fonts.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_hvline.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_input_value.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_intersection.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_kerning.c.o
Archiving .pio\build\ttgo_lora32_v21\lib287\libWire.a
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_line.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_ll_hvline.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_message.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_polygon.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_selection_list.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_setup.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8log.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8log_u8g2.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8log_u8x8.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_8x8.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_byte.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_cad.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_capture.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_a2printer.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_gu800.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_hd44102.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_il3820_296x128.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ist3020.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ist3088.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ist7920.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ks0108.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_lc7981.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ld7032_60x32.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ls013b7dh03.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_max7219.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_pcd8544_84x48.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_pcf8812.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_pcf8814_hx1230.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_s1d15721.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_s1d15e06.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sbn1661.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sed1330.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sh1106_64x32.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sh1106_72x40.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sh1107.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sh1108.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sh1122.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1305.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_128x32.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_128x64_noname.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_2040x16.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_48x64.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_64x32.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_64x48.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_72x40.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_96x16.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_96x40.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1309.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1316.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1317.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1318.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1320.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1322.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1325.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1326.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1327.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1329.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1606_172x72.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1607_200x200.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7511.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st75160.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st75256.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7528.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st75320.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7565.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7567.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7571.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7586s_erc240160.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7586s_s028hn118a.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7586s_ymc240160.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7588.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7920.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_t6963.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1601.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1604.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1608.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1609.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1610.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1611.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1617.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1638.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1701_dogs102.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1701_mini12864.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_debounce.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_display.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_fonts.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_gpio.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_input_value.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_message.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_selection_list.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_setup.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_string.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_u16toa.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_u8toa.c.o
Compiling .pio\build\ttgo_lora32_v21\libf23\EasyLed\EasyLed.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\aes\ideetron\AES-128_V10.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\aes\lmic.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\aes\other.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4420.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4551.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4610.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4611.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4612.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4617.cpp.o
Archiving .pio\build\ttgo_lora32_v21\libb27\libU8g2.a
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4618.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4630.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4801.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4802.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_disco_l072cs_lrwan1.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_feather32u4lora.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_featherm0lora.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_heltec_lora32.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_thisboard.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_ttgo_lora32_v1.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_ttgo_lora32_v2.1.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\hal.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_as923.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_au915.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_channelshuffle.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_compliance.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_eu868.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_eu_like.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_in866.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_kr920.c.o
Archiving .pio\build\ttgo_lora32_v21\libf23\libEasyLed.a
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_us915.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_us_like.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_util.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\oslmic.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\radio.c.o
Archiving .pio\build\ttgo_lora32_v21\libFrameworkArduinoVariant.a
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\Esp.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\FirmwareMSC.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\FunctionalInterrupt.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\HWCDC.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\IPv6Address.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\MD5Builder.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\Print.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\Stream.cpp.o
Archiving .pio\build\ttgo_lora32_v21\libc4e\libMCCI LoRaWAN LMIC library.a
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\StreamString.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\USB.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\USBCDC.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\USBMSC.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\WString.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\base64.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\cbuf.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-adc.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-bt.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-cpu.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-dac.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-gpio.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-i2c-slave.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-i2c.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-ledc.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-matrix.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-misc.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-psram.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-rmt.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-sigmadelta.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-spi.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-time.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-timer.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-tinyusb.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-touch.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-uart.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\firmware_msc_fat.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\libb64\cdecode.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\libb64\cencode.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\main.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\stdlib_noniso.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\ttgo_lora32_v21\libFrameworkArduino.a
Linking .pio\build\ttgo_lora32_v21\firmware.elf
Retrieving maximum program size .pio\build\ttgo_lora32_v21\firmware.elf
Checking size .pio\build\ttgo_lora32_v21\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   5.7% (used 18660 bytes from 327680 bytes)
Flash: [==        ]  21.6% (used 283113 bytes from 1310720 bytes)
Building .pio\build\ttgo_lora32_v21\firmware.bin
esptool.py v3.3
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.

Upload

Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM16
Uploading .pio\build\ttgo_lora32_v21\firmware.bin
esptool.py v3.3
Serial port COM16
Connecting.....
Chip is ESP32-PICO-D4 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 50:02:91:9d:da:ac
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00055fff...
Compressed 17088 bytes to 11814...
Writing at 0x00001000... (100 %)
Wrote 17088 bytes (11814 compressed) at 0x00001000 in 0.4 seconds (effective 312.7 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 128...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.1 seconds (effective 378.1 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 580.0 kbit/s)...
Hash of data verified.
Compressed 283504 bytes to 162243...
Writing at 0x00010000... (10 %)
Writing at 0x0001999e... (20 %)
Writing at 0x000234bf... (30 %)
Writing at 0x00028733... (40 %)
Writing at 0x0002dbd3... (50 %)
Writing at 0x000332aa... (60 %)
Writing at 0x000394d0... (70 %)
Writing at 0x000439d0... (80 %)
Writing at 0x0004ad70... (90 %)
Writing at 0x000501ac... (100 %)
Wrote 283504 bytes (162243 compressed) at 0x00010000 in 2.7 seconds (effective 844.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
====================================================================================== [SUCCESS] Took 10.43 seconds ======================================================================================

Running (looping)


--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Miniterm on COM16  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4
ets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4
ets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4
ets Jun  8 2016 00:22:57

I can conclude the bootloop situation persists.

@lnlp
Copy link
Owner

lnlp commented Jul 2, 2022

@damanti-me

If you tell me other ways to verify im would be glad to help.

Thanks. To start, providing logging as shown above for each of the tested configurations will be useful.

When exactly does the bootloop occur? Based on @hekopath's log above the upload appears to succeed after which the device is automatically reset and then right at the first run the boot loop starts. Is that correct?

@lnlp
Copy link
Owner

lnlp commented Jul 2, 2022

The base of this test is still the main banch from 26th May

Do you mean LMIC-node's latest commit from 2022-04-30?

@lnlp
Copy link
Owner

lnlp commented Jul 2, 2022

Regarding:

Platform Manager: Updating espressif32 @ 4.3.0
Platform Manager: Removing espressif32 @ 4.3.0
Platform Manager: [email protected] has been removed!      
Platform Manager: Installing platformio/espressif32 @ 5.0.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Platform Manager: [email protected] has been installed!

The base of this test is still the main banch from 26th May.
Only modified the lorawan-keys.h
And now with removed @4.2.0 Tag

The following is remarkable:

> Processing ttgo_lora32_v21 (platform: [email protected]; board: ttgo-lora32-v21; framework: arduino)
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
> CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/ttgo-lora32-v21.html
> PLATFORM: Espressif 32 (4.2.0) > TTGO LoRa32-OLED v2.1.6
> HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
> DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
> PACKAGES:
>  - framework-arduinoespressif32 @ 3.20002.0 (2.0.2)
>  - tool-esptoolpy @ 1.30300.0 (3.3.0)
>  - tool-mkfatfs @ 2.0.1
>  - tool-mklittlefs @ 1.203.210628 (2.3)
>  - tool-mkspiffs @ 2.230.0 (2.30)
>  - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3

Above build log shows [email protected] and PLATFORM: Espressif 32 (4.2.0) instead of PLATFORM: Espressif 32 (5.0.0).
So either the build log you showed is incorrect (from a different build session) or the @4.2.0 part was not removed everywhere in platformio.ini. If latter then the code should run and not boot loop which your run logs currently shows.



How come your build log shows PLATFORM: Espressif 32 (4.2.0) instead of PLATFORM: Espressif 32 (5.0.0)?
Is the log incorrect or is there something wrong with your PlatformIO configuration?

@lnlp
Copy link
Owner

lnlp commented Jul 2, 2022

Which operating system and version are you using?

@TD-er
Copy link

TD-er commented Jul 2, 2022

Also keep an eye on the used esptool and elf2bin versions.

The newer version (4.x) does call elf2bin with parameters to append an SHA checksum of the binary.
But if it was already "signed" with such a checksum, it will not patch the binary when flashing to set the correct flash size and flash clock frequency.
Simply because changing these bits will corrupt the checksum.

The 4.x version of esptool does check for this, but if the bin was made including the SHA and esptool doesn't check for it, it may corrupt the bin while flashing.
On the other hand, if the wrong flash parameters were set in the board definition or PIO env, then esptool cannot correct for it when flashing.

@lnlp
Copy link
Owner

lnlp commented Jul 2, 2022

Thanks.

So to my understanding: After updating the ESP32 platform version in PlatformIO it will be best to delete the .pio/build folder to remove the binary to prevent any possible issue with what you desribed?

@TD-er
Copy link

TD-er commented Jul 2, 2022

And also make sure esptool is not mentioned with a specific (different) version in the requirements.txt for the Python virtual env.

@lnlp
Copy link
Owner

lnlp commented Jul 2, 2022

<deleted>

@hekopath
Copy link
Author

hekopath commented Jul 2, 2022

@damanti-me

If you tell me other ways to verify im would be glad to help.

Thanks. To start, providing logging as shown above for each of the tested configurations will be useful.

When exactly does the bootloop occur? Based on @hekopath's log above the upload appears to succeed after which the device is automatically reset and then right at the first run the boot loop starts. Is that correct?

Yes!

@hekopath
Copy link
Author

hekopath commented Jul 2, 2022

The base of this test is still the main banch from 26th May

Do you mean LMIC-node's latest commit from 2022-04-30?

Yes!

@hekopath
Copy link
Author

hekopath commented Jul 2, 2022

Which operating system and version are you using?

W10 Pro 21H2

@hekopath
Copy link
Author

hekopath commented Jul 2, 2022

I tried another build.
With my last build documentation i only used the project task Default->General->"Clean All All"

This time i further cleaned up by deleting .pio and .vscode folder.

Used platformio.ini is the following:

;-------------------------------------------------------------------------------`
;
;  File:         platformio.ini
; 
;  Function:     Project configuration file for LMIC-node.
;
;  Copyright:    Copyright (c) 2021 Leonel Lopes Parente
; 
;  License:      MIT License. See accompanying LICENSE file.
;
;  Author:       Leonel Lopes Parente
;
;  Description:  This is the main configuration file. It contains:
;                - Board selector to select your board type
;                - Common settings used for all boards
;                - Board specific settings that can be altered per board.
;                
;                For a description of all settings see README.md
;
;-------------------------------------------------------------------------------


; ------------------------------------------------------------------------------
; |  Board Selector                                                            |
; |                                                                            |
; |  Select your board by uncommenting EXACTLY ONE board-id below.             |
; ------------------------------------------------------------------------------

[platformio]
default_envs = 
    ;<platformio.ini board selector guard> Comment this line and uncomment one board-id below:

    ; LoRa development boards with integrated LoRa support:

    ; Board-id                            Board name
    ;---------                            ----------
    ; adafruit_feather_m0_lora          ; Adafruit Feather M0 LoRa
    ; disco_l072cz_lrwan1               ; Discovery B-L072Z-LRWAN1
    ; heltec_wifi_lora_32_v2            ; Heltec Wifi LoRa 32 V2
    ; heltec_wifi_lora_32               ; Heltec Wifi LoRa 32
    ; heltec_wireless_stick_lite        ; Heltec Wireless Stick Lite
    ; heltec_wireless_stick             ; Heltec Wireless Stick
    ; lopy4                             ; Pycom Lopy4
    ; lora32u4II                        ; BSFrance LoRa32u4 II v1.0, v1.1, v1.2, v1.3
    ; ttgo_lora32_v1                    ; TTGO LoRa32 v1.3
    ; ttgo_lora32_v2                    ; TTGO LoRa32 v2.0
     ttgo_lora32_v21                   ; TTGO LoRa32 v2.1.6
    ; ttgo_t_beam                       ; TTGO T-Beam v0.5, v0.6, v0.7
    ; ttgo_t_beam_v1                    ; TTGO T-Beam v1.0, v1.1

    ; Development boards that require an external SPI LoRa module:

    ; Board-id                            Board name
    ;---------                            ----------
    ; adafruit_qt_py_m0                 ; Adafruit QT Py    
    ; blackpill_f103c8_128k             ; Black Pill 128k
    ; blackpill_f103c8                  ; Black Pill  64k
    ; bluepill_f103c8_128k              ; Blue Pill 128k
    ; bluepill_f103c8                   ; Blue Pill  64k
    ; lolin_d32_pro                     ; Lolin D32 Pro
    ; lolin_d32                         ; Lolin D32
    ; lolin32                           ; Lolin32
    ; nodemcu_32s                       ; NodeMCU-32S
    ; nodemcuv2                         ; NodeMCU V2
    ; pico                              ; Raspberry Pi Pico
    ; pro8mhzatmega328                  ; Arduino Pro Mini 3.3V 8Mhz
    ; samd21_m0_mini                    ; SAMD21 M0-Mini
    ; teensylc                          ; Teensy LC


; ------------------------------------------------------------------------------
; |  Common Settings                                                           |
; |                                                                            |
; |  These settings are shared by all board configurations except for          |
; |  nodemcuv2 which uses its own monitor_speed setting.                       |
; ------------------------------------------------------------------------------

[common]

monitor_speed = 115200                 ; No need to change this.

build_flags =
    -D DO_WORK_INTERVAL_SECONDS=60

    ; -D ABP_ACTIVATION                ; Use ABP instead of OTAA activation.
    ;
    ; -D WAITFOR_SERIAL_SECONDS=10     ; Can be used to override the default value (10).
    ;                                    Is used only for boards with default set to != 0 in BSF.
    ;
    ; -D LMIC_CLOCK_ERROR_PPM=0        ; If not defined defines, otherwise overrides value defined in BSF.
    ;                                    Is for testing purposes only.
    ;                                    Do not enable this unless you explicitly know what you are doing.
    ;
    ; -D STM32_POST_INITSERIAL_DELAY_MS=1500  ; Workaround for STM32 boards. Can be used 
    ;                                           to override value (milliseconds) in BSF.

lib_deps =
    olikraus/U8g2                      ; OLED display library
    lnlp/EasyLed                       ; LED library
;   ███ Add additional libraries for User Code below this line ███


; -------------------------------
; |  Shortcuts and Workarounds  |
; -------------------------------

[esp32]
build_flags =
    -D hal_init=LMICHAL_init           ; Workaround for naming conflict of function hal_init
                                       ; introduced by newer versions (> 3.5.0) of 
                                       ; PlatformIO Espressif 32 platform (ESP32 Arduino core).
                                       ; See https://github.com/lnlp/LMIC-node/issues/41 for more information.

[pico]
upload_port = E:                       ; Shortcut for Raspberry Pi Pico. 
                                       ; Operating system and hardware dependent.
                                       ; Placed here so it can be easily changed.
                                       ; See section [env:pico] below for more information.


; --------------------------------------------------
; |  MCCI LoRaWAN LMIC library specific settings   |
; --------------------------------------------------

[mcci_lmic]
; LMIC-node was tested with MCCI LoRaWAN LMIC library v3.3.0 and v4.0.0.
; Some changes have been announced for future versions of the MCCI library
; which may be incompatible with LMIC-node. In case of problems just
; use mcci-catena/MCCI LoRaWAN LMIC [email protected] below which will
; explicitly use v4.0.0 of the library.
; Perform 'PlatformIO: Clean' after changing library version and
; in case of issues remove the old version from .pio/libdeps/*.

; Note: LMIC_PRINTF_TO is defined for each board separately
;       in the board specific sections. Don't define it in this section.

lib_deps =
    ; Only ONE of below LMIC libraries should be enabled.
    mcci-catena/MCCI LoRaWAN LMIC library           ; MCCI LMIC library (latest release)
    ; mcci-catena/MCCI LoRaWAN LMIC [email protected]   ; MCCI LMIC library v4.0.0

build_flags =
    ; Use platformio.ini for settings instead lmic_project_config.h.
    -D ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS

    ; Ping and beacons not supported for class A, disable to save memory.
    -D DISABLE_PING
    -D DISABLE_BEACONS

    ; -D LMIC_DEBUG_LEVEL=1            ; 0, 1 or 2
    
    ; -D CFG_sx1272_radio=1            ; Use for SX1272 radio
    -D CFG_sx1276_radio=1              ; Use for SX1276 radio
    -D USE_ORIGINAL_AES                ; Faster but larger, see docs
    ; -D LMIC_USE_INTERRUPTS           ; Not tested or supported on many platforms
    ; -D LMIC_ENABLE_DeviceTimeReq=1   ; Network time support

    ; --- Regional settings -----
    ; Enable only one of the following regions:    
    ; -D CFG_as923=1
    ; -D CFG_as923jp=1   
    ; -D CFG_au915=1
    ; -D CFG_cn490=1                   ; Not yet supported
    ; -D CFG_cn783=1                   ; Not yet supported
    ; -D CFG_eu433=1                   ; Not yet supported
    -D CFG_eu868=1
    ; -D CFG_in866=1
    ; -D CFG_kr920=1
    ; -D CFG_us915=1


; --------------------------------------------------
; |  IBM LMIC framework library specific settings  |
; --------------------------------------------------

[classic_lmic]    
; IMPORTANT:
; This library was recently DEPRECATED and is no longer maintained.
; It is not fully LoRaWAN compliant (e.g. in handling of MAC commands)
; and is therefore less suitable for use with The Things Network V3.
;
; Region, radio and debug settings CANNOT be changed in platformio.ini.
; They must be configured in file: config.h in the following location:
; .pio/libdeps/<board-id>/IBM LMIC framework/src/lmic
;
; When making changes to config.h: 
; CONFIG.H MUST BE CHANGED FOR EACH BOARD SEPARATELY!
; (By default libraries are installed per project per build config/board.)

lib_deps =
    matthijskooijman/IBM LMIC framework   ; [Deprecated] Classic LMIC library

build_flags =
    ; DEFAULT VALUES defined in config.h:
    ; CFG_sx1276_radio 1
    ; CFG_eu868 1
    ; LMIC_DEBUG_LEVEL 0 

    ; Ping and beacons not supported for class A, disable to save memory.
    -D DISABLE_PING
    -D DISABLE_BEACONS


; ------------------------------------------------------------------------------
; |  LoRa development boards with integrated LoRa support                      |
; |                                                                            |
; |  Some but not all of these boards have an onboard display.                 |
; |  Some boards require additional wiring that needs to be manually added.    |
; |  Check the Board Support Files in the boards folder for information.       |
; ------------------------------------------------------------------------------

[env:adafruit_feather_m0_lora]
; Adafruit Feather M0 with RF9x LoRa (SAMD21).
; No display.
; Requires manual wiring of DIO1 to GPIO6.
platform = atmelsam
board = adafruit_feather_m0
framework = arduino
monitor_speed = ${common.monitor_speed}      
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_adafruit_feather_m0_lora.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D _GNU_SOURCE    
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:disco_l072cz_lrwan1]
; ST B-L072Z-LRWAN1 Discovery kit (STM32L072CZ).
; No display.
platform = ststm32
board = disco_l072cz_lrwan1
framework = arduino
upload_protocol = stlink         ; If this fails then try mbed
; upload_protocol = jlink        ; Requires onboard programmer firmware upgrade 
; upload_protocol = mbed         ; If selected, also set the correct upload_port
; upload_port = E:               ; Used for mbed, value is hardware and OS dependent
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_disco_l072cz_lrwan1.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D _GNU_SOURCE    
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:heltec_wifi_lora_32_v2]
; Heltec WiFi LoRa 32 V2 (ESP32).
; Onboard OLED display SSD1306 0.96" 128x64.
platform = espressif32
board = heltec_wifi_lora_32_V2
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_heltec_wifi_lora_32_v2.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    -D USE_DISPLAY


[env:heltec_wifi_lora_32]
; Heltec WiFi LoRa 32 version 1.3 (ESP32).
; Onboard OLED display SSD1306 0.96" 128x64.
platform = espressif32
board = heltec_wifi_lora_32
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_heltec_wifi_lora_32.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    -D USE_DISPLAY


[env:heltec_wireless_stick_lite]
; Heltec Wireless Stick Lite (ESP32).
; No display.
platform = espressif32
board = heltec_wireless_stick_lite
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_heltec_wireless_stick_lite.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:heltec_wireless_stick]
; Heltec Wireless Stick (ESP32).
; Onboard OLED display SSD1306 0.49" 64x32.
; Display is not supported by LMIC-node because its resolution is too low.
platform = espressif32
board = heltec_wireless_stick
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_heltec_wireless_stick.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; NOT SUPPORTED


[env:lopy4]
; Pycom LoPy4 (ESP32).
; Onboard WS2812 RGB LED is currently not supported by LMIC-node.
; No display.
; Requires a Pycom Expansion Board or USB to Serial adapter.
; See Board Support File for details.
platform = espressif32
board = lopy4
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_lopy4.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    ; -D USE_LED                 ; CURRENTLY NOT SUPPORTED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:lora32u4II]
; BSFrance LoRa32u4 II V1.0, V1.1, V1.2, V1.3 (ATmega32u4).
; No display.
; Board versions V1.0 to V1.2 require manual wiring of DIO1 to GPIO5.
; 8-bit AVR MCU with limited memory, therefore Classic LMIC is used.
; See limitations described in the [classic_lmic] section.
platform = atmelavr
board = lora32u4II
framework = arduino
monitor_speed = ${common.monitor_speed}  
lib_deps =
    ${common.lib_deps}  
    ${classic_lmic.lib_deps}     ; [Deprecated] IBM LMIC Framework
build_flags =
    ${common.build_flags}
    ${classic_lmic.build_flags}  ; [Deprecated] IBM LMIC Framework
    -D BSFILE=\"boards/bsf_lora32u4II.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:ttgo_lora32_v1]
; TTGO LoRa32 v1.3 (ESP32)
; No onboard user LED.
; Onboard OLED display SSD1306 0.96" 128x64.
platform = espressif32
board = ttgo-lora32-v1
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_ttgo_lora32_v1.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    ; -D USE_LED                 ; NO ONBOARD USER LED
    -D USE_DISPLAY


[env:ttgo_lora32_v2]
; TTGO LoRa32 v2.0 (ESP32).
; Onboard OLED display SSD1306 0.96" 128x64.
; Requires manual wiring of DIO1 to GPIO33.
; GPIO22 is used for both onboard LED and I2C SCL
; therefore USE_LED and USE_DISPLAY cannot be used together.
platform = espressif32
board = ttgo-lora32-v2
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_ttgo_lora32_v2.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    ; -D USE_LED                 ; Cannot be used together with USE_DISPLAY
    -D USE_DISPLAY               ; Cannot be used together with USE_LED


[env:ttgo_lora32_v21]
; TTGO LoRa32 v2.1.6 (ESP32).
; Onboard OLED display SSD1306 0.96" 128x64.
platform = espressif32
board = ttgo-lora32-v21
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_ttgo_lora32_v21.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    -D USE_DISPLAY    


[env:ttgo_t_beam]
; TTGO T-Beam (aka T22) V0.5, V0.6, V0.7 (ESP32).
; No display.
platform = espressif32
board = ttgo-t-beam
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_ttgo_t_beam.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:ttgo_t_beam_v1]
; TTGO T-Beam (aka T22) V1.0, V1.1 (ESP32).
; No onboard user LED. No display.
; Requires additional library and setup for AXP192 power management chip.
platform = espressif32
board = ttgo-t-beam
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps} 
    lewisxhe/AXP202X_Library     ; Power management chip library
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_ttgo_t_beam_v1.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    ; -D USE_LED                 ; NO ONBOARD USER LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display   


; ------------------------------------------------------------------------------
; |  Development boards that require an external SPI LoRa module               |
; |                                                                            |
; |  None of these boards have an onboard display.                             |
; |  Check the Board Support Files in the boards folder for required wiring!!  |
; ------------------------------------------------------------------------------


[env:adafruit_qt_py_m0]
; Adafruit QT Py (SAMD21).
; Onboard Neopixel RGB LED is currently not supported by LMIC-node.
; No display.
platform = atmelsam
board = adafruit_qt_py_m0
framework = arduino
monitor_speed = ${common.monitor_speed}      
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_adafruit_qt_py_m0.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D _GNU_SOURCE    
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    ; -D USE_LED                 ; CURRENTLY NOT SUPPORTED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:blackpill_f103c8_128k]
; Blackill F103C8 128k (STMF103C8T6).
; No display.
; Select preferred upload protocol below.
platform = ststm32
board = blackpill_f103c8_128
framework = arduino
; upload_protocol = serial
upload_protocol = stlink
; upload_protocol = jlink
monitor_speed = ${common.monitor_speed}    
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_blackpill_f103c8.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D _GNU_SOURCE    
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display      


[env:blackpill_f103c8]
; Blackpill F103C8 (64k) (STMF103C8T6).
; No display.
; Select preferred upload protocol below.
platform = ststm32
board = blackpill_f103c8
framework = arduino
; upload_protocol = serial
upload_protocol = stlink
; upload_protocol = jlink
monitor_speed = ${common.monitor_speed}    
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_blackpill_f103c8.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D _GNU_SOURCE    
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:bluepill_f103c8_128k]
; Bluepill F103C8 128k (STMF103C8T6).
; No display.
; Select preferred upload protocol below.
platform = ststm32
board = bluepill_f103c8_128k
framework = arduino
; upload_protocol = serial
upload_protocol = stlink
; upload_protocol = jlink
monitor_speed = ${common.monitor_speed}    
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_bluepill_f103c8.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D _GNU_SOURCE    
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display    


[env:bluepill_f103c8]
; Bluepill F103C8 (64k) (STMF103C8T6).
; No display.
; Select preferred upload protocol below.
platform = ststm32
board = bluepill_f103c8
framework = arduino
; upload_protocol = serial
upload_protocol = stlink
; upload_protocol = jlink
monitor_speed = ${common.monitor_speed}    
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_bluepill_f103c8.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D _GNU_SOURCE    
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:lolin_d32_pro]
; Wemos Lolin D32 Pro (ESP32).
; No display.
platform = espressif32
board = lolin_d32_pro
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_lolin_d32_pro.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:lolin_d32]
; Wemos Lolin D32 (ESP32).
; No display.
platform = espressif32
board = lolin_d32
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_lolin_d32.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:lolin32]
; Wemos Lolin32 (ESP32).
; No display.
platform = espressif32
board = lolin32
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_lolin32.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:nodemcu_32s]
; NodeMCU-32S (ESP32).
; No display.
platform = espressif32
board = nodemcu-32s
framework = arduino
upload_speed = 921600
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${esp32.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_nodemcu_32s.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:nodemcuv2]
; NodeMCU V2 (aka NodeMCU 1.0) (ESP8266).
; No display.
; Monitor speed is set to 74880 to be able to read ESP8266 boot messages.
; I2C and external OLED display cannot be used due to shortage of GPIO pins.
platform = espressif8266
board = nodemcuv2
framework = arduino
upload_speed = 921600
monitor_speed = 74880            ; 74880 so we can read ESP8266 boot messages
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_nodemcuv2.h\"
    -D MONITOR_SPEED=${env:nodemcuv2.monitor_speed}
    -D _GNU_SOURCE
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; NOT SUPPORTED


[env:pico]
; Raspberry Pi Pico (RP2040).
; No display.
;
; IMPORTANT information for firmware upload:
; ------------------------------------------
; Device must be in BOOTSEL mode to upload firmware.
; (To put in BOOTSEL mode: press BOOTSEL button, power on or reset board, release BOOTSEL button.)
; For Windows specify: upload_protocol = picotool (appears not needed for Mac and Linux).
; upload_port is operating system and hardware dependent. 
; For convenience, to set upload_port: set upload_port in [pico] section (on top).
; Examples:
;   Windows: upload_port = E:
;   Mac:     upload_port = /Volumes/RPI-RP2
;   Linux:   upload_port = /media/<user>/RSPI-RP2
; On Windows USB driver for Pico [RP2 Boot (interface 1)] needs be installed with Zadig,
; see: https://community.platformio.org/t/official-platformio-arduino-ide-support-for-the-raspberry-pi-pico-is-now-available/20792
;
platform = raspberrypi
framework = arduino
board = pico
upload_protocol = picotool
upload_port = ${pico.upload_port}      ; Operating system and hardware dependent
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_pico.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D _GNU_SOURCE
    -D LMIC_PRINTF_TO=SerialUSB
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:pro8mhzatmega328]
; Arduino Pro Mini 8 MHz (ATmega328).
; Onboard LED not usable because GPIO13 is used for both onboard LED and SPI SCK.
; No display.
; 8-bit AVR MCU with limited memory, therefore Classic LMIC is used.
; See limitations described in the [classic_lmic] section.
platform = atmelavr
board = pro8MHzatmega328
framework = arduino
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}  
    ${classic_lmic.lib_deps}     ; [Deprecated] IBM LMIC Framework
build_flags =
    ${common.build_flags}
    ${classic_lmic.build_flags}  ; [Deprecated] IBM LMIC Framework
    -D BSFILE=\"boards/bsf_pro8mhzatmega328.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D USE_SERIAL
    ; -D USE_LED                 ; NOT SUPPORTED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


[env:samd21_m0_mini]
; SAMD21 M0-Mini (SAMD21).
; No display.
platform = atmelsam
board = zeroUSB
framework = arduino
monitor_speed = ${common.monitor_speed}      
lib_deps =
    ${common.lib_deps}    
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags} 
    -D BSFILE=\"boards/bsf_samd21_m0_mini.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D _GNU_SOURCE    
    -D LMIC_PRINTF_TO=SerialUSB    
    -D USE_SERIAL
    ; -D USE_LED                 ; NOT SUPPORTED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display

 
[env:teensylc]
; Teensy LC (NXP MKL26Z64VFT4).
; No display.
platform = teensy
board = teensylc
framework = arduino
monitor_speed = ${common.monitor_speed}
lib_deps =
    ${common.lib_deps}
    ${mcci_lmic.lib_deps}
build_flags =
    ${common.build_flags}
    ${mcci_lmic.build_flags}
    -D BSFILE=\"boards/bsf_teensylc.h\"
    -D MONITOR_SPEED=${common.monitor_speed}
    -D _GNU_SOURCE    
    -D LMIC_PRINTF_TO=Serial    
    -D USE_SERIAL
    -D USE_LED
    ; -D USE_DISPLAY             ; Requires external I2C OLED display


; end of file   

Build

> Executing task: C:\Users\username\.platformio\penv\Scripts\platformio.exe run --target upload --target monitor <

Processing ttgo_lora32_v21 (platform: espressif32; board: ttgo-lora32-v21; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/ttgo-lora32-v21.html
PLATFORM: Espressif 32 (5.0.0) > TTGO LoRa32-OLED v2.1.6
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20003.220626 (2.0.3)
 - tool-esptoolpy @ 1.30300.0 (3.3.0)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 36 compatible libraries
Scanning dependencies...
Dependency Graph
|-- U8g2 @ 2.33.8
|   |-- SPI @ 2.0.0
|   |-- Wire @ 2.0.0
|-- EasyLed @ 1.1.0
|-- MCCI LoRaWAN LMIC library @ 4.1.1
|   |-- SPI @ 2.0.0
|-- Wire @ 2.0.0
|-- SPI @ 2.0.0
Building in release mode
Compiling .pio\build\ttgo_lora32_v21\src\LMIC-node.cpp.o
Generating partitions .pio\build\ttgo_lora32_v21\partitions.bin
Compiling .pio\build\ttgo_lora32_v21\lib108\SPI\SPI.cpp.o
Compiling .pio\build\ttgo_lora32_v21\lib9b6\Wire\Wire.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\U8g2lib.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\U8x8lib.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\mui.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\mui_u8g2.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_bitmap.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_box.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_buffer.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_button.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_circle.c.o
Archiving .pio\build\ttgo_lora32_v21\lib108\libSPI.a
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_cleardisplay.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_d_memory.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_d_setup.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_font.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_fonts.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_hvline.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_input_value.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_intersection.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_kerning.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_line.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_ll_hvline.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_message.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_polygon.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_selection_list.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8g2_setup.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8log.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8log_u8g2.c.o
Archiving .pio\build\ttgo_lora32_v21\lib9b6\libWire.a
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8log_u8x8.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_8x8.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_byte.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_cad.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_capture.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_a2printer.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_gu800.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_hd44102.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_il3820_296x128.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ist3020.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ist3088.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ist7920.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ks0108.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_lc7981.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ld7032_60x32.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ls013b7dh03.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_max7219.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_pcd8544_84x48.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_pcf8812.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_pcf8814_hx1230.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_s1d15721.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_s1d15e06.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sbn1661.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sed1330.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sh1106_64x32.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sh1106_72x40.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sh1107.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sh1108.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_sh1122.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1305.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_128x32.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_128x64_noname.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_2040x16.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_48x64.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_64x32.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_64x48.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_72x40.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_96x16.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1306_96x40.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1309.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1316.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1317.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1318.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1320.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1322.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1325.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1326.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1327.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1329.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1606_172x72.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_ssd1607_200x200.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7511.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st75160.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st75256.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7528.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st75320.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7565.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7567.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7571.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7586s_erc240160.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7586s_s028hn118a.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7586s_ymc240160.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7588.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_st7920.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_t6963.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1601.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1604.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1608.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1609.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1610.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1611.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1617.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1638.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1701_dogs102.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_d_uc1701_mini12864.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_debounce.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_display.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_fonts.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_gpio.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_input_value.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_message.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_selection_list.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_setup.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_string.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_u16toa.c.o
Compiling .pio\build\ttgo_lora32_v21\libb27\U8g2\clib\u8x8_u8toa.c.o
Compiling .pio\build\ttgo_lora32_v21\libf23\EasyLed\EasyLed.cpp.o
Archiving .pio\build\ttgo_lora32_v21\libb27\libU8g2.a
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\aes\ideetron\AES-128_V10.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\aes\lmic.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\aes\other.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4420.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4551.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4610.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4611.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4612.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4617.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4618.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4630.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4801.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_catena4802.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_disco_l072cs_lrwan1.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_feather32u4lora.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_featherm0lora.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_heltec_lora32.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_thisboard.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_ttgo_lora32_v1.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\getpinmap_ttgo_lora32_v2.1.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\hal\hal.cpp.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_as923.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_au915.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_channelshuffle.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_compliance.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_eu868.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_eu_like.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_in866.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_kr920.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_us915.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_us_like.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\lmic_util.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\oslmic.c.o
Compiling .pio\build\ttgo_lora32_v21\libc4e\MCCI LoRaWAN LMIC library\lmic\radio.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\Esp.cpp.o
Archiving .pio\build\ttgo_lora32_v21\libf23\libEasyLed.a
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\FirmwareMSC.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\FunctionalInterrupt.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\HWCDC.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\IPv6Address.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\MD5Builder.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\Print.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\StreamString.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\USB.cpp.o
Archiving .pio\build\ttgo_lora32_v21\libc4e\libMCCI LoRaWAN LMIC library.a
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\USBCDC.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\USBMSC.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\WString.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\base64.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\cbuf.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-adc.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-bt.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-cpu.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-dac.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-gpio.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-i2c-slave.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-i2c.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-ledc.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-matrix.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-misc.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-psram.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-rmt.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-sigmadelta.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-spi.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-time.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-timer.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-tinyusb.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-touch.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\esp32-hal-uart.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\firmware_msc_fat.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\libb64\cdecode.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\libb64\cencode.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\main.cpp.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\stdlib_noniso.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\ttgo_lora32_v21\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\ttgo_lora32_v21\libFrameworkArduino.a
Linking .pio\build\ttgo_lora32_v21\firmware.elf
Retrieving maximum program size .pio\build\ttgo_lora32_v21\firmware.elf
Checking size .pio\build\ttgo_lora32_v21\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   5.7% (used 18580 bytes from 327680 bytes)
Flash: [==        ]  21.7% (used 284685 bytes from 1310720 bytes)
Building .pio\build\ttgo_lora32_v21\firmware.bin
esptool.py v3.3
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.

Upload

Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM16
Uploading .pio\build\ttgo_lora32_v21\firmware.bin
esptool.py v3.3
Serial port COM16
Connecting.....
Chip is ESP32-PICO-D4 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 50:02:91:9d:da:ac
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00055fff...
Compressed 17088 bytes to 11848...
Writing at 0x00001000... (100 %)
Wrote 17088 bytes (11848 compressed) at 0x00001000 in 0.4 seconds (effective 311.4 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 128...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.1 seconds (effective 378.1 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 574.9 kbit/s)...
Hash of data verified.
Compressed 285072 bytes to 163132...
Writing at 0x00010000... (10 %)
Writing at 0x000198dc... (20 %)
Writing at 0x000233e5... (30 %)
Writing at 0x0002872f... (40 %)
Writing at 0x0002d9ec... (50 %)
Writing at 0x00032f23... (60 %)
Writing at 0x00038c1a... (70 %)
Writing at 0x00042da8... (80 %)
Writing at 0x0004ae9c... (90 %)
Writing at 0x000502fc... (100 %)
Wrote 285072 bytes (163132 compressed) at 0x00010000 in 2.7 seconds (effective 835.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
====================================================================================== [SUCCESS] Took 34.67 seconds ======================================================================================

Running (looping)

--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Miniterm on COM16  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4
ets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4
ets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4
ets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4
ets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4

--- exit ---

@hekopath
Copy link
Author

hekopath commented Jul 2, 2022

As an addition:
Adding the "@4.2.0" Tag immidiatly result in a successful running build even without cleanups.

Build, Upload and Running

> Executing task: C:\Users\hendrik\.platformio\penv\Scripts\platformio.exe run --target upload --target monitor <

Processing ttgo_lora32_v21 (platform: [email protected]; board: ttgo-lora32-v21; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/ttgo-lora32-v21.html
PLATFORM: Espressif 32 (4.2.0) > TTGO LoRa32-OLED v2.1.6
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20002.0 (2.0.2)
 - tool-esptoolpy @ 1.30300.0 (3.3.0)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 35 compatible libraries
Scanning dependencies...
Dependency Graph
|-- U8g2 @ 2.33.8
|   |-- SPI @ 2.0.0
|   |-- Wire @ 2.0.0
|-- EasyLed @ 1.1.0
|-- MCCI LoRaWAN LMIC library @ 4.1.1
|   |-- SPI @ 2.0.0
|-- Wire @ 2.0.0
|-- SPI @ 2.0.0
Building in release mode
Retrieving maximum program size .pio\build\ttgo_lora32_v21\firmware.elf
Checking size .pio\build\ttgo_lora32_v21\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   5.7% (used 18660 bytes from 327680 bytes)
Flash: [==        ]  21.6% (used 283113 bytes from 1310720 bytes)
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM16
Uploading .pio\build\ttgo_lora32_v21\firmware.bin
esptool.py v3.3
Serial port COM16
Connecting.......
Chip is ESP32-PICO-D4 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 50:02:91:9d:da:ac
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00055fff...
Compressed 17088 bytes to 11814...
Writing at 0x00001000... (100 %)
Wrote 17088 bytes (11814 compressed) at 0x00001000 in 0.4 seconds (effective 313.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 128...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.1 seconds (effective 346.1 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 580.0 kbit/s)...
Hash of data verified.
Compressed 283504 bytes to 162243...
Writing at 0x00010000... (10 %)
Writing at 0x0001999e... (20 %)
Writing at 0x000234bf... (30 %)
Writing at 0x00028733... (40 %)
Writing at 0x0002dbd3... (50 %)
Writing at 0x000332aa... (60 %)
Writing at 0x000394d0... (70 %)
Writing at 0x000439d0... (80 %)
Writing at 0x0004ad70... (90 %)
Writing at 0x000501ac... (100 %)
Wrote 283504 bytes (162243 compressed) at 0x00010000 in 2.7 seconds (effective 842.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
====================================================================================== [SUCCESS] Took 11.24 seconds ======================================================================================
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Miniterm on COM16  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12776
load:0x40080400,len:3032
entry 0x400805e4


LMIC-node

Device-id:     ttgo-lora32-v21
LMIC library:  MCCI
Activation:    OTAA
Interval:      60 seconds

000000027816:  Event: EV_JOINING

000000029740:  doWork job started
000000183762:  Event: EV_TXSTART 

@lnlp
Copy link
Owner

lnlp commented Jul 3, 2022

Observations so far:

  • Issue is Espressif32 platform related. Version v4.3.0 and newer cause the issue. Versions up until v4.2.0 work fine.
  • Espressif32 platfrom v5.0.0 does not fix it and still causes the issue.
  • Issue appears specific to TTGO LoRa32 V2.1.6 (V2.1.x) boards.
    I was unable to reproduce the issue (on Windows) for TTGO LoRa32 V2.0 and TTGO T-Beam V0.5 boards.

Next steps to further investigate the bootloop issue could be to:

  • Do a file diff analysis between Espressif32 platform versions v4.2.0 and v4.3.0 and make a diff analysis between their respective framework-arduinoespressif32 package versions.
  • Check the MCCI LMIC GitHub repo and forum to see if the issue is familiar.
  • Contact PlatformIO on their forum or their GitHub repo.

I won't have time to dive further into this issue any soon. Also, not owning a TTGO LoRa32 V2.1.6 myself makes it difficult/impossible tot test and reproduce the issue.

@lnlp
Copy link
Owner

lnlp commented Jul 3, 2022

@hekopath, @damanti-me

Do you have any of the other supported ESP32 based LoRa boards that you could test with Espressif32 platform v4.3.0(+)?

Have you tried to upload standard Arduino sketches (e.g. blink) with PlatformIO to your board to see if the issue persists or not? That way you can check if the issue is more general or only occurs with LMIC(-node).

@TD-er
Copy link

TD-er commented Jul 3, 2022

Check the board definitions to see what's different.
Especially the flash settings.
You can also override those in the platform.ini file

@hekopath
Copy link
Author

hekopath commented Jul 3, 2022

@hekopath, @damanti-me

Do you have any of the other supported ESP32 based LoRa boards that you could test with Espressif32 platform v4.3.0(+)?

I have now tested it with a ttgo-lora32-v1 without any issues.

Have you tried to upload standard Arduino sketches (e.g. blink) with PlatformIO to your board to see if the issue persists or not? That way you can check if the issue is more general or only occurs with LMIC(-node).

Furthermore i tried to flash cyberman54/ESP32-Paxcounter with a similar list of supported boards and can confirm the same behavior as with LMIC-node .

ttgo-lora32-v1 build, upload and running without loop
ttgo-lora32-v21 (ttgo-lora32-v21new on paxcounter) results in a bootloop without the version tag @4.2.0

So i can confirm that it is not a LMIC-node specific problem.
Sorry for bothering you with this and many thanks for assisting to narrow the issue down a bit.

At least it is usefull to raise this issue and provide a workaround as @damanti-me did.

@lnlp
Copy link
Owner

lnlp commented Jul 3, 2022

So i can confirm that it is not a LMIC-node specific problem.

Good to have this clear now. 🙂

It will still be good to know if possibly LMIC library related or not.
So could you please also test with something simple like the standard Blink sketch?
If the issue also manifests with something simple like Blink then it will be easier to reproduce and hopefully can get fixed sooner by PlatformIO or Espressif.


Sorry for bothering you with this and many thanks for assisting to narrow the issue down a bit.
At least it is usefull to raise this issue and provide a workaround as @damanti-me did.

You're welcome. Others have ran (and will run) into this issue too, so it's good there is a workaround available.

I will leave this issue open for now so others can more easily find it.

@lnlp lnlp added the workaround Workaround needed label Jul 3, 2022
@lnlp lnlp changed the title Bootloop with latest platform-espressif32 (v4.30) Bootloop with TTGO LoRa32 V2.1.6 board with platform-espressif32 version v4.30 and higher Jul 3, 2022
@lnlp lnlp changed the title Bootloop with TTGO LoRa32 V2.1.6 board with platform-espressif32 version v4.30 and higher Bootloop with TTGO LoRa32 V2.1.6 board with platform-espressif32 v4.30 and higher Jul 3, 2022
@lnlp
Copy link
Owner

lnlp commented Jul 3, 2022

As already described by @hekopath a workaround for the bootloop issue for the TTGO LoRa32 V2.1.6 board can be implemented as follows:

This workaround causes Espressif32 platform v4.2.0 to be used for this board (only) instead of any of the newer versions that will cause the issue.

Workaround:

In file platformio.ini replace

[env:ttgo_lora32_v21]
; TTGO LoRa32 v2.1.6 (ESP32).
; Onboard OLED display SSD1306 0.96" 128x64.
platform = espressif32

with

[env:ttgo_lora32_v21]
; TTGO LoRa32 v2.1.6 (ESP32).
; Onboard OLED display SSD1306 0.96" 128x64.
platform = [email protected]

Once the issue gets fixed in a newer version of the Espressif32 platform, above workaround should be undone again.

@ezCheater
Copy link

ezCheater commented Sep 5, 2022

I had the same Issue with my TTGO LoRa32 V2.1.6 board. I was able to "fix" the bootloop by changing the value in pins_arduino.h from

#define OLED_RS 16

to

#define OLED_RS -1

I can't really explain why it works, but my colleague, who suggested the fix, said something along the lines of cheaper OLED Displays dont connect the reset Pin, which causes these kinds of Problems.

@TD-er
Copy link

TD-er commented Sep 5, 2022

GPIO-16 and -17 might also be connected to SPI flash or PSRAM.
Even when no PSRAM is present, the pin might be involved in probing for PSRAM and thus it might affect flash IO when you change its state.

@alexschultze
Copy link

I had the same issue on a cheap "LILYGO TTGO" branded board.
OLED_RST -1 solved the issue.

@egzumer
Copy link

egzumer commented Jul 19, 2023

This is related to what TD-er said. Merely calling pinMode(16,OUTPUT) causes the program to hang and triggers the watchdog. On this board oled reset pin is not connected and -1 instead of OLED_RST should be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workaround Workaround needed
Projects
None yet
Development

No branches or pull requests

7 participants