DISCO L476 USART 3 not working

Sysprogs forums Forums VisualGDB DISCO L476 USART 3 not working

This topic contains 5 replies, has 2 voices, and was last updated by  support 3 weeks, 4 days ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #12736

    rotemse
    Participant

    I designed a board based on the Disco L476. I used MBED with the L476 board as the chosen platform and the program worked well.

    I wanted to move to VisualGDB and so I ported the project and everything worked. Then I tried to check USART3.

    At first when I declared the TX RX pins (PD_8, PD_9 in my design) I got an error “pinmap not found for peripheral”  in the COM port window. So I searched for pin configurations, and indeed these two pins were missing in the PinMap PinMap_UART_RX[] and PinMap PinMap_UART_TX[] declarations in “”PeripheralPins.c”.

    So I added these lines:

    {PD_8, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},     //added to PinMap PinMap_UART_TX[]

    and

    {PD_9, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},   //added to PinMap PinMap_UART_RX[]

     

    Now I don’t get the “pinmap not found for peripheral” message anymore, but I also don’t receive any serial data for this port (I can’t see any data received). I checked with an external logic analyzer that the receive pin indeed receives data.

    Here is my declaration:

    GPS_Serial.baud(9600);
    GPS_Serial.format(8, SerialBase::None, 1);
    GPS_Serial.attach(&GPSCallback);

    void GPSCallback()
    {
    e = GPS_Serial.getc();
    pc.putc(e);
    }

     

    Could it be that the USART3 can’t register itself to receive interrupts?

     

    Thanks

    #12738

    support
    Keymaster

    Hi,

    Generally in order for a USART to work, you need to ensure the following:

    • The peripheral clock for this USART is enabled
    • The corresponding pins are configured to work as USART
    • You configure the peripheral correctly (e.g. set the baud rate) and write the correct data registers

    We have a detailed tutorial showing how to use STM32 UART here: https://visualgdb.com/tutorials/arm/stm32/uart/hal/

    Generally we would advise first sorting this out on a regular non-MBED project and then stepping through the mbed source code to ensure that it does the same initialization/configuration steps as your non-mbed project (hardware register window can help double-check that the necessary parts got initialized).

    #12740

    rotemse
    Participant

    all the other UARTS are working well with the same MBED code running in VisualGDB.

    I didn’t change anything…

     

    #12744

    support
    Keymaster

    Hi,

    We understand you didn’t change anything, however sometimes the problems are caused by unexpected combinations of small changes or incompatible settings that are hard to predict. We advise following the diagnostic steps in the previous post to resolve this.

    #12776

    rotemse
    Participant

    Hi

    I tried the example from the URL, but I still can’t receive any serial data. Transmitting serial data works well.

    I am using interrupts.

    Here is my code.

    • This reply was modified 3 weeks, 4 days ago by  support. Reason: formatting
    #12778

    support
    Keymaster

    Hi,

    You might be missing extern “C” around your interrupt handler. Please also note that our support is limited to issues related to VisualGDB. For general programming problems and troubleshooting issues with your code please use other resources like StackOverflow to get help from other community members.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.