I'm in the processing of bringing up the dsPIC DSC start kit and I think I have all my bases covered, but apparently that isn't the case. I've already trawled through the discussions for any issue related to this, but it hasn't helped. I'm loading a simple build that just blinks an LED periodically. The problem is it looks as if something keeps resetting the processor. I'm clearing the watchdog, but it doesn't seem to have any effect.
Could someone give this a look and tell me where I might be going wrong. I've successfully implemented FreeRTOS on NiosII, so I'm not a newbie at this.
~~~~
/* Co-routine definitions. */
/* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */
// FBS
// FSS
// FGS
// FOSCSEL
// FOSC
// FWDT
// FPOR
// FICD
//------------------------------------------------------------------------- LED *LEDInit (SYSINTt period, SYSINTt settaskpriority, SYSINTt clrtask_priority) { //------------------------------------------------------------------------- // allocate led space LED *pLED = (LED *)(pvPortMalloc (sizeof(LED)));
// exit if space couldn't be allocated if (pLED == NULL) return NULL;
// initialize yellow led port pin PORTBITTRI(C,13) = 0; PORTBITLAT(C,13) = 0;
// initialize red led port pin PORTBITTRI(C,14) = 0; PORTBITLAT(C,14) = 0;
// initialize green led port pin PORTBITTRI(C,15) = 0; PORTBITLAT(C,15) = 0;
// set heart beat period LEDHEARTBEATPERIOD = period;
// allocate led messeging queue, start task if queue space allocated LEDQUEUE = xQueueCreate (32, sizeof(LEDMSG)); if (LEDQUEUE != NULL) { // led gateway clear control task xTaskCreate ( LEDClrTask, "LedClear", 32, (void *)pLED, clrtask_priority, NULL); }
return pLED; }
//------------------------------------------------------------------------- static void LEDClrTask (void *pvParam) { //------------------------------------------------------------------------- //LED *pLED = (LED *)pvParam; U32 idx; portTickType xLastWakeTime;
// get initial wake count, next hearbeat time xLastWakeTime = xTaskGetTickCount (); //xHeartBeatTime = xLastWakeTime + (portTickType)LEDHEARTBEATPERIOD;
// task loop for (;;) {
// wait 100 ticks
vTaskDelay (100);
// clear watchdog timer
ClrWdt();
PORT_BIT_LAT(C,15) = ~PORT_BIT_LAT(C,15); // toggle pin (amber LED on demo board DM330011)
// wait 100 ticks
vTaskDelay (100);
// clear watchdog timer
ClrWdt();
PORT_BIT_LAT(C,15) = ~PORT_BIT_LAT(C,15);
vTaskDelayUntil (&xLastWakeTime, 300);
// clear watchdog timer
ClrWdt();
}
// delete task when complete vTaskDelete(NULL); } ~~~~
Have you tried turning the watchdog off altogether? Do you have configASSERT() defined? Is configCHECKFORSTACK_OVERFLOW set to 2?
Thank you for the prompt response.
I think I turned off the watchdog based on the #pragma config settings, but I'm no so sure it's working. I think the watchdog can't be turned off. It can only be reset, based on what I've read from the data sheets. Don't take that as truth. I've not completely read it all yet. This is my first time dealing with this particular processor, so I'm still learning all the quirks and issues.
I have not tried configASSERT() yet. Haven't configured for overflow check either. I'll enable them and see what happens. I've run it through the hardware debugger. That's how I discovered the resetting problem.
I figured out my problem. I wasn't allocating enough stack space to task, so I was overflowing into who knows where.
I said so... to your first post...
this is the cost common cause for that, 100% for me ;-)
Alain
On 18-02-2016 20:17, Loi Tran wrote: > > I figured out my problem. I wasn't allocating enough stack space to > task, so I was overflowing into who knows where. > > ------------------------------------------------------------------------ > > dspic33 - keeps rebooting > https://sourceforge.net/p/freertos/discussion/382005/thread/68f88dde/?limit=25#5d7d > > ------------------------------------------------------------------------ > > Sent from sourceforge.net because you indicated interest in > https://sourceforge.net/p/freertos/discussion/382005/ > > To unsubscribe from further messages, please visit > https://sourceforge.net/auth/subscriptions/ >