For some reason I can't get around a USB problem. I've cloned the example where LEDs on the S5D9 board are selectively toggled using the host keyboard input and results sent back to terminal emulator.Basically this code works like:while (1) / read USB / switch on received byte / execute code under switch optionAnd that works fine. The problem occurs when I try to add another thread. If the read-usb thread has a higher priority then the new-thread never executes, presumably because the while(1) loop. Adding a thread_sleep at the end didn't help (Q: does thread_sleep allow lower priority threads to fire off?). If I make new-thread a higher priority, then it tends to operate most of the time and read-usb thread doesn't run.
I tried to fix this by adding a timer and putting the read-usb code in a callback routine, but then the read-usb only occurs if it runs at the same time an input byte appears (basically if I hold down the key on keyboard).What I'm trying to achieve here is to check the USB 2 to 4 times per second and otherwise monitor other inputs and send messages over USB as needed, or ideally run an interrupt when a minimum number of bytes are received (not just when there are incoming bytes). Perhaps I'm missing some subtlety regarding threading and/or USB... anyway, ideas appreciated on this problem.
In reply to adboc:
In reply to cam:
You can use RTOS Resource tab to verify run counts of each thread.
To enable this tab, please suspend the application and select Renesas Views > Partner OS > RTOS Resources. Confirm you use ThreadX and resume the application. Next time you suspend the app it will show filled tables.