Mac + VSCode + platformio + wiscore_rak11200 + esp32 does not upload code

Heyhey, I installed and configured everything in the title. First it worked perfectly, building and uploading was no problem. Then suddenly, I did not install any update, the uploading did not work anymore. The esp talked via serial monitor to my macbook, but no uploading. I changed to different usb ports, directly on the macbook and via usb c hub. Allways the same. On the serial monitor (with the old code running on the esp) I could see the esp sending infos but uploading new code does not work. As before, for uploading I bridged the pins to get to the bootloader on the esp, pressed the reset button and on the serial monitor I can see that the esp is ready for download. Then I click “Upload” or “Upload and Monitor” in platformio extension of VSCode and the code will be compiled but then it does not switch to the monitor and does not upload the code as before.


(sorry I can only upload one file)
After trying on a different mac I think I uploaded a testprogramm, or olny half of it. From the second “rst: 0x1 (POWERON RESET),” I removed the bridge for getting to the bootloader and it shows that message.

Maybe there is something wrong with the hardware?

Please post everything that comes to your mind.

I installed everything on Arduino IDE and tested a program that only writes to the serial Monitor. Compilation and Upload in Arduino IDE works and I can see the correct output on the Serial Monitor. So I guess the Hardware is ok.

Your screenshots only show the serial monitor and the build process, but no upload process.

If the upload cannot be done because the COM port is busy or fails for some other reason, this is indicated by an error message.

Please close all serial monitors and perform an upload.
A screenshot of this would be helpful.

Yes correct, that is the problem. When I click on upload it builds and finishes with SUCCESS and then nothing happens. There is no Error Message and the code is not uploaded and even not tried to upload. (When the Serial Monitor is already open and it tries to open another one it tells me. But this is not the problem.)

And when I click on “Upload and Monitor” in platformio extension this comes:

Seems like uploading doesn’t do anything at all and it immediately goes over to the “monitor” task.

What’s the log for PlatformIO CLI → pio run -t upload -v?

What’s the content of your platformio.ini?

The upload command in your screenshot is missing --environment <name> (where <name> is the name of the corresponding environment).

You can see the log of “pio run -t upload -v” in the first Screenshot (with many windows) in the top right corner.

1 Like

platfomio.ini file:

; 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
; https://docs.platformio.org/page/projectconf.html
[env:wiscore_rak11200]
platform = espressif32
board = wiscore_rak11200
framework = arduino
lib_deps =
  sparkfun/SparkFun SHTC3 Humidity and Temperature Sensor Library@^1.1.4
  beegee-tokyo/RAKwireless RAK12034@^1.0.0
  electroniccats/Electronic Cats PN7150@^2.0.1
  adafruit/Adafruit SH110X@^2.1.10
  ricmoo/QRCode@^0.0.1
  sparkfun/SparkFun u-blox GNSS Arduino Library@^2.2.25
monitor_speed = 115200
extra_scripts = post:extra_script.py

Content of that script?

the script is from my colleague. I set it to exit directly when It runs on my mac:
" Import(“env”)

import shutil

import os

import platform # for Max running on Mac

if platform.system() == “Darwin”: # for Max running on Mac

exit()
…"

the intendation of the exit() is wrong…

Screenshot 07.01.2024 um 20.19.24 PM

What does it do with extra_scripts = post:extra_script.py commented out?

Which Screenshot are you refering to? Mostly I click on the Menu points in the left of the pio extension.

Wow, now it works, but I am not sure if it was the commenting out of the “; extra_scripts = post:extra_script.py” because inbetween I installed all software also on my other mac and tried to upload a sample program. That worked. Then I installed some RAK library for the board and tried to upload code and then I did not work anymore. So I thought deinstalling all RAK libs could be it. As I was commenting out the extra script for testing your suggestion, maxgerhardt, the code was not compiling because of the missing CAN libs. I reinstalled them and it was uploading again.

It seems to me that exit() kills the upload flow. Maybe you want to have an inverted logic of

if platform.system() != “Darwin”: # for Max running on Mac
   # commands if not Mac
else:
  pass # nothing runs if Mac

Yeah you were right with the script. It’s something in it. I will try your version.

you were right it was the exit(). With:
Screenshot 07.01.2024 um 20.50.17 PM
it works. It’s starting the script in the same process and not parallel, and the process is killed, as you said. Thank you guys so much