cancel
Showing results for 
Search instead for 
Did you mean: 

Tasks running on STM32WB

Ofer
Associate III

Hi

I try to use task on the STM32WB5MMG mcu.

My task check if a queue is not empty, if not empty then copy the item on its top and send its message by the BLE. The task handler is:

void ble_tx_messages_queue_handler_task()

{

queue_element *element;

CircularQueue_Init( &usb_sub_packets_queue , queue_buffer , QUEUE_SIZE , sizeof(queue_element) , CIRCULAR_QUEUE_NO_FLAG );

while(1)

{

if( CircularQueue_Empty(&usb_sub_packets_queue) == FALSE )

{

element = (queue_element *)CircularQueue_Sense( &usb_sub_packets_queue , (uint16_t *)sizeof(queue_element) );

CircularQueue_Remove( &usb_sub_packets_queue , (uint16_t *)sizeof(queue_element) );

TxNotification.Custom_Evt_Opcode = CUSTOM_STM_USB_TO_BLE_READ_EVT;

TxNotification.DataTransfered.Length=SizeUsb_To_Ble=element->data_length;

TxNotification.DataTransfered.pPayload=element->data_pointer;

Custom_STM_App_Notification(&TxNotification);

}

}

}

when this endless loop is running the BLE does not receive nor transmit data, what can be wrong with it ?

2 REPLIES 2
hs2
Senior

If this task has a higher prio than the other task the task has no chance to run. Usually a task should wait in a blocking call for something to do to give up the CPU while there is nothing to do. If it has the same prio as the task filling the queue then the scheduler alternatively schedules both tasks with every systick to share the CPU in a fair way.

Why not using an OS queue the task could blocking wait for ?

Ofer
Associate III

Thanks hs2

I found the problem - the os of the ble is not a real operation system, while(1) in one task stuck other tasks.