I have installed VS-Code, Python, and the PlatformIO at two different computers.
Have a Arduino project for WeAct-Blackpill-STM32F411CE that are compiled OK
Before I could do anything, I had to install the packages: framework-arduinoststm32, tool-stm32duino
then made some changes in main.cpy, blackpill_f411ce.json, platformio-build.py
the changes are all around adding WeAct_HID_Flash-Cli loader, and the offset after the WeAct bootloader.
Every thing works just fine, but of cause if You update the packages You will have to reinsert those changes again, as it is for now.
Problem:
the upload fails because the PC have no COM ports as default, the WeAct loader are not started because of the missing COM port. If the blackpill are running with an App using USB VCOM, the WeAct loader starts correctly but can’t of cause find the usbbootloader code.
What shall I do to get platformio to detect the device and start the WeAct loader when I have none COM ports?
the errors are those:
Looking for upload port…
*** [upload] UnboundLocalError : local variable ‘port’ referenced before assignment
Traceback (most recent call last):
File “C:\Users\Christian.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Action.py”, line 1318, in execute
result = self.execfunction(target=target, source=rsources, env=env)
File “C:\Users\Christian.platformio\packages\tool-scons\scons-local-4.4.0\SCons\Util.py”, line 737, in call
return self.method(*nargs, **kwargs)
File “C:\Users\Christian.platformio\penv\lib\site-packages\platformio\builder\tools\pioupload.py”, line 113, in AutodetectUploadPort
UPLOAD_PORT=SerialPortFinder(
File “C:\Users\Christian.platformio\penv\lib\site-packages\platformio\device\finder.py”, line 156, in find
return best_port or port
UnboundLocalError: local variable ‘port’ referenced before assignment
Well i just had to read the error information and understand the message, and the solution are
Set the board in WeAct upload mode, by pressing the user KEY and hold it until after reset, it will go
in WeAct mode. Now check the device id found in the list of HID devices on the computer, get the device: USB\VID_0483&PID_572A and set the upload_port = USB\VID_0483&PID_572A in platformio.ini.
Rebuild, and upload, succeded, case open for questions