10 years, 2 months ago.

Using USB serial on the new Nucleo F401RE

Hello tried the USB serial example to do a printf() to the PC. But

#include "USBSerial.h"

fails

Quote:

Error: Cannot open source input file "USBSerial.h": No such file or directory in "main.cpp", Line: 2, Col: 23

Heinz

2 Answers

10 years, 2 months ago.

Sorry, does not help

Tried the 'update' option on right click on different entries without success.

Heinz

Accepted Answer

Can you point me to an example using the UART/USB please Heinz

posted by Heinz-Jürgen Oertel 01 Mar 2014

Regular Serial communication is done through the st-link interface. You wont need USBSerial in that case. Just include mbed.h, define a Serial object with Serial pc(SERIAL_TX,SERIAL_RX), and use printf.

USBSerial is for a device that has a hardware USB port on-chip. That may not yet be supported on the nucleo. Note that there also is no separate USB socket on the board for the target device. You would have to add that also.

posted by Wim Huiskamp 02 Mar 2014

Thanks Wim with this Serial Object and TX/RX values the example compiles. Anyway, I naow have trouble getting the pc.printf() output on /dev/ttyACM0. It looks like the debugger closes and reopens this device, which makes it difficult to have the serial terminal open. I hope to find some more hints on using mbed and the serial output when working with Linux. Heinz

posted by Heinz-Jürgen Oertel 02 Mar 2014
10 years, 2 months ago.

I had that problem too. Rightclick on the mbed lib in your project and update the lib, then recompile all. That solved it for me.