I am trying to program the ttgov2 board using platformIO on windows 10.
Compilation seems to be ok, but I have the impression that there is no upload (although there is no error message): the board keeps runnning the same code (that it was probably programmed with by the supplier)
I checked the device manager and the board shows up on COM7
When ik start debug (F5) I get the following:
> Executing task: C:\Users\bart.vanthielen\.platformio\penv\Scripts\platformio.exe debug <
Warning! `env_default` configuration option in section [platformio] is deprecated and will be removed in the next release! Please use `default_envs` instead
Warning! `monitor_baud` configuration option in section [env:heltec_wifi_lora_32] is deprecated and will be removed
in the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:ttgov1] is deprecated and will be removed in the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:ttgov2] is deprecated and will be removed in the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:lopy] is deprecated and will be removed in the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:lopy4] is deprecated and will be removed in the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:lolin32lite_lora] is deprecated and will be removed in
the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:lolin32_lora] is deprecated and will be removed in the
next release! Please use `monitor_speed` instead
Warning! `env_default` configuration option in section [platformio] is deprecated and will be removed in the next release! Please use `default_envs` instead
Warning! `monitor_baud` configuration option in section [env:heltec_wifi_lora_32] is deprecated and will be removed
in the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:ttgov1] is deprecated and will be removed in the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:ttgov2] is deprecated and will be removed in the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:lopy] is deprecated and will be removed in the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:lopy4] is deprecated and will be removed in the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:lolin32lite_lora] is deprecated and will be removed in
the next release! Please use `monitor_speed` instead
Warning! `monitor_baud` configuration option in section [env:lolin32_lora] is deprecated and will be removed in the
next release! Please use `monitor_speed` instead
Processing ttgov2 (platform: espressif32; framework: arduino; board: esp32dev)
--------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION:
PLATFORM: Espressif 32 (0.12.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 288KB RAM, 1.25MB Flash
PACKAGES:
- framework-arduinoespressif32 1.4.0
- tool-esptoolpy 1.20100.0 (2.1.0)
- toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 20 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <U8g2> 2.33.2
| |-- <SPI> 1.0
| |-- <Wire> 1.0
|-- <IBM LMIC framework> 1.5.0+arduino-2
| |-- <SPI> 1.0
|-- <Wire> 1.0
Building in debug mode
Checking size .pio\build\ttgov2\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
=========================================== [SUCCESS] Took 6.75 seconds ===========================================
Environment Status Duration
------------- -------- ------------
ttgov2 SUCCESS 00:00:06.750
=========================================== 1 succeeded in 00:00:06.750 ===========================================
Terminal will be reused by tasks, press any key to close it.
The platformIO.ini content is:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; ---> SELECT TARGET PLATFORM HERE! <---
[platformio]
;env_default = heltec_wifi_lora_32
;env_default = ttgov1
env_default = ttgov2
;env_default = lopy
;env_default = lopy4
;env_default = lolin32lite_lora
env_default = lolin32_lora
;
description = Paxcounter is a proof-of-concept ESP32 device for metering passenger flows in realtime. It counts how many mobile devices are around.
[common_env_data]
lib_deps_display =
U8g2@>=2.22.14
lib_deps_rgbled =
SmartLeds
build_flags =
; we need build_flag for logging, otherwise we can't use ESP_LOGx in arduino framework
; ---> NOTE: For production run set DEBUG_LEVEL level to NONE! <---
; otherwise device may crash in dense environments due to serial buffer overflow
;
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO
; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
;
; override lora settings from LMiC library in lmic/config.h and use main.h instead
-D_lmic_config_h_
-include "src/main.h"
[env:heltec_wifi_lora_32]
platform = espressif32
framework = arduino
board = heltec_wifi_lora_32
monitor_baud = 115200
upload_speed = 115200
lib_deps =
${common_env_data.lib_deps_display}
build_flags =
${common_env_data.build_flags}
-Dheltec_wifi_lora_32
-include "src/hal/heltec.h"
[env:ttgov1]
platform = espressif32
framework = arduino
board = esp32dev
monitor_baud = 115200
upload_speed = 115200
lib_deps =
${common_env_data.lib_deps_display}
build_flags =
${common_env_data.build_flags}
-Dttgov1
-include "src/hal/ttgov1.h"
[env:ttgov2]
platform = espressif32
framework = arduino
board = esp32dev
monitor_baud = 115200
upload_speed = 921600
lib_deps =
${common_env_data.lib_deps_display}
build_flags =
${common_env_data.build_flags}
-Dttgov2
-include "src/hal/ttgov2.h"
[env:lopy]
platform = espressif32
framework = arduino
board = esp32dev
monitor_baud = 115200
upload_speed = 921600
lib_deps =
${common_env_data.lib_deps_rgbled}
build_flags =
${common_env_data.build_flags}
-Dlopy
-include "src/hal/lopy.h"
[env:lopy4]
platform = espressif32
framework = arduino
board = esp32dev
monitor_baud = 115200
upload_speed = 921600
lib_deps =
${common_env_data.lib_deps_rgbled}
build_flags =
${common_env_data.build_flags}
-Dlopy4
-include "src/hal/lopy4.h"
[env:lolin32lite_lora]
platform = espressif32
framework = arduino
board = lolin32
monitor_baud = 115200
upload_speed = 256000
lib_deps =
${common_env_data.lib_deps_rgbled}
build_flags =
${common_env_data.build_flags}
-Dlolin32lite_lora
-include "src/hal/lolin32lite_lora.h"
[env:lolin32_lora]
platform = espressif32
framework = arduino
board = lolin32
monitor_baud = 115200
upload_speed = 921600
lib_deps =
${common_env_data.lib_deps_rgbled}
build_flags =
${common_env_data.build_flags}
-Dlolin32_lora
-include "src/hal/lolin32_lora.h"
Thanks for the fast answer.
I tried: Terminal â Run Task â PlatformIO â PlatformIO: upload
But the first time, I got a âtimed outâ error (see below)
The upload is ok though, when I use the reset button at the moment that the tool tries to upload.
Is that the normal procedure, or can de bootloader be activated over USB?
The auto-reset circuitry is board-design dependent, some boards require the âflash buttonâ (GPIO0) to be held down, then a reset push, then release of the flash button. So it may okay that some require it and some donât. I donât know the specifics of the TTGOv2 Paxcounter board, but Iâm sure the schematics are available to be looked at somewhere to figure that out whether it just has buttons or an on-board usb-uart adapter with RTS and DTR connected via 2 transistors to EN and GPIO0.
The usb-uart adapter on the board indeed has RTS and DTS connected to RST/EN and IO0 using transistors.
Even so, when I use the Terminal â Run Task â PlatformIO â PlatformIO: upload task, the upload times out if I donât manually reset the chip at the right time.
Do I have to add something to the task, or use another one to use the RTS/DTR lines of the UART to do the reset for me?
With this firmware, I first got an error, saying it didnât know the board, so I downloaded the ttgo-lora32-v21.json file and put it in the expressif32/boards directory.
After that, it starts to compile, but I get âfatal error: pins_arduino.h: No such file or directoryâ
No thatâs not fully how to add a ânewâ board (variant folder in framework-arduinoespressif32 missing), but the point is that that should never be needed. platform-espressif32 should have the board if its properly updated. The project compiles fine for me with the ttgo-lora32-v21.json file after selecting the board in in the platformio.iniâs default_envs and removing the _example filename part of the LoRa keys.
RAM: [= ] 5.7% (used 18660 bytes from 327680 bytes)
Flash: [== ] 21.6% (used 283053 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.
============================================= [SUCCESS] Took 14.08 seconds =============================================
Environment Status Duration
--------------- -------- ------------
ttgo_lora32_v21 SUCCESS 00:00:14.084
============================================= 1 succeeded in 00:00:14.084 =============================================
Please remove all <home folder>/.platformio/platforms/espressif32* and <home folder>/.platformio/.cache rebuild the project to get a clean download again.
I did as you asked (deleted both dirs, got a clean install from git and renamed the keys_example file.
Now, I donât get the âboard not foundâ message any more, but I still get the âpins_arduino,h: No such file or directoryâ error (see below)
Under âPROBLEMSâ there are also some messages that might be related:
PROBLEMS:
lorawan-keys.h => #include errors detected. Please update your includePath. Squiggles are disabled for this translation unit
{} c_cpp_properties.json
cannot find âC:âŚ\platformIO\LMIC-node\includeâ.
cannot find âC:âŚ\variants\ttgo-lora32-v21newâ.
cannot find âC:âŚ\platformIO\LMIC-node\includeâ.
cannot find âC:âŚ\variants\ttgo-lora32-v21newâ.
Something is really wrong here, that platform version is ancient, it should be 4.2.0 (see here) with framework-arduinoespressif32 being 2.0.2. But the project just declares that the regular platform version is to be used.
Can you cleanly redownload the project again and do
I remember now that I have used platformIO a few (5?) years ago under atom on this PC, and it seems that this installation still exists.
This might be the cause of the problems.
What is the best way to remove both installations of platformIO and reinstall it under VSC only?
Remove the PlatformIO extension from both Atom and VSCode, then remove the C:\Users\<user>\.platformio folder completely. Restart VSCode, add back the PlatformIO extension and let the installation complete + restart VSCode. Then try building the project again.