Hi all,
I am using the MCBSTR9 board and I am running the RTX OS with two concurrent tasks. All is well but after it runs for awhile, it stops. When I break in, it sits in the OS idle loop. Have anyone experience this before? It does not crash but it somehow stopped running the two tasks that was initially running. The stop time is intermediate. It can run up to 30 minutes or as short as 5 minutes.
Any ideas?
Thanks, Tom
Are the two threads waiting for any resource that isn't available?
There is a mutex between these two threads. One thread handles USB commands from the PC. The other is constantly constantly using the I2C peripheral for writing/reading from devices. Once there's a USB command to retrieve something from the device via I2C, it stops the other thread (at an appropriate place) and continues to perform I2C commands until it's done. Upon completion, it releases the mutex and the other task continues. I have tested it without connecting the USB to the PC, and it is the same result.
So they are sharing a mutex, but you get a lockup even if neither of the threads takes this mutex?
Is your timer tick still running?
Are you able to use a JTAG interface to check the current state of the two tasks?
How is the USB task stopping the I2C task?
You cannot acquire a Mutex in 1 task and release it in a different 1. From the brief definition, it almost sounds like that is what you are trying to do.
Actually, I use 2 mutex to complete this process. I set a flag in the USB task and once the other process see that this flag is set, it will release the mutex1. Meanwhile, the USB task will see that mutex1 is released, it will process the USB command. In the other task, it waits for mutex 2 to be release by the USB task after it completes. Therefore, the other task will not continue until mutex2 is signaled in the USB task. Hopefully, that didn't sound too confusing.
View all questions in Keil forum