cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F205 CAN Filter Master Register - CAN2 start bank ignored

breitwieser
Associate II
Posted on July 21, 2016 at 13:55

Hi,

I use CAN1 peripheral and I accidentally set CAN2SB in CAN_FMR to 0. Referring to the note in the datasheet all filters should therefore be assigned to CAN2. If I activate a 16-Bit filter (ID List), the interrupts is generated anyway... CAN2 is not activated. How is that possible? I already checked the registers, CAN2SB actually is set to 0. Following code snipped is used for filter initializing (STM32CubeF2 is used):


CAN_FilterInitStructure.FilterNumber = 0;

CAN_FilterInitStructure.FilterMode = CAN_FILTERMODE_IDLIST;

CAN_FilterInitStructure.FilterScale = CAN_FILTERSCALE_16BIT; 

CAN_FilterInitStructure.FilterIdHigh = (SOME_ID) << 5;

CAN_FilterInitStructure.FilterIdLow = 0;

CAN_FilterInitStructure.FilterMaskIdHigh = 0;

CAN_FilterInitStructure.FilterMaskIdLow = 0;

CAN_FilterInitStructure.FilterFIFOAssignment = 0; 
// Messages go into FIFO0

CAN_FilterInitStructure.FilterActivation = ENABLE; 

CAN_FilterInitStructure.BankNumber = 0;


// Set Filter

HAL_CAN_ConfigFilter(hcan, &CAN_FilterInitStructure);

Another interesting thing is, if I use CAN2, I can't receive any messages, but transmission works fine. For that I set CAN2SB to 14 and configured Filter-Number .. CAN1 clock is activated. #can #stm32f2 #stm32f205 #can2
1 REPLY 1
Walid FTITI_O
Senior II
Posted on July 22, 2016 at 16:51

Hi WernerPrbk,

You have to enable also CAN1 clock.

As mentionned in reference manual RM0090, “Dual CAN�? part ( page 1069) :

''- CAN1: Master bxCAN for managing the communication between a Slave

bxCAN and the 512-byte SRAM memory.

-CAN2: Slave bxCAN, with no direct access to the SRAM memory.''

Hence when using CAN2 it's obligatory to enable the Clock of CAN1 accordingly.

Try to use filter 14 for CAN2.

-Hannibal-

Hi,

I use CAN1 peripheral and I accidentally set CAN2SB in CAN_FMR to 0. Referring to the note in the datasheet all filters should therefore be assigned to CAN2. If I activate a 16-Bit filter (ID List), the interrupts is generated anyway... CAN2 is not activated. How is that possible? I already checked the registers, CAN2SB actually is set to 0. Following code snipped is used for filter initializing (STM32CubeF2 is used):


CAN_FilterInitStructure.FilterNumber = 0;

CAN_FilterInitStructure.FilterMode = CAN_FILTERMODE_IDLIST;

CAN_FilterInitStructure.FilterScale = CAN_FILTERSCALE_16BIT; 

CAN_FilterInitStructure.FilterIdHigh = (SOME_ID) << 5;

CAN_FilterInitStructure.FilterIdLow = 0;

CAN_FilterInitStructure.FilterMaskIdHigh = 0;

CAN_FilterInitStructure.FilterMaskIdLow = 0;

CAN_FilterInitStructure.FilterFIFOAssignment = 0; 
// Messages go into FIFO0

CAN_FilterInitStructure.FilterActivation = ENABLE; 

CAN_FilterInitStructure.BankNumber = 0;


// Set Filter

HAL_CAN_ConfigFilter(hcan, &CAN_FilterInitStructure);

Another interesting thing is, if I use CAN2, I can't receive any messages, but transmission works fine. For that I set CAN2SB to 14 and configured Filter-Number .. CAN1 clock is activated.