cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_Init returns HAL_ERROR on STM32MP1-DK1

FDufo.1
Associate II

Hi,

I'm testing the UART_Receive_Transmit_Console example from STM32Cube_FW_MP1_V1.2.0 on the STM32MP1-DK1 discovery board. An HAL_ERROR is raised during the HAL_UART_Init and it seems that the function UART_SetConfig cannot find or set the clocksource correctly. 

I have set the PCLK1 clock in the u-boot and tf-a .dts files and I'm using a linux image with this setting.

Is this function UART_SetConfig from the stm32mp1xx_hal_uart.c file only working in engineering mode or should it work also in normal mode?

François

3 REPLIES 3
mleo
Senior II

Hi @François Dufourniaud​ ,

The example should work in both modes.

Did you use CubeMX for partial device tree generation? Did you assign the UART for M4 core?

Some hints:

https://wiki.st.com/stm32mpu/wiki/USART_internal_peripheral

Best regards,

Milan

FDufo.1
Associate II

Hi @mleo​ ,

Yes I used CubeMX for partial tree generation and I have already checked the wiki but I can't find my mistake. The USART3 peripheral is activated for M4 and PCLK1 is set for the USART3 in the u-boot and tf-a device tree. I don't remember if the USART3 is explicitaly disabled for the A7, as explained in this article : https://wiki.st.com/stm32mpu/wiki/How_to_assign_an_internal_peripheral_to_a_runtime_context

Also the function ResMgr_Init(NULL, NULL); is not called to ask the resource manager for the USART3 resource. Maybe this is mandatory and missing in the example.

I'm going to check again the device trees.

Thanks for your help,

Best regards,

François

FDufo.1
Associate II

Hi,

I went all the way through the process again :

1- generation of the DTS files with CUBE MX for the DK1 board with the USART3 reserved for M4 operations

2- linux image compilation with the new DTS files

3- flashing the image on the SDCARD

4- starting the M4 firmware from the A7

This is now working great. Only syscalls.c was missing in my M4 firmware. I found it in the STM32CubeIDE folder of the UART example.

Thanks @mleo​ for your help,

François