Other Parts Discussed in Thread: SYSCONFIG, C2000WARE
Hi,
I'm using a MCU063B version of the Control Card for the F28388D. I'm also using C2000Ware 5.00.00.00, SysConfig and FreeRTOS in my project.
I have 2 different issues:
1) Since some days, when in CPU1 I add a breakpoint in any function of my tasks after FreeRTOS initialization, if I go on with Continue (F8), the system remains halted in that position. I need to mke a step into/over and then resume to go on normally. Before FreeRTOS_init(), that is the last function called in my Main, the breakpoint behaviour is correct, then it changes in the way I described. Can you help me understand why and how to fix it?
2) The second one is a very weird behaviour, maybe linked to the previous one because some days ago I did not have it. I have 3 tasks running at the same priority: 1 for high level algorithm (Application), one for low level drivers (LowLevelManager) and another one is just a blinking led (LED1_Task).
In the Application task:
{ TickType_t xLastWakeTime; BaseType_t xWasDelayed = pdTRUE; uint16_t lastIoId = 0; uint16_t lastE2pId = 0; uint16_t lastRtcId = 0; uint16_t lastDb1Id = 0; uint16_t lastDb2Id = 0; // uint16_t lastSdId = 0; uint16_t lastCMId = 0; MCU2to1_Data_t mcu2to1Data_Rx; uint16_t currentID = 0; // Initialize the xLastWakeTime variable with the current time. xLastWakeTime = xTaskGetTickCount(); //Application level initialization function Application_initialize(); while(1) { //Step to be called every cycle (0.01ms) // if(xWasDelayed == pdTRUE){ Application_step(); currentID++; SendCmdToDriver(E2P_Msg_Queue, ( void * ) &rtY.E2P_Msg_out, rtY.E2P_Msg_out.id, &lastE2pId); SendCmdToDriver(IO_Msg_Queue, ( void * ) &rtY.IO_Msg_out, rtY.IO_Msg_out.id, &lastIoId); // SendCmdToDriver(RTC_Msg_Queue, ( void * ) &rtY.RTC_Msg_out, rtY.RTC_Msg_out.id, &lastRtcId); // SendCmdToDriver(DB1_Msg_Queue, ( void * ) &rtY.DB1_Msg_out, rtY.DB1_Msg_out.id, &lastDb1Id); // SendCmdToDriver(DB2_Msg_Queue, ( void * ) &rtY.DB2_Msg_out, rtY.DB2_Msg_out.id, &lastDb2Id); // SendCmdToDriver(SD_Msg_Queue, ( void * ) &rtY.SD_Msg_out, rtY.SD_Msg_out.id, &lastSdId); sendCmdToCM(rtY.CPU1toCM_Msg_out.cmd, rtY.CPU1toCM_Msg_out.id, &lastCMId); memcpy(&mcu2to1Data_Rx,spiARxDataBuff,MCU2_TO_1_DATASIZE); //wait for the next cycle: 10ms xWasDelayed=xTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS(10)); // }else{ // //overrun occurred: to understand what to do... // ESTOP0; // } xTaskAbortDelay(Application_TaskHandle); } }
when SendCmdToDriver(IO_Msg_Queue, ( void * ) &rtY.IO_Msg_out, rtY.IO_Msg_out.id, &lastIoId); is called, that is:
void SendCmdToDriver(QueueHandle_t Msg_Queue, void *msg_out, uint16_t currentId, uint16_t *lastId){ //send to driver queue if new command has been generated if(currentId != *lastId){ *lastId = currentId; if( Msg_Queue != 0 ) { // Send a msg. Wait for 100 ticks for space to become // available if necessary. if( xQueueSend( Msg_Queue, msg_out, ( TickType_t ) 100 ) != pdPASS ) { // Failed to post the message, even after 100 ticks. ESTOP0; } } } }
where rtY is declared in another file Application.h:
extern ExtY rtY;
and ExtY is a quite big custom data type.
typedef struct { E2P_c28_Msg_t E2P_Msg_out; /* '<Root>/E2P_Msg_out' */ IO_Msg_t IO_Msg_out; /* '<Root>/IO_Msg_out' */ RTC_Msg_t RTC_Msg_out; /* '<Root>/RTC_Msg_out' */ MCU2to1_Data_t MCU2to1_Data_out; /* '<Root>/MCU2to1_Data_out' */ CPU1toCM_Msg_t CPU1toCM_Msg_out; /* '<Root>/CPU1toCM_Msg_out' */ DB_Msg_t DB1_Msg_out; /* '<Root>/DB1_Msg_out' */ DB_Msg_t DB2_Msg_out; /* '<Root>/DB2_Msg_out' */ } ExtY;
It happens that rtY.IO_Msg_out.id is correctly incremented in Application_step(), but in SendCmdToDriver(...) it arrives always 0.
I also tried to assign it to a variable and then pass it to the function:
currentID = rtY.IO_Msg_out.id;
SendCmdToDriver(IO_Msg_Queue, ( void * ) &rtY.IO_Msg_out, currentID, &lastIoId);
but also currentID always remain 0 and it does not work.
I played with compiling optimization and Speed vs. size trade off, thinking to compiling problems, also because I was executing in RAM near to full usage, but with no success. Passing to execution in FLASH, the same behaviour. Any idea/help?
Thanks and best regards,
Fabio