cancel
Showing results for 
Search instead for 
Did you mean: 

UART and data receive problem (STM32F401RE-Nucleo DemoExample)

moertl
Associate
Posted on October 22, 2015 at 07:08

Hello

I try the demo project to learn UART initialisation and using

STM32Cube_FW_F4_V1.9.0\Projects\STM32F401RE-Nucleo\Examples\UART\UART_Printf\EWARM

outgoing Communication is fine. Demo is working.

RxD and TxD are connected to the Pins RXD0 and TXD1

Now i want to receive datas, so i chanced to:

  /* Infinite loop */

  uint8_t pBuf;

  while (1)

  {

    while (HAL_UART_Receive(&UartHandle, &pBuf,1,1)!= HAL_OK)

    {

    }  

    printf(''\n\r UART Byte received UART\n\r'');

  }

I never received data? Have anybody a hint?

Seconday Problem:

If i ad a HAL_Delay() the code freezed there 

[File:stm32f4xx_hal.c]

__weak void HAL_Delay(__IO uint32_t Delay)

{

  uint32_t tickstart = 0;

  tickstart = HAL_GetTick();

  while((

HAL_GetTick()

- tickstart) < Delay)

  {

  }

}

HAL_GetTicket() allways return 0.

What i have to do, that i can use HAL_Delay() in the demo Project?

Thank you

Martin

#stm32f4 #usart
1 REPLY 1
Posted on October 22, 2015 at 15:06

HAL_Delay() is dependent on a functional SysTick, I suspect this would normally get set up in HAL_Init()

For the USART perhaps you need to check that you have an IRQHandler and that it calls back into the HAL for processing.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..