Skip to main content
Visitor II
March 24, 2022
Solved

USART3 (on Arduino connector CN14) troubles on stm32u5 iot eval board BU585IIO2A

  • March 24, 2022
  • 4 replies
  • 3182 views

i'm using the  stm32u5 iot eval board BU585IIO2A and want to use USART3 on Arduino connector CN14

i successfully got the PWM working on PIN7 of CN14 but i fail to get anything sent / received on UASRT3 (Pins 1 and 2 of CN14)

are there any hints / samples how to get this working ?

thx, peter

    This topic has been closed for replies.
    Best answer by Mike_ST

    Yes, that should be the problem...

    In the .ioc you have to assign it to PD8/PD9,

    and you should end up with that:

       /* Peripheral clock enable */

       __HAL_RCC_USART3_CLK_ENABLE();

       __HAL_RCC_GPIOD_CLK_ENABLE();

       /**USART3 GPIO Configuration

       PD8    ------> USART3_TX

       PD9    ------> USART3_RX

       */

       GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;

       GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

       GPIO_InitStruct.Pull = GPIO_NOPULL;

       GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

       GPIO_InitStruct.Alternate = GPIO_AF7_USART3;

       HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

    /* USART3 interrupt Init */

    HAL_NVIC_SetPriority(USART3_IRQn, 0, 0);

    HAL_NVIC_EnableIRQ(USART3_IRQn);

    4 replies

    Technical Moderator
    March 24, 2022

    Hello,

    USART3 is connected to STMOD+ connector as well through the U3 switch, as shown in schematic page 7.

    So, please make sure that PH15 (STMOD+.UART3_SPI3_SEL) is set to Output Low.

    Maybe that is the problem.

    PSchb.1Author
    Visitor II
    March 24, 2022

    thx for your quick response.

    actually, in the specs it reads that PH15 has to be set to HIGH and i did that.(page 35 PH15 set high)

    which spec are you referring to ? (mine is : um2839-discovery-kit-for-iot-node-with-stm32u5-series-stmicroelectronics.pdf)

     /*Configure GPIO pin Output Level */
     HAL_GPIO_WritePin(GPIOH, GPIO_PIN_15, GPIO_PIN_SET);

    best regards, peter

    Technical Moderator
    March 24, 2022

    I'm refering to the schematic:

    https://www.st.com/resource/en/schematic_pack/mb1551-u585i-c02_schematic.pdf

    Page 35 of the UM2839 user's manual explains how to use the USART3 on the STMOD+ CN2 connector, not on the Arduino connector.

    In your case, you don't want the U3 switch to drive the USART3 lines.

    So you have to set U3 to drive the SPI lines so it it won't disturb USART3 lines.

    PSchb.1Author
    Visitor II
    March 25, 2022

    i really appriciate your support !

    but it does not work for me and i still don't know why.

    so, i tried it both ways , this way

    HAL_GPIO_WritePin(GPIOH, GPIO_PIN_15, GPIO_PIN_RESET);

    and this way

    HAL_GPIO_WritePin(GPIOH, GPIO_PIN_15, GPIO_PIN_SET);

    both ways do not work.

    do you know the reason why ? what am i missing ?

    how SHOULD it be set ? and when: just before MX_USART3_UART_Init(); or before using uart e.g with HAL_UART_Transmit(&huart3, "peter\r\n", 7, 10);

    i made a small test project just for testing that UART3 on Arduino connector CN14 : should you send you the main.c ?

    thx, again,

    peter

    Technical Moderator
    March 25, 2022

    Here is mine instead, tested using a USB <-> serial converter on the CN14 connector.

    Hope that helps.

    Mike_STAnswer
    Technical Moderator
    March 25, 2022

    Yes, that should be the problem...

    In the .ioc you have to assign it to PD8/PD9,

    and you should end up with that:

       /* Peripheral clock enable */

       __HAL_RCC_USART3_CLK_ENABLE();

       __HAL_RCC_GPIOD_CLK_ENABLE();

       /**USART3 GPIO Configuration

       PD8    ------> USART3_TX

       PD9    ------> USART3_RX

       */

       GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;

       GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

       GPIO_InitStruct.Pull = GPIO_NOPULL;

       GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

       GPIO_InitStruct.Alternate = GPIO_AF7_USART3;

       HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

    /* USART3 interrupt Init */

    HAL_NVIC_SetPriority(USART3_IRQn, 0, 0);

    HAL_NVIC_EnableIRQ(USART3_IRQn);