Questions about CMSIS v2 Queue
Hi Community,
I am using UART + CMSIS v2 + osMessageQueue to pass messages in the main and Model, but when I set a break point in callback function, the debugger does not jump to execution.
As described in this post, this prevents me from viewing the contents of the osMessageQueue.
I'm using Idle Interrupt in DefaultTask to wait for UART message to be received.
Although my callback function works fine, the break point does not work in the callback function, so I can't see what happens when the message is put into the Queue.
Does anyone know what I can do?
This is my code:
Default Task:
void StartDefaultTask(void *argument)
{
/* USER CODE BEGIN defaultTask */
extern UART_HandleTypeDef huart1;
extern char RxData[256]; // received data from UART
HAL_UART_Transmit(&huart1, "UART1 ready...\n", 15, 0xffff);
char cmd[42] = "send_string \"Hello\"\n"
"\n";
HAL_UART_Transmit(&huart1, cmd, sizeof(cmd), 0xffff);
HAL_Delay(50);
/* Infinite loop */
for(;;)
{
HAL_UARTEx_ReceiveToIdle_IT(&huart1, RxData, 256);
osDelay(1);
}
/* USER CODE END defaultTask */
}Callback function
extern osMessageQueueId_t uartQueueHandle;
char RxData[256]; // received data from UART
char DataBuffer[256]; // store full message
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
memcpy(DataBuffer, RxData, Size+1);
HAL_UART_Transmit(&huart1, (uint8_t *)DataBuffer, Size, 0xffff);
if (osMessageQueueGetSpace(uartQueueHandle)>0)
{
osMessageQueuePut(uartQueueHandle, DataBuffer, 0 ,0);
}
HAL_Delay(100);
}
