Hi folks,
I'm trying to upload to and run a serial monitor on my Portenta Machine Control from both PlatformIO in VSCode and Arduino IDE. I was able to upload and monitor through PlatformIO several times while implementing a modbus server first on a Mega 2560 and then on the Portenta. Then I went to further adapt other code I'd written for the Mega by #including <Arduino_PortentaMachineControl.h> and invoking MachineControl_DigitalInputs begin() and read(). That was when the upload and monitor errors started (not sure how that could be related).
Side note: I've been a professional software engineer for ~10 years but I'm still relatively new to embedded development, C++, and working at a lower level with OS resources (~5 months) so please forgive any mistakes or misnomers.
Error output from Arduino IDE:
No DFU capable USB device available
fu-util 0.10-dev
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Failed uploading: uploading error: exit status 74
PlatformIO errors I've ran into:
*** [upload] Cannot configure port, something went wrong. Original message: OSError(22, 'The semaphore timeout period has expired.', None, 121)
After x2 reset button, unplug-replug:
Configuring upload protocol...
AVAILABLE: cmsis-dap, dfu, jlink, mbed, stlink
CURRENT: upload_protocol = dfu
Looking for upload port...
Auto-detected: COM9
After several minutes:
Forcing reset using 1200bps open/close on port COM9
then after a few seconds:
Waiting for the new upload port...
then after several more minutes:
Uploading .pio\build\portenta_h7_m7\firmware.bin
dfu-util 0.11-arduino4
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
No DFU capable USB device available
*** [upload] Error 74
============================================================ [FAILED] Took 431.36 seconds ============================================================
So far what I've tried is:
- Unplug USB cable
- Uninstall port from Device Manager
~End COM Surrogate process - Restart computer
- Replug USB cable
- Upload "STM32H747 manage bootloader" sketch successfully in Arduino IDE
- Serial Monitor from Arduino IDE, upgrade to Bootloader version: 25
- Close serial monitor in Arduino IDE
- Upload successfully in PlatformIO
- Start serial monitor in PlatformIO
~Hangs for a few minutes, then outputs:
UserSideException: Cannot configure port, something went wrong. Original message: OSError(22, 'The semaphore timeout period has expired.', None, 121)
- Double press reset button on Portenta
- Unplug/replug USB cable
- Uninstall inactive port in device manager
- Rerun serial monitor in PlatformIO
~Monitor seems to start, outputs:
--- Terminal on COM3 | 9600 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
Then hangs indefinitely (20+ mins)
I've also updated PlatformIO core, ensured I'm initializing Serial with the same baud rate to which the serial port is set, ensured either IDE is targeting the right board and COM port number, and tried a different USB cable (although I haven't yet tried without a USB hub since the cable I ordered hasn't arrived yet).
My platformio.ini environment is as follows:
[env:portenta_h7_m7]
platform = ststm32
board = portenta_h7_m7
framework = arduino
lib_deps = arduino-libraries/Arduino_PortentaMachineControl@^1.0.3
Please let me know what else to try or what other information would be helpful in diagnosing the problem.
Thank you in advance for your time ![]()
![]()
![]()