cancel
Showing results for 
Search instead for 
Did you mean: 

STM8 CAN Filter

PNege
Associate

Hi,

I am working with the STM8AF5286UDY and am trying to set up a CAN interface.

For programming, I use the standard peripheral library. At the moment, my CAN interface works fine. The only thing, which does not work, is the filtering.

I use extended IDs and want to get all IDs from 0x18FEC100 to 0x18FEC999.

My code looks as follows:

/* CAN filter init */

 CAN_FilterNumber = CAN_FilterNumber_0;

 CAN_FilterActivation = ENABLE;

 CAN_FilterMode = CAN_FilterMode_IdMask;

 CAN_FilterScale = CAN_FilterScale_32Bit;

 CAN_FilterID1=0x18FEC101;

 CAN_FilterID2=0;

 CAN_FilterID3=0;

 CAN_FilterID4=0;

 CAN_FilterIDMask1=0x1FFFF000;

 CAN_FilterIDMask2=0;

 CAN_FilterIDMask3=0;

 CAN_FilterIDMask4=0;  

 CAN_FilterInit(CAN_FilterNumber, CAN_FilterActivation, CAN_FilterMode, 

         CAN_FilterScale,CAN_FilterID1, CAN_FilterID2, CAN_FilterID3,

         CAN_FilterID4,CAN_FilterIDMask1, CAN_FilterIDMask2, 

         CAN_FilterIDMask3, CAN_FilterIDMask4);

I would apreciate any help! Thank you!

0 REPLIES 0