cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F779NI CAN peripheral programming with STM32-MAT/TARGET Simulink blocks

NGupt.2
Associate

Hello, I want to use STM32-MAT/TARGET to generate code for STM32F779NI CAN peripheral in interrupt mode to receive message over CAN bus. CAN IT block is having option only for TX, Rx and ESR interrupt. There is no option on CAN IT block to configure Rx Interrupt for FIFO FULL, FIFO MESSAGE PENDING and FIFO OVERRUN event. I want to call a function only when FIFO is Full.

Can anybody help me over this?

1 REPLY 1
Javier1
Principal

First of all i have no idea of how to use simulink blocks to program stm32

Maybe you can modify the "Automatic "C" code generation for STM32 is based on STM32Cube HAL libraries." to your needs before compiling

with regular handtyped code i would check every RX interrupt for the FIFO state with functions like :

  • HAL_CAN_GetTxMailboxesFreeLevel()
  • HAL_CAN_IsTxMessagePending() or HAL_CAN_GetRxFifoFillLevel()

Or take a look at the callback functions! in your Drivers/STM32xxxHAL_Driver/ folder

/** @addtogroup CAN_Exported_Functions_Group5 Callback functions
 *  @brief    Callback functions
 * @{
 */
/* Callbacks functions ********************************************************/
 
void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_TxMailbox1CompleteCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_TxMailbox2CompleteCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_TxMailbox0AbortCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_TxMailbox1AbortCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_TxMailbox2AbortCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_RxFifo0FullCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_RxFifo1FullCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_SleepCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_WakeUpFromRxMsgCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan);
 
/**
 * @}
 */

we dont need to firmware by ourselves, lets talk