Why can't I exit the while loop ?

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

cross mob
Anonymous
Not applicable

Hello,

I don't understand why my program doesn't exit the main loop when an Rx interrupt occurs. It's working when I delete the loop.

This is my program :

#include "wiced.h"

#include "sparcommon.h"

#include "wiced_platform.h"

#include "wiced_rtos.h"

#include "wiced_hal_gpio.h"

#include "wiced_bt_trace.h"

#include "wiced_hal_puart.h"

char data;

void puar_rx_interrupt_callback(void* unused)

{

   data = 'b';

}

APPLICATION_START()

{

   

    wiced_hal_puart_init();

    wiced_hal_puart_register_interrupt(puar_rx_interrupt_callback);

    wiced_hal_puart_set_watermark_level(1);

    data='a';

     while(1)

    {

        wiced_hal_puart_write(data);

        wiced_rtos_delay_milliseconds(500,KEEP_THREAD_ACTIVE );

    }

}

Thank you for your help.

0 Likes
1 Solution
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hello,

You should not use while loop in Application start.

Since application is also running on RTOS thread in parallel with other threads, if you use while loop in Application start it will lead to erratic non-deterministic behavior or dead locks.

Regards,

Anjana

View solution in original post

1 Reply
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hello,

You should not use while loop in Application start.

Since application is also running on RTOS thread in parallel with other threads, if you use while loop in Application start it will lead to erratic non-deterministic behavior or dead locks.

Regards,

Anjana