lpc3131 Context switch issue

FreeRTOS 7.5.3 NXP lpc3131 Apologies if this is a known problem and I haven’t dug in far enough. I have a board modeled on the ea3131 but running with a slightly different XTAL. The board normally runs with some non-RTOS code but I want to play with the uIP stack on it and hence am trying to get FreeRTOS running. If I have a single task created and start the scheduler all seems well. The task runs, I get print out on the serial port, xTickCount increments nicely, LEDs seem to flash at the correct rate. However, if I create two tasks before starting the scheduler, I get xTickCount = 1 and end up in vApplicationStackOverflowHook. Looking at the stacks, they don’t appear corrupted or too large. There appears to be something wrong in how the interrupts handle the context switching. Has anyone seen anything like this before? I’m running in Preemptive mode.

lpc3131 Context switch issue

In the scenario where you are able to successfully have one task running – what priority is the task? If it is the idle priority (0) then does the idle task run too? If you are creating the task above the idle priority then try running it at the idle priority – you will then effectively have two tasks running that should time slice. Does that work? Regards.

lpc3131 Context switch issue

So this ended up being a bad processor that eventually failed, forcing me onto another development board that works fine! So I’m now running multiple tasks but I do have a question about system and supervisor mode. Before turning on the scheduler, I’m in supervisor mode and calls to the NXP supplied gpio routines work and cause an LED to flash. Tasks run in system mode and I have a task which does the same gpio call as in supervisor mode but the LED does not flash. I don’t get any unprivileged traps, all of the tasks run. System mode is a privileged mode so why doesn’t the call work?

lpc3131 Context switch issue

Other than the stack used, there is little difference between System mode and Supervisor mode, so I doubt that is the cause of the change in behaviour. Can you step through the LED toggle function to see what happens? Regards.