主题中讨论的其他器件:SysConfig、 C2000WARE
您好!
我使用的是适用于 F28388D 的 MCU063B 版本控制卡。 我还在项目中使用了 C2000Ware 5.00.00.00、SysConfig 和 FreeRTOS。
我有两个不同的问题:
1) 1) 1)有时、在 CPU1中、我在 FreeRTOS 初始化后在我的任务的任何函数中添加一个断点、如果我继续(F8)、系统在该位置保持停止。 我需要移动一步进入/转过来、然后继续正常执行。 在 freertos_init()之前,也就是我的 Main 中调用的最后一个函数之前,断点行为是正确的,然后它 会按照我描述的方式发生变化。 您能帮助我理解为什么以及如何解决它吗?
2)第二个是一个非常奇怪的行为,可能与前一个有关,因为几天前我没有它。 我有3个任务以相同的优先级运行:1个任务用于高级算法(应用)、1个任务用于低电平驱动器(LowLevelManager)、另一个任务只是闪烁的 LED (LED1_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);
}
}
当 Msg_Queue 调用 SendCmdToDriver (IO_IDO、(void *)&rty.io_Msg_out、rty.io_Msg_out.id、&lastIoId)时、即:
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;
}
}
}
}
其中、rty 在另一个文件 Application.h 中声明:
extern ExtY rty;
ExtY 是一个相当大的自定义数据类型。
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;
在 Application_step()中,但在 SendCmdToDriver(...)中,rty.io_Msg_out.id 正确递增 它到达时始终为0。
我还尝试将其分配给变量、然后将其传递给函数:
currentID = rty.io_Msg_out.id;
SendCmdToDriver (IO_IoId Msg_Queue、(void *)&rty.IO_Msg_out、currentID、&lastIoId);
但是、当前 ID 也始终保持为0、并且无法正常工作。
我玩过编译优化和速度与大小的折衷,思考编译问题,也因为我在 RAM 执行接近完全使用,但没有成功。 代码在闪存中传递至执行、具有相同的行为。 有任何想法/帮助吗?
谢谢、此致、
法比奥

