cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX 4.25 UART4 and UART5 not enabled, missing in generated code

Tom Kuschel
Associate
Posted on April 05, 2018 at 11:47

Using STM32CubeMX 4.0,

and MCU STM32L4A6QGIx,

Prerequisites: USART1-USART3 and UART4 to UART5 are using the LL driver selection via Project Settings > Advanced Settings (changed from HAL to LL library).

The generated code for USART1 to USART3, work out of the box. But with UART4 and UART5, the generated code in file usart.c needs an extra line to enable the UART. You've to add the extra (red) line, e.g.

/* UART4 init function */

void MX_UART4_Init(void)

{

LL_USART_InitTypeDef UART_InitStruct;

LL_GPIO_InitTypeDef GPIO_InitStruct;

/* Peripheral clock enable */

LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_UART4);

/**UART4 GPIO Configuration

PC10 ------> UART4_TX

PC11 ------> UART4_RX

*/

GPIO_InitStruct.Pin = ONEWIRE_TX_Pin|ONEWIRE_RXn_Pin;

GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;

GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;

GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;

GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;

GPIO_InitStruct.Alternate = LL_GPIO_AF_8;

LL_GPIO_Init(GPIOC, &GPIO_InitStruct);

UART_InitStruct.BaudRate = 9600;

UART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;

UART_InitStruct.StopBits = LL_USART_STOPBITS_1;

UART_InitStruct.Parity = LL_USART_PARITY_NONE;

UART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;

UART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;

UART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;

LL_USART_Init(UART4, &UART_InitStruct);

LL_USART_Enable(UART4);

}

Where can I report this bug?

BR Tom

5 REPLIES 5
Posted on April 05, 2018 at 13:27

>>

Where can I report this bug?

This is as good a place as any other. A more formal method/venue has been requested.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Imen.D
ST Employee
Posted on April 05, 2018 at 14:21

Hello,

Thanks for bringing this issue to our attention.

This issue is raised internally to CubeMx team for fix.

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Houda GHABRI
ST Employee
Posted on April 11, 2018 at 12:17

Hello Tom,

Thanks for your feedback.

The issue will be fixed

in the next CubeMX release.

Best regards,

Houda

Houda GHABRI
ST Employee
Posted on June 08, 2018 at 12:37

Hello

t.kuschel

,

You can switch to STM32CubeMX 4.0 available now on ST website.

This issue is resolved.

regards,

Houda

Posted on June 08, 2018 at 15:36

 ,

 ,

Dear Houda,

thanks for the info, and I also updated my last project to the new HAL V1.12

Note, I stumbled b/c of QSPI written as QPSI in a define. I think it is a typo :

==============================================

within stm32l4xx_hal_qspi.h , at LINE 465

♯ define HAL_QPSI_TIMEOUT_DEFAULT_VALUE 5000U /* 5 s */

should be named to:

♯ define HAL_QSPI_TIMEOUT_DEFAULT_VALUE 5000U /* 5 s */

(maybe just keep both defines, because this define is used in some eval board examples using the QSPI interface)

I did a

♯ define HAL_QPSI_TIMEOUT_DEFAULT_VALUE HAL_QSPI_TIMEOUT_DEFAULT_VALUE

to be sure nothing will be broken.

BR Tom

Von: houda ghabri <,st-microelectronics@jiveon.com>,

Gesendet: Freitag, 8. Juni 2018 12:39

An: Kuschel, Thomas E <,t.kuschel@ott.com>,

Betreff: Re: - Re: STM32CubeMX 4.25 UART4 and UART5 not enabled, missing in generated code

STMicroelectronics Community <,https://urldefense.proofpoint.com/v2/url?u=https-3A__community.st.com_-3Fet-3Dwatches.email.thread&,d=DwMCaQ&,c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&,r=FXWVqP1yFR3Om2iqBGfuneqc75tBQtJcAg0iHm8J-aY&,m=kdDYsyuh14QvM1a2dLpab2QoRt-c_c-oPLqQQNwRyS4&,s=f9udHTEiTutRZuPO-cZ-z1aqYBmjczdAKXM9f3JjR04&,e=>,

Re: STM32CubeMX 4.25 UART4 and UART5 not enabled, missing in generated code

reply from houda ghabri<,https://urldefense.proofpoint.com/v2/url?u=https-3A__community.st.com_people_houda.ghabri-3Fet-3Dwatches.email.thread&,d=DwMCaQ&,c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&,r=FXWVqP1yFR3Om2iqBGfuneqc75tBQtJcAg0iHm8J-aY&,m=kdDYsyuh14QvM1a2dLpab2QoRt-c_c-oPLqQQNwRyS4&,s=GP55eMxdevwRwkn65eXOQNKGhOMVQAiB7qkor-wavpo&,e=>, in STM32 MCUs Forum - View the full discussion<,https://urldefense.proofpoint.com/v2/url?u=https-3A__community.st.com_message_201017-2Dre-2Dstm32cubemx-2D425-2Duart4-2Dand-2Duart5-2Dnot-2Denabled-2Dmissing-2Din-2Dgenerated-2Dcode-3FcommentID-3D201017-26et-3Dwatches.email.thread-23comment-2D201017&,d=DwMCaQ&,c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&,r=FXWVqP1yFR3Om2iqBGfuneqc75tBQtJcAg0iHm8J-aY&,m=kdDYsyuh14QvM1a2dLpab2QoRt-c_c-oPLqQQNwRyS4&,s=-_60Pt_YUyT0nH6bm-7lJ1vN7PRTDv2yMHlXdFJBxiE&,e=>,