cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupted CAN ID

willy
Associate
Posted on December 17, 2012 at 11:38

Hi,

Can anybody help me to set up(source code C) CAN id interrupt for STM32F10XX CPU.

BR Willy

3 REPLIES 3
ser-gavr
Associate
Posted on December 18, 2012 at 19:42

What do you mean by CAN id interrupt? You can adjust FILTERS to receive or decline frames with IDs you need or you can check ID after receiving frame (without filtering) manually - for example in CAN interrupt handler... If that's what you need I can show you my code

willy
Associate
Posted on December 19, 2012 at 09:06

I meant that if I set up  filters to get a interrupt then I got a speciell frame with my ID.

Have done that with other CPU but I dont knowe howe to set up register for STM32F103XX.

Would be nice if I can see your code.

ser-gavr
Associate
Posted on December 19, 2012 at 21:22

Actually I don't use CAN Filter id to identify message - only to accept or deny frames I need and then I deal only with CAN Frame ID...

For example I used that code to adjust filter to receive only frames with ID starting with 1:

    CAN_FilterInitStructure.CAN_FilterNumber = 0;

    CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask;

    CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_32bit;

    CAN_FilterInitStructure.CAN_FilterIdHigh = 0xFFFF;

    CAN_FilterInitStructure.CAN_FilterIdLow = 0x0000;

    CAN_FilterInitStructure.CAN_FilterMaskIdHigh = 0x8000;

     CAN_FilterInitStructure.CAN_FilterMaskIdLow = 0x0000;

    CAN_FilterInitStructure.CAN_FilterFIFOAssignment = 0;

     CAN_FilterInitStructure.CAN_FilterActivation = ENABLE;

    CAN_FilterInit(&CAN_FilterInitStructure);