5 years, 10 months ago.

Unable to send output to a Terminal Using printf

Dear M, I am trying to work with few experiments using the STM32F407 VG Disc1 Discovery kit given to us and did 2 simple led blinking and push button experiments successfully.

I am having an issue when I try to do a printf and send some data to the pc using the USB port configured as virtual COM. I am using CoolTerm SW at the PC end to check the received data but I could not see the display.

#include "mbed.h" 

Serial pc(USBTX,USBRX);
DigitalOut myled(PD_12);

int main() {
pc.baud(9600);
while (1) {
wait(1.0);
pc.printf("Hello World!\r\n");
myled = 1;
wait(1.0);
myled = 0;
wait(1.0);

}
}

And the board used is an equivalent board seeed arch max as the stm32f407vg board is not directly supported by the online compiler. The device was recogonized on Com3 port as virtual COM port. I have set the termianl port settings correctly. The jumper selections are set to the default.

I am not sure if my platform selection is correct.

Kindly advice Raju.S

1 Answer

5 years, 10 months ago.

Hi Raju,

When compiling for this board with the Mbed CLI, please make sure you are using DISCO_F407VG for the target board name. For example: mbed compile -t gcc_arm -m DISCO_F407VG

I also noticed that there is a note on the DISCO-F407G board page regarding the default HW configuration for UART: https://os.mbed.com/platforms/ST-Discovery-F407G/#mbed-porting

It looks like you will need to use a USART to USB dongle to connect, for example, pin 14 (PA2: URART2_TX) and pin 13 (PA3: USART2_RX). Or, you can use fly wires to connect the the ST-LINK VSP on U2 pin 12 and 13 to USART2 (PA2 and PA3: pin 14 and 13).

There is also a new ST-LINK firmware upgrade available for download here: http://www.st.com/en/development-tools/stsw-link007.html

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!

Also, please see Wim's answer on this question here: https://os.mbed.com/questions/81581/No-USB-or-UART-on-STM32F407-Discovery/#answer14808

posted by Jenny Plunkett 20 Jun 2018

Jenny, Thanks for your response. Actually, I am trying with the Online Mbed Compiler instead of CLI to keep things simple. But, if you want me to do via CLI , I have installed it and I will give a try.

The documentation does not show much about doing data transfer to PC in terms of ST-Link or SWD. It was only mentioned that they are alternate ways of using Debugging Applications (internal or external debug apps). Are they actually meant for normal data transfers also?

I am also trying to see if the connector CN5 (microUSB) mentioned as (OTG-USB) can be used to connect to PC and do the normal transfer.

Also, I need some advice as to install any USB software drivers and include them in our header files. Right now, I have the bare mbed.h.

Warm Regards, Raju.S

posted by raju sambandam 20 Jun 2018