Skip to main content
Associate III
July 9, 2024
Solved

serial monitor not working

  • July 9, 2024
  • 3 replies
  • 4945 views

im trying to create a project that write something in the serial monitor(raed/write) . i followed many tutorials step by step but i everytime my serial monitor doesnt print my message( i used tera term/putty/and even the serial monitor in the ide "command shell console". 

- i already fixed the baud rate to 115200

- i already confugured the usart3 pins pd8 and pb11 or pd8 and pd9 for RX and TX

-i already activated the NVIC settings in usart3 menu

- this is the code that i used in while(1) part : 

while (1)

{

/* Transmit "Hello, World!" over USART3 */

char msg[] = "Hello, World!\r\n";

HAL_UART_Transmit(&huart3, (uint8_t*)msg, sizeof(msg) - 1, HAL_MAX_DELAY);

 

/* Add a delay to avoid flooding the serial monitor */

HAL_Delay(1000);

}

 

the code was built with 0 errors 0 warnings

is there something that i misssed or i need to ckeck or did wrong

 

im using stm32f407G disc1 board and it's only connected to the c through the cable

Screenshot 2024-07-09 115726.png

    Best answer by Andrew Neil

    @yessine wrote:

    I'm using stm32f407G disc1 board 


    So this: https://www.st.com/en/evaluation-tools/stm32f4discovery.html

     


    @yessine wrote:

     it's only connected to the c through the cable


    Pardon?

    You should connect it to your computer using the mini USB socket (CN1):

    AndrewNeil_0-1720528330834.png

    Make sure that you are using a full data cable - not just a charging cable.

    When you plug the cable in, you should see a  COM port appear in the Device Manager:

    AndrewNeil_1-1720528485202.png

    https://community.st.com/t5/stm32-mcus-products/program-upload-method-in-nucleo-stm32f103/m-p/633828/highlight/true#M233986

    You need to connect your terminal to that COM port.

     

    Did you follow the instructions for connecting to the ST-Link's virtual COM port:

    AndrewNeil_3-1720529061394.png

    https://www.st.com/resource/en/user_manual/um1472-discovery-kit-with-stm32f407vg-mcu-stmicroelectronics.pdf#page=15

     

    Please see the posting tips for how to properly post source code:

    https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

     

     

    3 replies

    Andrew Neil
    Andrew NeilBest answer
    Super User
    July 9, 2024

    @yessine wrote:

    I'm using stm32f407G disc1 board 


    So this: https://www.st.com/en/evaluation-tools/stm32f4discovery.html

     


    @yessine wrote:

     it's only connected to the c through the cable


    Pardon?

    You should connect it to your computer using the mini USB socket (CN1):

    AndrewNeil_0-1720528330834.png

    Make sure that you are using a full data cable - not just a charging cable.

    When you plug the cable in, you should see a  COM port appear in the Device Manager:

    AndrewNeil_1-1720528485202.png

    https://community.st.com/t5/stm32-mcus-products/program-upload-method-in-nucleo-stm32f103/m-p/633828/highlight/true#M233986

    You need to connect your terminal to that COM port.

     

    Did you follow the instructions for connecting to the ST-Link's virtual COM port:

    AndrewNeil_3-1720529061394.png

    https://www.st.com/resource/en/user_manual/um1472-discovery-kit-with-stm32f407vg-mcu-stmicroelectronics.pdf#page=15

     

    Please see the posting tips for how to properly post source code:

    https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

     

     

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    yessineAuthor
    Associate III
    July 10, 2024

    sorry for the typing error . i meant the board is attached to the PC* through a usb type B cable(the one that you showed in the image attached . and yes the pc have recognized the device i cheked in the device manager. besides that , i didnt really understand  the VCP part. 

    Guillaume K
    ST Employee
    July 9, 2024

    when you write


    @yessine wrote:

    im using stm32f407G disc1 board and it's only connected to the c through the cable

     

    do you mean the board is connected to the computer with the USB cable ?

    Are you trying to use the virtual com port feature of the STLINK ?

    I've had a look at stm32f407G disc1 schematics and I can't find VCP connection between the STM32F4 and the STLINK on the board. I guess the VCP feature is not present.

    Or are you trying to use the STM32F4 GPIO ports as UART with a direct connection ? (using an GPIO-USB adapter to connect to PC ?)

    yessineAuthor
    Associate III
    July 10, 2024

    sorry for the typing error . i meant the board is attached to the PC* through a usb type B cable(the one that you showed in the image attached . and yes the pc have recognized the device i cheked in the device manager. isn't a connecting cable enough ?

    TDK
    Super User
    July 9, 2024

    > im using stm32f407G disc1 board and it's only connected to the c through the cable

    You'll need to use a UART to USB adapter, or otherwise connect the UART pins to the computer somehow. USART3 isn't connected to the VCP interface on that board. Nothing is.

    TDK_0-1720529620648.png

     

    "If you feel a post has answered your question, please click ""Accept as Solution""."
    yessineAuthor
    Associate III
    July 10, 2024

    thanks . i realized that my board dont have VCM i have an other L4 board im gonna test wih it

    Andrew Neil
    Super User
    July 10, 2024

    @yessine wrote:

    i realized that my board don't have VCM 


    Pardon?

    Did you mean VCP - ie, Virtual COM Port ?

    As explained earlier, your board does have a VCP - it's just that you have to manually make the physical connections to it.

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.