how can quick sync ISR->Thread

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,all

I create a thread ,

wait Semaphores from ISR

I need a very quick to wakeup Thread (maybe < 100us)

but now, I measuring the GPIO (between GPIO_38 ,GPIO_36) is always a  ~1ms

so how can I quick to wakeup thread ???

void IRQHandler(void)

{

  wiced_gpio_output_high(WICED_GPIO_38);

  wiced_rtos_set_semaphore(&sem);

  wiced_gpio_output_low(WICED_GPIO_38);

}

static wiced_thread_function_t isr_thread_main(void *ptr)

{

    while(1)

    {

        wiced_rtos_get_semaphore(&sem,0xffffffff);

       wiced_gpio_output_high(WICED_GPIO_36);

        Process();

       wiced_gpio_output_low(WICED_GPIO_36);

     }

}

0 Likes
2 Replies
Anonymous
Not applicable

Hi,

What is the priority of your thread? try to see which thread is grabbing the processor after your interrupt and you need to set priority of your thread higher than this. Offcourse  you have to be carefull not to get too swaped in this thread and hang other main threads like the network thread.

Another Idea is to split your work, do only the urgent part in the IRQ handler (should be short though), and defer what can be delayed to a later no time critical thread.

Regards,

Bassem

0 Likes
Anonymous
Not applicable

Hi,Bassem

priority is 0


it should be highest?


    wiced_rtos_create_thread(&irq_thread, \

                                      0 ,\

                            "IRQ Process",\

                            &isr_thread_main,

                            8192,NULL);

0 Likes