AnsweredAssumed Answered

STM3240G-EVAL / STM32F407 / CAN2 Issue

Question asked by Luc S. on Feb 26, 2015
Latest reply on Mar 2, 2015 by Luc S.
Hello everybody,

I am working with a STM3240G-EVAL card (STM32F407) and I have CAN2 issue, especially the with the reception part. I need help.


I already tested the CAN1 channel and it worked really fine. Then I changed the definitions in order to use the CAN2 channel as followed:


#define CANx                            CAN2          //CAN1
//CAN1 Clock must absolutely be enabled to use CAN2 !!!
#define CANx_CLK_ENABLE()               __HAL_RCC_CAN1_CLK_ENABLE(); __HAL_RCC_CAN2_CLK_ENABLE()
#define CANx_GPIO_CLK_ENABLE()          __HAL_RCC_GPIOB_CLK_ENABLE() //__HAL_RCC_GPIOD_CLK_ENABLE()


#define CANx_FORCE_RESET()              __HAL_RCC_CAN2_FORCE_RESET() //__HAL_RCC_CAN1_FORCE_RESET()
#define CANx_RELEASE_RESET()            __HAL_RCC_CAN2_RELEASE_RESET() //__HAL_RCC_CAN1_RELEASE_RESET()


/* Definition for USARTx Pins */
#define CANx_TX_PIN                    GPIO_PIN_13          //GPIO_PIN_1
#define CANx_TX_GPIO_PORT              GPIOB               //GPIOD
#define CANx_TX_AF                     GPIO_AF9_CAN2     //GPIO_AF9_CAN1
#define CANx_RX_PIN                    GPIO_PIN_5          //GPIO_PIN_0
#define CANx_RX_GPIO_PORT              GPIOB               //GPIOD
#define CANx_RX_AF                     GPIO_AF9_CAN2     //GPIO_AF9_CAN1


/* Definition for USARTx's NVIC */
#define CANx_RX_IRQn                   CAN2_RX0_IRQn     //CAN1_RX0_IRQn
#define CANx_RX_IRQHandler             CAN2_RX0_IRQHandler//CAN1_RX0_IRQHandler


The emission from CAN2 works really fine, but the reception doesn’t. Whatever I send from the other side, the CAN2 Rx buffers stay empty and I don’t have any more ideas.


Does that case already happened with somebody else?

Outcomes