cancel
Showing results for 
Search instead for 
Did you mean: 

STcube MX code issue

SS_135
Associate II

Hi Team,

Facing some issues on below

  1. HAL Delay goes into infinite loop or the program stops there only (Inside the "IF" condition)
  2. "IF" Condition works, data transfer works, but Toggling of pin, or any action with Delay command is not working
  3. Upon going thru the literature, found that priority clash between Interrupt and delay, but not convinced also changed the "Premption Priority" tried and not worked.
  4. Share your insights and go ahead directions to control activities thru' UART between MCUs (Tried in F4, L0, CubeMX+Keil & CubeMX+Truestudio)

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)

{

/* Prevent unused argument(s) compilation warning */

UNUSED(huart);

/* NOTE : This function should not be modified, when the callback is needed,

the HAL_UART_RxCpltCallback can be implemented in the user file.

*/

if (receivedata[0] == 'a')

{

HAL_UART_Transmit(&huart2,transmitData2,10,10);

HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_13);

HAL_Delay(1000);

HAL_GPIO_WritePin(GPIOB, GPIO_PIN_13, GPIO_PIN_RESET);

}

1 REPLY 1
Pavel A.
Evangelist III

HAL_UART_RxCpltCallback is likely called from the UART interrupt handler.

Do not use HAL_Delay in an interrupt handler.

-- pa