STM32L4xxx and RTOSv1/. Sending two signals from one ISR at the same time, to the same thread, results in abnormal behavior.

Using uVision v5.27.1.0 (RTOS 1) with STM32L4xxx. In an ISR two different signals are sent to the same thread like below:

.

.

osSignalSet(myTask, SIGNAL_1);

osSignalSet(myTask, SIGNAL_2);

.

 

In the waiting task myTask, the following code is executed:

for (;;) {

  osEvent evt = osSignalWait(0, osWaitForever);

  u32 signals = evt.value.signals;

.

.

The "signals " will NOT contain SIGNAL_2. Only SIGNAL_1. In other words, the waiting task will wake up on the first of the two signals, even though both of them were posted in the same ISR at the same time.

 I think it is a bug .

The work around would be, in general case, to add the following code to code above:

evt = osSignalWait(0, 0);

signals |= evt.value.signals;

 

Now both SIGNAL_1 and SIGNAL_2 are consumed, and are in the variable "signals " .

 

Cheers! 

More questions in this forum