cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F767ZI CAN filer/banks configuration for 3 cans

sabina greenberg
Associate

Dear support,

We use 3 cans in STM32F767ZI board and have some problems with filter & banks configurations.

We use FilterScale = CAN_FILTERSCALE_32BIT and CAN_ID_EXT for transmit/receive data. We would like to receive data by the following way: CAN1 should receive all data with bits[9-12]=0001, CAN2 should receive all data with bits[9-12]=0002, CAN3 should receive all data with bits[9-12]=0003.

we set:

filter_id1 = 0x00000200;

filter_id2 = 0x00000400 ;

filter_id3 = 0x00000600;

filter_mask1 = 0x00000200;

filter_mask2 = 0x00000400;

filter_mask3 = 0x00000600; 

but these setting don't work properly. Could you pls help to understand what it is a problem here.

And another question about banks. we use :

can1: sFilterConfigCan1.FilterBank = 0, sFilterConfigCan1.SlaveStartFilterBank = 14;

can2: sFilterConfigCan1.FilterBank = 14, sFilterConfigCan1.SlaveStartFilterBank = 14;

can3: sFilterConfigCan1.FilterBank = 2, sFilterConfigCan1.SlaveStartFilterBank = 14;

Is it correct setting? 

Thanks, Sabina

1 ACCEPTED SOLUTION

Accepted Solutions
sabina greenberg
Associate

The problem is resolved.

Now all 3 cans work with filters. if somebody need it the configuration for 3 Cans with EXT ID should be:

can1: FIFO0; sFilterConfigCan1.FilterBank = 0, sFilterConfigCan1.SlaveStartFilterBank = 0;

can2: FIFO1; sFilterConfigCan1.FilterBank = 4, sFilterConfigCan1.SlaveStartFilterBank = 4;

can3: sFilterConfigCan1.FilterBank = 11, sFilterConfigCan1.SlaveStartFilterBank = 11;

We had to choose banks that support ID List (32-bits) .

About Filters:

Uint32 filter_id1  = 0x00000200;//will catch all with IDs 1

Uint32 filter_id2  = 0x00000400 ;//will catch all with IDs 2

Uint32 filter_id3  = 0x00000600;////will catch all with IDs 3

Uint32 filter_mask1 = 0x00000F00;

Uint32 filter_mask2 = 0x00000F00;

Uint32 filter_mask3 = 0x00000F00;

sFilterConfig.FilterIdLow = (uint16_t) (id << 3);

sFilterConfig.FilterIdLow |= CAN_ID_EXT;

sFilterConfig.FilterIdHigh = (uint16_t) (id >> 13);

sFilterConfig.FilterMaskIdLow =(uint16_t) (mask << 3);

sFilterConfig.FilterMaskIdLow |= CAN_ID_EXT;

sFilterConfig.FilterMaskIdHigh = (uint16_t)(mask >> 13);

Thanks,Sabina

View solution in original post

1 REPLY 1
sabina greenberg
Associate

The problem is resolved.

Now all 3 cans work with filters. if somebody need it the configuration for 3 Cans with EXT ID should be:

can1: FIFO0; sFilterConfigCan1.FilterBank = 0, sFilterConfigCan1.SlaveStartFilterBank = 0;

can2: FIFO1; sFilterConfigCan1.FilterBank = 4, sFilterConfigCan1.SlaveStartFilterBank = 4;

can3: sFilterConfigCan1.FilterBank = 11, sFilterConfigCan1.SlaveStartFilterBank = 11;

We had to choose banks that support ID List (32-bits) .

About Filters:

Uint32 filter_id1  = 0x00000200;//will catch all with IDs 1

Uint32 filter_id2  = 0x00000400 ;//will catch all with IDs 2

Uint32 filter_id3  = 0x00000600;////will catch all with IDs 3

Uint32 filter_mask1 = 0x00000F00;

Uint32 filter_mask2 = 0x00000F00;

Uint32 filter_mask3 = 0x00000F00;

sFilterConfig.FilterIdLow = (uint16_t) (id << 3);

sFilterConfig.FilterIdLow |= CAN_ID_EXT;

sFilterConfig.FilterIdHigh = (uint16_t) (id >> 13);

sFilterConfig.FilterMaskIdLow =(uint16_t) (mask << 3);

sFilterConfig.FilterMaskIdLow |= CAN_ID_EXT;

sFilterConfig.FilterMaskIdHigh = (uint16_t)(mask >> 13);

Thanks,Sabina