USB CDC not recognized Nucleo144 H743ZI2
Posted: Mon Jun 26, 2023 7:26 pm
Hi all, hope everyone is doing well.
This is my first time posting here, so please bear with me. I've Googled this issue for hours and trawled the forums, but I haven't found an answer that works for me.
Host OS: Ubuntu Linux 20.04.6 LTS
Board: Nucleo-144 H743ZI2
Package: STM32duino FreeRTOS, version 9.0.0
Standard Library: Newlib Nano
Goal: Serial communication over non-ST-Link USB port
Problem: USB port is not enabled / Ubuntu Linux can't communicate with it
The points above summarize my issue. My computer recognizes the ST-Link port and I'm able to flash and mount the board as I would expect. Sometimes I can also see the CDC USB port on my computer, and sometimes I can't. For a long time I was able to use the USB port for data communication, but recently I re-flashed and it doesn't work anymore.
My first thought was that there must be something wrong with my code, but I don't think that's the case because I've tried a variety of build options, code configurations, and library versions. I'm not sure why the USB port stopped working all of a sudden, but I've gathered from reading online that maybe the STM32 USB ports can be finicky.
I can't share all of my work, but here are some snippets that reproduce the issue for me. My code is quite different (setting up tasks, using the scheduler, mutexes, etc.) but I hope this minimal reproducible example will help find a solution.
MySketch.ino
arduino.json
Please let me know if there is any additional information that I could provide. Thank you!
This is my first time posting here, so please bear with me. I've Googled this issue for hours and trawled the forums, but I haven't found an answer that works for me.
Host OS: Ubuntu Linux 20.04.6 LTS
Board: Nucleo-144 H743ZI2
Package: STM32duino FreeRTOS, version 9.0.0
Standard Library: Newlib Nano
Goal: Serial communication over non-ST-Link USB port
Problem: USB port is not enabled / Ubuntu Linux can't communicate with it
The points above summarize my issue. My computer recognizes the ST-Link port and I'm able to flash and mount the board as I would expect. Sometimes I can also see the CDC USB port on my computer, and sometimes I can't. For a long time I was able to use the USB port for data communication, but recently I re-flashed and it doesn't work anymore.
My first thought was that there must be something wrong with my code, but I don't think that's the case because I've tried a variety of build options, code configurations, and library versions. I'm not sure why the USB port stopped working all of a sudden, but I've gathered from reading online that maybe the STM32 USB ports can be finicky.
I can't share all of my work, but here are some snippets that reproduce the issue for me. My code is quite different (setting up tasks, using the scheduler, mutexes, etc.) but I hope this minimal reproducible example will help find a solution.
MySketch.ino
Code: Select all
#include <string>
#include <Arduino.h>
#include <IWatchdog.h>
#include <STM32FreeRTOS.h>
using std::string;
void setup() {
Serial.begin(); // USB
while (!Serial.availableForWrite()) {}
}
void loop() {
foo();
delay(5);
}
void foo() {
char c{'0'};
string rcvd{""};
while (Serial.available() && c != '\n') {
c = (char)Serial.read();
rcvd += c;
}
}
Code: Select all
{
"sketch": "MySketch.ino",
"configuration": "pnum=NUCLEO_H743ZI2,upload_method=MassStorage,xserial=generic,usb=CDCgen,xusb=FS,opt=o3std,dbg=none,rtlib=nano",
"board": "STMicroelectronics:stm32:Nucleo_144",
"port": "/dev/ttyACM0",
"output": "./build"
}