cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 HAL CAN RX

danfarrelly9
Associate
Posted on March 02, 2016 at 13:05

Hello

I am having trouble with the CAN_RX_MSG structure.  As the struct contains both StdId and ExtId fields I have seen incorrect data being received in my ISR when both fields are populated.

if (CAN_RX_MSG.Ext_Id == 0x11111111) { //gather CAN data }

The above statement can evaluate as true when the CAN_RX_MSG structure contains a Std_Id message and its data and leads to the Std_Id data being populated into the program incorrectly.

Can anyone advise as to how I can avoid this issue?  Is the IDE parameter required?

Advice is much appreciated.

Thanks

Dan

#can #hal #std_id #ext_id
2 REPLIES 2
petr239955
Associate III
Posted on March 04, 2016 at 16:00

Hi,

use the IDE,

if  (CAN_RX_MSG.IDE == CAN_ID_EXT)

{

  if (CAN_RX_MSG.Ext_Id == 0x11111111) { //gather CAN data }

  {

    ....

Petr

danfarrelly9
Associate
Posted on March 14, 2016 at 12:42

Thanks very much Petr!

Dan