CAN Bus Extid paramater is not transmitting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-07 03:30 AM
Hello,
I have setup the CAN bus to transmit and has been working fine. I now need a feature which requires the ExtID but this isn't getting transmitted.
I have debugged both and can see that the ExtId is getting transmitted but not received, I'm wondering if this is to do with my filter (but i think that I've set it to allow everything - unless I've misunderstood) I have used the STM example code as a base.
Any help would be appreciated,
Kind Regards,
Mike
/*** Transmit Parameters***//
buttonPressedHeader.IDE = CAN_ID_STD;
buttonPressedHeader.StdId = 0xC8;
buttonPressedHeader.ExtId = 0x01;
buttonPressedHeader.RTR = CAN_RTR_DATA;
buttonPressedHeader.DLC = 2;
buttonPressedHeader.TransmitGlobalTime= DISABLE;
/*** Filter Parameters***//
sFilterConfig.FilterBank = 0;
sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
sFilterConfig.FilterIdHigh = 0x0000;
sFilterConfig.FilterIdLow = 0x0000;
sFilterConfig.FilterMaskIdHigh = 0x0000;
sFilterConfig.FilterMaskIdLow = 0x0000;
sFilterConfig.FilterFIFOAssignment = CAN_RX_FIFO0;
sFilterConfig.FilterActivation = ENABLE;
sFilterConfig.SlaveStartFilterBank = 14;
HAL_CAN_ConfigFilter(&hcan, &sFilterConfig);
Solved! Go to Solution.
- Labels:
-
CAN
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-07 08:28 AM
Like I said, it is one or the other, there isn't this third ambiguous choice you seem to allude too.
They share common bits on the wire, the Std Id is 11 bits, the Ext Id is 29 bits, one is a SUBSET of the other.
The library encodes/decodes either StdId or ExtId structure values into the STID and EXID bits in the packet frame, along with the IDE bit to determine which is being communicated.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-07 05:08 AM
Perhaps set IDE value appropriately?​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-07 05:41 AM
Hi,
Thank you for your reply, if i change the IDE to CAN_IDE_EXT then it doesnt receive the StdID value. is there a way to receive both?
Kind regards,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-07 05:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-07 05:52 AM
It is a bit saying how many bits are in the ID, and where they are packed in the frame. It has two states and one of them isn't Ambiguous.
​
Should be a diagram of the packet frame on the wire, take a critical look at that.​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-07 05:58 AM
The filter gives you all the packets, look at how you are decoding and unpacking them to extract the detail you actually want. For example identifying the ID type flagged and using that form, or truncating to get the smaller bit count value masked out.​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-07 08:02 AM
Hi, I have stepped into 'HAL_CAN_GetRxMessage' in debug from the cubeMX code and it suggests that you can do Std or ExtId from the 'if' statement - correct me if im wrong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-07 08:28 AM
Like I said, it is one or the other, there isn't this third ambiguous choice you seem to allude too.
They share common bits on the wire, the Std Id is 11 bits, the Ext Id is 29 bits, one is a SUBSET of the other.
The library encodes/decodes either StdId or ExtId structure values into the STID and EXID bits in the packet frame, along with the IDE bit to determine which is being communicated.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-07 08:34 AM
I clearly misunderstood the ExtId,
Thanks for you help