cancel
Showing results for 
Search instead for 
Did you mean: 

Questions about CMSIS v2 Queue

jessie_chiu
Associate III

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);
}

 

3 REPLIES 3
STea
ST Employee

Hello @jessie_chiu ,

can you please specify the STM32 product as well as your IDE. to further help you with your request.

if you are using CubeIDE you can visualize task queues messages in debug mode windows>show view >others>FreeRTOS some modification in the project and the debug configuration are needed and they are described in detail in this YouTube tutorial.

BR

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi @STea ,

Thank you for your reply.


Here is my configuration:

  • Dev Board: STM32U5A9J-DK (ST-Link v3 on board)
  • IDE: STM32 Cube, version: 1.15.0

According to the video, at about 7:40 it mentions how to check the status of the queue, but not how to check the data stored in the queue.

Is there another way to check?

Remove the delay from the callback - it accomplishes nothing.

Consider that you're passing a pointer to osMessageQueuePut() relative to how the queue is created.