# Revision history [back]

### Context Switch in Arduino Due

The FW in ArduinoDue platform starts from AJ_PrintFWVersion() ->AJ_Network_Up()-> AJ_WSL_DriverStart(). At this time, the main task creates another task,AJ_WSL_MBoxListenAndProcessTask. There should be somewhere doing context-switch to switch to AJ_WSL_MBoxListenAndProcess Task.
Where is the part doing context switch ?
In my platform, I implement a timer and make the context-switch function in that timer so that the task will do context switch when the timer times up.
I find this behavior may cause something wrong in the later part of AllJoyn. But I can't find out where the actual context-switch part in the ArduinoDue platform. However, the FW won't go on after creating the AJ_WSL_MBoxListenAndProcessTask because of polling a variable which should be set in the AJ_WSL_MBoxListenAndProcessTask If I don't do context-switch in the timer.

### Context Switch in Arduino Due

 The FW in ArduinoDue platform starts from AJ_PrintFWVersion() ->AJ_Network_Up()-> ->AJ_Network_Up() to AJ_WSL_DriverStart(). At this time, function, the main task creates another task,AJ_WSL_MBoxListenAndProcessTask. There should be somewhere doing context-switch to and the FW will switch to AJ_WSL_MBoxListenAndProcess Task. Task.If not, the main task should stuck in the while loop to wait the variable which should be set by AJ_WSL_MBoxListenAndProcessTask after creating the task. Because the two task has the same priority ,the FW won't do context-switch after creating the AJ_WSL_MBoxListenAndProcessTask. But I can't find out Where is the part doing context switch ?is ?<br>     In my platform, I implement a timer and make the context-switch function in that timer so that the task will do context switch when every time the timer times up. up. But I find this behavior may cause something wrong in the later part of AllJoyn. But So,it may be wrong to use a timer to implement the context-switch. I can't find out where want to know how the actual Due platform implement the context-switch part in the ArduinoDue platform. However, the FW won't go on after creating the AJ_WSL_MBoxListenAndProcessTask because of polling a variable which should be set in the AJ_WSL_MBoxListenAndProcessTask If so that I don't do context-switch in the timer. may fix my bug. Thank you!!


### Context Switch in Arduino Due

  The FW in ArduinoDue platform starts from AJ_PrintFWVersion() ->AJ_Network_Up() to AJ_WSL_DriverStart(). At this function, the main task creates another task,AJ_WSL_MBoxListenAndProcessTask. There should be somewhere doing context-switch and the FW will switch to AJ_WSL_MBoxListenAndProcess Task.If not, the main task should stuck in the while loop to wait the variable which should be set by AJ_WSL_MBoxListenAndProcessTask after creating the task. Because the two task has the same priority ,the FW won't do context-switch after creating the AJ_WSL_MBoxListenAndProcessTask. But I can't find out Where the part doing context switch is ?<br>     In my platform, I implement a timer and make the context-switch function in that timer so that the task will do context switch every time the timer times up. But I find this behavior may cause something wrong in the later part of AllJoyn. So,it may be wrong to use a timer to implement the context-switch. I want Could you help me to know how the Due platform implement the context-switch so that I may fix my bug. Thank you!!