8 years, 11 months ago.

PC serial port not working?

Hi,

Has anybody else experienced problems with the serial interface in NUCLEO-F042K6? I tried the very basic hello world and I don't see any data coming from the device.

#include "mbed.h"

Serial pc(SERIAL_TX, SERIAL_RX);

int main()
{
    printf("Hello world!\r\n");
    
    while (true) {
    }
}

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F042K6T6 microcontroller.

1 Answer

8 years, 11 months ago.

Hi Arash,

I don't have a NUCLEO-F042K6 with me to test, but instead of SERIAL_TX and SERIAL_RX, try using USBTX and USBRX instead.

Hope that helps,

Brian

Hi Brian,

Thanks for your answer. However it does not solve the issue: both USBTX and SERIAL_TX are defined as the same pin (PA_2). The same for USBRX and SERIAL_RX (both are defined as PA_15). So the issue is not really wrong pin assignment. It should be something else, maybe it is related to the way stdout is routed or something else. I didn't have time to check the HAL for this platform yet so I am just guessing.

posted by Alef Sin 25 Nov 2015

Hi Arash,

Sorry about that, I totally checked the pin assignments before posting that and I could have sworn they were different at the time. Guess I needed more coffee :)

If you're on Windows, you'll also need the stlink driver if you haven't already installed it:https://developer.mbed.org/teams/ST/wiki/ST-Link-Driver

posted by Brian Daniels 25 Nov 2015

You can also try the general mbed serial driver, located here: https://developer.mbed.org/handbook/Windows-serial-configuration

posted by Brian Daniels 25 Nov 2015

Hi Brian,

I spent some more time on the problem but still could not make any progress. The issue is not really on the PC side as I have everything configured correctly. I already have several other Nucleo boards and this is the only model that has an issue with the PC facing serial interface.

posted by Alef Sin 30 Nov 2015