2017-04-24 07:48 PM
I am using the example to create a UART receive
STM32Cube_FW_F4_V1.15.0\Projects\STM32F411RE-Nucleo\Examples\UART\UART_Printf\SW4STM32
When I used the 'HAL_UART_Receive', then it is fine.
I have made following changes to example code, but did not get any IRQ nor the callback.
Below are the code I added
Serial_Open(void) --> this is called in Main after SystemClock_Config()
{
UartHandle.Instance = USART2;
status=HAL_UART_Init(&UartHandle);
status=HAL_UART_Receive_IT(&UartHandle,uartRxBuf,1);}
void USART2_IRQHandler(void)
{ HAL_UART_IRQHandler(&UartHandle);}void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){ uartRdLen++; HAL_UART_Receive_IT(&UartHandle, uartRxBuf, 1);}I checked startup_stm32f411xe.s, the vector function name is correct
g_pfnVectors:
.word USART2_IRQHandler /* USART2 */
What else I am missing ??
2017-04-24 08:06 PM
Is it actually receiving anything? Do you see RXNE assert? Review in your main() loop, not in a debugger view
The callback will only occur if the IRQ occurs and calls HAL_UART_IRQHandler()
Are you using C++, or a .CPP file? If so you must use the following form
extern 'C' void USART2_IRQHandler(void)
{...
Check .MAP and actual linkage in table.
2017-04-25 10:23 AM
Thanks for suggestions.
At the end, it was the basic.... Interrupt not enabled.
HAL_NVIC_EnableIRQ(USART2_IRQn)