cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

T-elospathic
New Contributor II

We noticed that the CAN error return macro returns 1x in binary with a CAN bus-off error, while the macro/define for BUS OFF is set to 0x10 (hex). We believe this is a typo/error in the api itself, as the CPU returns 0x02 and not 0x10. In fact, the register only has 2 bits in address 0x402E000C, 17:16 for ERROR_STATE, and is not able to return 0x10, only "1x" (binary).

This is with PSoC Creator 4.4 and the latest CAN block. In the generated source code it says:

/* Error status of CAN */
#define CAN_ERROR_ACTIVE (0x00u)
#define CAN_ERROR_PASIVE (0x01u)
#define CAN_ERROR_BUS_OFF (0x10u)

When it SHOULD say (but used as a mask):

/* Error status of CAN */
#define CAN_ERROR_ACTIVE (0x00u)
#define CAN_ERROR_PASSIVE (0x01u)
#define CAN_ERROR_BUS_OFF (0x02u)

The module IS returning 1x (binary) and not 0x10. So, we believe this to be a bug in the API. PSoC 4100S

0 Likes
1 Solution
BragadeeshV
Moderator
Moderator

Hi @T-elospathic ,

Thank you for pointing out the bug. We confirm that this is a bug in the component. We have filed an internal request to correct this error. As a workaround you can define a new macro with mask 0x02 for  CAN_ERROR_BUS_OFF and use the CAN_GetErrorState API since this API doesn't have any issue with returning the right bits for bus off condition.

Thank you for your interest in Infineon products.

Regards,
Bragadeesh

View solution in original post

0 Likes
1 Reply
BragadeeshV
Moderator
Moderator

Hi @T-elospathic ,

Thank you for pointing out the bug. We confirm that this is a bug in the component. We have filed an internal request to correct this error. As a workaround you can define a new macro with mask 0x02 for  CAN_ERROR_BUS_OFF and use the CAN_GetErrorState API since this API doesn't have any issue with returning the right bits for bus off condition.

Thank you for your interest in Infineon products.

Regards,
Bragadeesh

View solution in original post

0 Likes