cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Bus Extid paramater is not transmitting

MikeP
Senior

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);	

0690X00000ArnH2QAJ.png0690X00000ArnGdQAJ.png

1 ACCEPTED SOLUTION

Accepted Solutions

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.

0690X00000AroXBQAZ.jpg

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

8 REPLIES 8

Perhaps set IDE value appropriately?​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MikeP
Senior

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

0690X00000ArnoGQAR.png

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.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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 0690X00000AroOOQAZ.png

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.

0690X00000AroXBQAZ.jpg

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I clearly misunderstood the ExtId,

Thanks for you help