xEventGroupSetBitsFromISR and xEventGroupWaitBits call order

Hi,

I hit a situation that ISR will always call xEventGroupSetBitsFromISR first, and then task call xEventGroupWaitBits, so the task will never be waken up.

So I wonder it is normal ?

is there any method that task can always wake up even the notification has been sent before ?

Thanks

If a task makes a call to wait for a bit that is already set then it should return immediately, without ever blocking.

Also, can you share your code snippets where you set and wait for bits?

if so, that would be weird.

I need check the code for more detail

Thank you so much

Hi rtel,

I checked the code, and still not found any logic errors.

So I changed the type to binary semaphore, and use xSemaphoreTake() & xSemaphoreGiveFromISR(), then it works :slight_smile:

I am not very familiar with FreeRTOS history, is it related with OS version ?

Thanks

Hi aggarg,

Simplify the code flow:

  1. init stage
    event = = xEventGroupCreate()

  2. set
    ISR {

    xEventGroupSetBitsFromISR(event, BITS, NULL);
    }

  3. wait in task
    Task {
    xEventGroupWaitBits(event, BITS, …)
    }

Thanks