Due to frustration I reduced my code down to two threads on the RTOS, each meant to turn on indivudual LEDs.
However, it seems that the LPC11u24 only runs the thread which is declared first, for example the code order:
Thread thread3(threadA);
Thread thread2(threadB);
would result in threadA running but threadB not running (debugging using LEDs)
but
Thread thread3(threadB);
Thread thread2(threadA);
would result in threadB running and threadA not running!!!
Note that the "main" thread the while loop runs OK no matter what...
I have tried adding in wait() statements, but to no avail, anyone else had this problem? Anyone know how to fix it?
Looks like a bug to me...
Thanks for the help...
full code
#include "mbed.h"
#include "rtos.h"
DigitalOut led_a(P1_23);
DigitalOut led_b(P1_28);
DigitalOut led_c(P0_16);
void threadA(void const *args)
{
while (true)
{
led_b=1;
}
}
void threadB(void const *args)
{
while (true)
{
led_a=1;
}
}
int main()
{
// INITIALISE RTOS THREADS //
Thread thread3(threadA);
Thread thread2(threadB);
// END INITIALISE RTOS THREADS //
while(1)
{
led_c=1;
}
}
Due to frustration I reduced my code down to two threads on the RTOS, each meant to turn on indivudual LEDs. However, it seems that the LPC11u24 only runs the thread which is declared first, for example the code order:
would result in threadA running but threadB not running (debugging using LEDs)
but
would result in threadB running and threadA not running!!!
Note that the "main" thread the while loop runs OK no matter what... I have tried adding in wait() statements, but to no avail, anyone else had this problem? Anyone know how to fix it? Looks like a bug to me... Thanks for the help...
full code