Skip to main content
Nicolas Cmb
Associate III
Jun 19, 2017 11:45 AM UTC
Question

STM32F103RB CAN J1939 identifier

Posted on June 19, 2017 at 13:45

Hi evryone, I'm using STM32f103rb card to communicate with another STM32f103rb thanks to STM32F103Rb CAN protocole, and I'm looking for using J1939.

I have parameter my identifier like that :

hcan.pTxMsg->StdId = 0x01;

hcan.pTxMsg->ExtId = 0x01DAD4DC1;

hcan.pTxMsg->RTR = CAN_RTR_DATA;

hcan.pTxMsg->IDE = CAN_ID_EXT;

hcan.pTxMsg->DLC = 8;

and I'm trying to configurate my filter, but I've no idea of what could be the following configurations :

sFilterConfig.FilterIdHigh 

sFilterConfig.FilterIdLow

sFilterConfig.FilterMaskIdHigh

sFilterConfig.FilterMaskIdLow

sFilterConfig.BankNumber 

Anyone can help me ?

Thanks for your attention,

Regards,

Nicolas.
    This topic has been closed for replies.

    7 replies

    Tesla DeLorean
    Guru
    Jun 19, 2017 12:44 PM UTC
    Posted on June 19, 2017 at 14:44

    https://community.st.com/0D50X00009XkYJGSA3

    You have to construct the mask and id so the comparator in the peripheral can recognize the specific bit pattern

    The mask is ANDed with the bit stream and the ID is then compared.

    https://community.st.com/0D50X00009XkXx6SAF

    The EXID complicates the construction of the bit patterns, but look at the diagram of what the chip is looking for.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    Jun 19, 2017 6:37 PM UTC
    Posted on June 19, 2017 at 18:37

    HCANFilter_Struct.FilterIdHigh = (EXTID >> 13) & 0xFFFF; // 29-bit EXTID

    HCANFilter_Struct.FilterIdLow = ((EXTID << 3) & 0xFFF8) | 4;

    HCANFilter_Struct.FilterMaskIdHigh = 0xFFFF; // MSB

    HCANFilter_Struct.FilterMaskIdLow = 0xFFFC; //LSB
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Nicolas Cmb
    Associate III
    Jun 21, 2017 10:36 AM UTC
    Posted on June 21, 2017 at 10:36

    thank you so much, but I need to know how you have doing this