This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
mcan功能受到影響
我參考了範例程式碼(SDK_05_04_00_01-mcan_external_read_write)並修改了我們需要的部分。我也連接了ECU模擬器,並獲得了正常的回覆數據。
但我將其添加到範例程式碼(SDK_05_04_00_01-gesture_recognition)中。毫米波感測器啟動後mcan無法正常運作。收到的數據沒有變化。如果未啟用毫米波感測器,則 mcan 正常運作。兩者之間有什麼關聯嗎?
main.c 中只建立了一個 mcan 任務
在 mmw_cli.c 檔案中備註 CLI_MMWStart(); mcan功能正常。
以下是新增的程式碼部分:
==================================
void Create_mcan_task(void *args)
{
// RPMF: Create a Task for mcan Framework
gMCANTask = xTaskCreateStatic(MCAN_Task, /* Pointer to the function that implements the task. */
"mcan_task", /* Text name for the task. This is to facilitate debugging only. */
MCAN_TASK_SIZE, /* Stack depth in units of StackType_t typically uint32_t on 32b CPUs */
NULL, /* We are not using the task parameter. */
MCAN_TASK_PRI, /* task priority, 0 is lowest priority, configMAX_PRIORITIES-1 is highest */
gMCANTaskStack, /* pointer to stack base */
&gMCANTaskObj); /* pointer to statically allocated task object memory */
configASSERT(gMCANTask != NULL);
}
void MCAN_Task(void *args)
{
int32_t status = SystemP_SUCCESS;
HwiP_Params hwiPrms;
MCAN_RxBufElement rxMsg;
MCAN_RxNewDataStatus newDataStatus;
MCAN_ErrCntStatus errCounter;
uint32_t bufNum, fifoNum;
DebugP_log("[MCAN] External read - write test, application started ...\r\n");
/* Construct Tx/Rx Semaphore objects */
status = SemaphoreP_constructBinary(&gMcanTxDoneSem, 0);
DebugP_assert(SystemP_SUCCESS == status);
status = SemaphoreP_constructBinary(&gMcanRxDoneSem, 0);
DebugP_assert(SystemP_SUCCESS == status);
/* Register interrupt */
HwiP_Params_init(&hwiPrms);
hwiPrms.intNum = APP_MCAN_INTR_NUM;
hwiPrms.callback = &App_mcanIntrISR;
status = HwiP_construct(&gMcanHwiObject, &hwiPrms);
DebugP_assert(status == SystemP_SUCCESS);
/* Assign MCAN instance address */
gMcanBaseAddr = (uint32_t) AddrTranslateP_getLocalAddr(APP_MCAN_BASE_ADDR);
/* Configure MCAN module, Enable External LoopBack Mode */
App_mcanConfig(APP_MCAN_LOOPBACK_MODE_DISABLE);
/* Enable Interrupts */
App_mcanEnableIntr();
while (true)
{
vTaskDelay(500 / portTICK_PERIOD_MS); // Block for 500ms.
SendMCAN_cmd();
//DebugP_log("[MCAN] Wait for Rx completion ... \r\n");
/* Wait for Rx completion */
SemaphoreP_pend(&gMcanRxDoneSem, SystemP_WAIT_FOREVER);
/* Checking for Rx Errors */
MCAN_getErrCounters(gMcanBaseAddr, &errCounter);
DebugP_assert((0U == errCounter.recErrCnt) &&
(0U == errCounter.canErrLogCnt));
/* Get the new data staus, indicates buffer num which received message */
MCAN_getNewDataStatus(gMcanBaseAddr, &newDataStatus);
MCAN_clearNewDataStatus(gMcanBaseAddr, &newDataStatus);
/* Select buffer and fifo number, Buffer is used in this app */
bufNum = 0U;
fifoNum = MCAN_RX_FIFO_NUM_0;
MCAN_readMsgRam(gMcanBaseAddr, MCAN_MEM_TYPE_FIFO, bufNum, fifoNum, &rxMsg);
MCAN_writeRxFIFOAck(gMcanBaseAddr, fifoNum, 0);
//DebugP_log("[MCAN] Check Rx data ... \r\n");
/* Check Rx data */
App_mcanCheckRxMsg(&rxMsg);
}
/* De-Construct Tx/Rx Semaphore objects */
HwiP_destruct(&gMcanHwiObject);
SemaphoreP_destruct(&gMcanTxDoneSem);
SemaphoreP_destruct(&gMcanRxDoneSem);
return;
}
=================================================
上面的圖片是抓下來的 TX & RX 數據
在mmw_cli.c檔案中,如果不執行CLI_MMWStart(),mcan將正常運作。
檢查上述邏輯分析儀訊號。當RX有資料時,TX不拉低電位,為什麼會出現ACK錯誤?
正常波形:
異常波形:
主要是因為CAN TX沒有ACK!謝謝!
你好,
已经有很多客户实现CAN+毫米波功能。你能否再debug一下,在CLI_MMWStart();里哪个命令影响了CAN?adclogging你没有使能吧?EVM上的开关在测试中没有变化吧?
Thanks,
Chris
adclogging=0;沒有設定
debug結果跟這段程式碼有關西,但這一段程式碼也不能拿掉!會影響毫米波功能,不知為何會影響CAN的硬體?
void powerManagementTask(void *args)
====================================================
// Get the Frame Periodicity
frmPrdus = (gMmwMssMCB.frameCfg.w_FramePeriodicity * 0.025);
// Time for Low Power State
slpTimeus = (unsigned long long)(frmPrdus - demoTimeus);
if (gMmwMssMCB.lowPowerMode == LOW_PWR_MODE_ENABLE)
{
// RPMF driver call for getting to Low Power State
//Power_idleFunc(slpTimeus);
Power_disablePolicy();
demoLowPwrStateTaken = Power_getLowPowModeTaken();
if (demoLowPwrStateTaken == POWER_NONE)
{
// Use Low Power config only when there is sufficient time.
CLI_write("Error: No Sufficient Time for getting into Low Power Modes.\n");
DebugP_assert(0);
}
}
if (gMmwMssMCB.lowPowerMode == LOW_PWR_TEST_MODE)
{
/* Wait till the frame period expires */
uint64_t frmPeriod = (uint32_t)(frmPrdus * 32.768e-3);
while ((gMmwMssMCB.frameStartTimeStampSlowClk + frmPeriod) > PRCMSlowClkCtrGet())
{
}
power_LPDSresumehook();
}
關閉low power mode,CAN BUS運作正常了! 不能在low power mode下使用CAN嗎?
但毫米波功能及can bus運作幾次後,毫米波就沒動作了!
我發現使用範例程式碼(SDK_05_04_00_01-gesture_recognition),未修改任何程式碼,
載入config後,關閉low power mode,毫米波偵測到物體就沒動作了!
所以不能關閉low power mode!
你好,
low power mode =1,代码在处理完后就进入低功耗模式了,你的应用是需要一直接收CAN数据么?
powerManagementTask会估计算法处理时间,然后估计算法处理结束后就进入低功耗了。
下面的信息请参考:
https://dev.ti.com/tirex/explore/node?node=A__AKZl2I1OiS5ssBNGpidsCQ__radar_toolbox__1AslXXD__LATEST
Thanks,
Chris