Any ideas why a call to _time_delay(100) would result in that task never returning from _time_delay_internal? It looks like it hangs after the call to _sched_execute_scheduler_internal(); at the end of the _time_delay_internal function. This is a task that executed correctly for a random number if iteration before being blocked. I have a One Second Interrupt running at priority 8 - I tried changing to Priority 10 with no luck. My tasks are all FIFO time-sliced at 50mS all at Priority 8. Also, all the task stacks seem to be at reasonable usage levels.
I'm running on K70 using MQX 4.1, and CodeWarrior 10.6.
Thanks,
Louie
Hi,
Could you please share your code in order to reproduce the issue.
Regards
Soledad
Soledad - this is the function that hangs. It hangs in _time_delay_internal, which is called from the _time_delay(100) below. Also following is the interrupt event that runs, which I suspect is playing a role in the lockup:
void MotorDriver::SetDFROpto(bool bEnable)
{
if (bEnable)
{
GPIO_PTF_SetFieldBits(GPIO_PTF_DeviceData, DFR_OPTO_EN, 0x01);
_time_delay(100);
}
else
GPIO_PTF_ClearFieldBits(GPIO_PTF_DeviceData, DFR_OPTO_EN, 0x01);
}
I also had this but removed the mutex to ensure I didn't have a deadlock issue
void MotorDriver::SetDFROpto(bool bEnable)
{
_mutex_lock(m_motorMutexDFR);
if (bEnable)
{
GPIO_PTF_SetFieldBits(GPIO_PTF_DeviceData, DFR_OPTO_EN, 0x01);
_time_delay(100);
}
else
GPIO_PTF_ClearFieldBits(GPIO_PTF_DeviceData, DFR_OPTO_EN, 0x01);
_mutex_unlock(m_motorMutexDFR);
}
//One second interrupt from the FPGA that states the detectors are ready to be read
void OneSec_OnInterrupt(LDD_TUserData *UserDataPtr)
{
void* td_ptr = _task_get_td(ARUBA::det_val_task_id); //MQX Ref Manual p373
if ((td_ptr != NULL))
{
_task_ready(td_ptr); //13 is the DetVal task
}
else
{
dprint("something horrible happened with unblocking the det val task");
}
// Run PIDS periodic task after Detector Value task, since it depends on the
// Detector Values.
// WARNING: Using _task_ready() causes infinite loops in the lwevent_wait() functions
InterruptEventManager::GetInstance()->ISR_EVTCallBackHandler(InterruptEventManager::PIDS_TASK_ENABLE);
}