Im using STM32F407 Discovery board and HAL library in CAN bus(CAN1) Some receive interrupts used with callbacks (for example receive interruptCAN_IT_RX_FIFO0_MSG_PENDING can be used HAL_CAN_RX_FIFO0_MSG_PENDING_CALLBACK_CB_ID. CAN_IT_RX_FIFO0_FULL can be used HAL_CAN_RX_FIFO0_FULL_CALLBACK_CB_ID)

1) if i want to trigger callback with this CAN_IT_RX_FIFO0_OVERRUN interrupt. what i need to do? There is no callback function related to this interrupt

2) Can i implement own callback function? Is there a restriction with number of callback functions?

3)When i run the project. the special event occurs (more than 2 Rx message received). Callback is worked. But last if statement didn't work? Why?

uint8_t can1_RxFIFOFullCblk[] = "HAL_CAN_RxFifo0FullCallback\r\n";

void HAL_CAN_RxFifo0FullCallback(CAN_HandleTypeDef *CanHandle)
    TxMessage.RTR = CAN_RTR_DATA;
    TxMessage.IDE = CAN_ID_STD;
    TxMessage.DLC = 4;

    HAL_CAN_GetRxMessage(&hcan1,can1_sRxMailBox,&RxMessage,can1_Received );
    TxMessage.StdId = RxMessage.StdId; //Send received message with received message ID

    HAL_CAN_AddTxMessage(&hcan1, &TxMessage, &can1_Received[0], (uint32_t *)can1_sRxMailBox);

    if(__HAL_CAN_GET_FLAG(&hcan1,CAN_FLAG_FF0) == true) //if RX FIFO 0 Full flag is set
        HAL_UART_Transmit(&huart3, (uint8_t*)&can1_RxFIFOFullCblk, sizeof(can1_RxFIFOFullCblk), 5000);

New contributor
algorist is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

algorist is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.