anonymous wrote on Tuesday, May 29, 2012:
I got my system hang, please see my code first:
#define TASK_ACTIVE 0
#if TASK_ACTIVE == 0
...
#else
// I want the program wait here to take a sem, if success, then
// the program continue...
while( xSemaphoreTake ( sem, 200 ) == 0);
#endif
I have checked that the semaphore has never been given, so I expect it wait here with a block time 200, however the whole system just hang.
Then if I add a delay after the take semaphore line, the system can run without problem! like this:
#define TASK_ACTIVE 0
#if TASK_ACTIVE == 0
...
#else
// I want the program wait here to take a sem, if success, then
// the program continue...
while( xSemaphoreTake ( sem, 200 ) == 0);
[b]while(1) { vTaskDelay(500); }[/b]
#endif
I am really confused……anybody can give me advise? Thank you very much.