5 years, 9 months ago.

USB Serial code is stops works after certain scanf

Hi All,

I am evaluating nucleo stm32f401RE board. I develop one basic application using USBStack. I used the USBserial class from that.USB stack downloaded from the below link.

https://os.mbed.com/teams/ST/code/STM32_USBDevice_Serial/?platform=ST-Nucleo-F401RE

Inside a code i am scanning some input from the user. After the some scanf it fail to scan the data. Code stops work and throwing below error.

mbed assertion failed: ret!=HAL_BUSY, file: ../USBDevice/targets/TARGET_STM/USBHAL_STM32.cpp, line 258

This error is from USBHAL_STM32.cpp file 's endpoint-Read function.

Please addressing my below queries for the same, 1) Why USBSerial suddenly stop work? 2)Is this USB stack reliable?

Please let me know if you need more information from my side.

Thanks, Parth

We ran into the same problem. The driver is full of issues - one being the unbelievable amount of calls going on in ISR context when receiving data. The most problematic is this failure if HAL_BUSY is returned while trying to lock() a given endpoint. That is, if you get an incoming interrupt to read from the endpoint while you are writing to the endpoint, it locks up. You will also see problems when receiving data at higher speeds.

posted by Curt Black 15 Jul 2018

Hi Curt Black,

Thanks for you kind reply.

Is there any solution to resolve these?

Please let me know.

Thanks, Parth

posted by Parth Modi 16 Jul 2018

1 Answer

5 years, 9 months ago.

Hi Parth,

The example you linked to is extremely old and is using Mbed OS 2 instead of the latest Mbed OS 5. USBSerial is also no longer supported. However, Mbed OS 5 does have support for Serial/RawSerial drivers, and there are a few examples for Mbed OS 5 that will work with the stm32f401RE board here:

Please let me know if you have any questions!

- Jenny, team Mbed

If this solved your question, please make sure to click the "Thanks" link below!

Encountered the same problem with the stm32f769 board. Unfortunately, the links you provided doesn't work (anymore). Could you post new, valid links?

/Anders

posted by Anders Mattsson 26 Sep 2018

Hi Anders, I apologize for those broken links. Here's the updated ones:

- Jenny, team Mbed

posted by Jenny Plunkett 27 Sep 2018