USB on H7: unable to open the port
Hello!
I'm migrating from STM32F7 to H7 MCU, but I incurred a strange problem (well, two strange problems...).
I have a QT program that opens COM ports by:
void Sensor_interface::open_port()
{
if (Device_Sensor_Port.isEmpty())
{
qDebug()<<"No Sensor port present-"<<Device_Sensor_Port;
}
else
{
qDebug()<<"DEVICE Port" << Device_Sensor_Port; // It prints "COM3"
sensor_used_port.setPortName(Device_Sensor_Port);
sensor_used_port.setBaudRate(BAUDRATE_SENSOR);
sensor_used_port.setDataBits (QSerialPort::Data8);
sensor_used_port.setParity(QSerialPort::NoParity);
sensor_used_port.setStopBits (QSerialPort::OneStop);
sensor_used_port.setFlowControl (QSerialPort::NoFlowControl);
sensor_used_port.open (QIODevice::ReadOnly);
sensor_used_port.setDataTerminalReady(true);
}
}
and this function is OK with my F7.
On H7, instead, the COM port is correctly recognized (as COM3) but the open command fails:
bool QSerialPort::setDataTerminalReady(bool): device not open
If I open that port with another program, (i.e. ARDUINO terminal) all works great and I can see STM32H7 messages.
The second strange thing is that USB works only with the SWD debugger connected.
I use an STM32F446RE as an SWD debugger/programmer (it is on COM4). If I remove the USB connected to STM32F446RE, the system stop sending messages.
My H7 is externally supplied.
I can send the code if it is useful...
Thanks,
Mario
