2022-02-21 07:52 AM
Hello, I'm using stm32F446RE.
Sending CAN messages to two controllers and it stopped working after some seconds if time delay between the messages is less than one second, And it's slow for my project.
looking for suggestions, attaching some of my code:
txHeader.DLC = 4;
txHeader.IDE = CAN_ID_EXT;
txHeader.RTR = CAN_RTR_DATA;
txHeader.TransmitGlobalTime = ENABLE;
HAL_CAN_Start(&hcan1); //Initialize CAN Bus
HAL_CAN_ActivateNotification(&hcan1,CAN_IT_RX_FIFO0_MSG_PENDING);
in loop:
txHeader.ExtId = 0x06D;
if (HAL_CAN_AddTxMessage(&hcan1, &txHeader, stmp, &canMailbox) != HAL_OK) {Error_Handler (); }
HAL_Delay(100);
txHeader.ExtId = 0x057;
if (HAL_CAN_AddTxMessage(&hcan1, &txHeader, stmp, &canMailbox) != HAL_OK){Error_Handler ();}
HAL_Delay (100);
Clock is HSE,@ 84Hz