Hello,
I am looking into the initialization of the canFD module using the mmWave drivers. This code appears to work on all devices, but fails some of the time causing the device to appear locked up. I have done some debugging which narrowed it down to the CANFD_init() function. In the real application, I have serial printouts to use for debug statements and have narrowed it down to this section of code:
CLI_write("queue rx end %x\n", &canMessages[NUM_CAN_RX_MESSAGES-1].queue); MCANAppInitParams (&mcanCfgParams); /* Initialize the CANFD driver */ CLI_write("queueMCAN\n"); canHandle = CANFD_init(&mcanCfgParams, &errCode); if (canHandle == NULL) { CLI_write ("Error: CANFD Module Initialization failed [Error code %d]\n", errCode); return -1; } CLI_write("queue2\n");
The outcome 9 out of 10 times everything works. One out of 10 times I see the final serial printout as "queueMCAN" and then the device does not function which implies to me it goes into CANFD_init() and never returns. I dug in there and found multiple of these potentially inifinite do while loops that I attempted to solve the TODO with a quick counter:
MCAN_reset(baseAddr); /* Wait while MCAN is in reset. TODO add timeout */ counter = 0; //USER CODE TO ATTEMPT TO KICK US OUT do { counter++; //USER CODE TO ATTEMPT TO KICK US OUT if (counter > 10000) { //USER CODE TO ATTEMPT TO KICK US OUT *errCode = 35; //USER CODE TO PROVIDE A REASON return (CANFD_Handle)NULL; //USER CODE TO ATTEMPT TO KICK US OUT } } while (MCAN_isInReset(baseAddr) == 1U);
The result was no difference. I could not kick myself out of the function to the next serial print. Perhaps something else in this init function calls a loop or is lockign up somewhere. Also, when running a debug operation where I just load symbols in and cannot replicate the failure. I have to power cycle the device to create this issue. I am still trying to dig through it to see if there is a cause for the process hanging, but figured I should post it on here as well for some parallel support.
Thanks!