cancel
Showing results for 
Search instead for 
Did you mean: 

CAN id incorrect

PRODNAV
Associate

I have a STM32G474 mcu that i am learning to program. I have the CANBUS tx on PA12 working by loopback mode. I have connected my logic analyzer and i receive the data correctly.

There is only one thing wrong: The ID has bit1 that keeps being set to 1. So if i would give the adress

0x200 (0b0010 0000 0000) it outputs 0b0110 0000 0000)

0x100 (0b0001 0000 0000) it outputs 0b0101 0000 0000)

 

Anyone with idea's how this is possible?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

I have done both a loopback program and a normal mode program. Both show the same ID fault. I have created a totally new project. That one does work now without the issue.

 

Thanks all.

View solution in original post

10 REPLIES 10
SofLit
ST Employee

Hello @PRODNAV and welcome to the community,

No sure I understood the case.


@PRODNAV wrote:


There is only one thing wrong: The ID has bit1 that keeps being set to 1. So if i would give the adress

0x200 (0b0010 0000 0000) it outputs 0b0110 0000 0000)

0x100 (0b0001 0000 0000) it outputs 0b0101 0000 0000)


How did you test this behavior? Could you please elaborate? maybe share screenshots?

Thank you.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

PRODNAV_0-1727358752366.png

As you can see, Bit 1 is high for the ID. But i have programmed 0x180 for the 11bit ID, but somehow it sets the Bit1 high

Hello,

Do you have a communication issue? are you receiving bad ID messages in loopback mode?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

The communication is all correct in external loopback mode. Only the can id is incorrect on one bit (bit1). No matter what id i chose, that bit stays high. 

In that case you need to check your analyzer and its configuration. I don't think there is a an issue with the ID transmission.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I actually also checked with my oscilloscope. Same bit stays high in the id. 

Attach a minimal project that reproduces the behavior so we could analyze it later ..

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I have used a small old project that i have to log the ID, and data bytes. This also confirms that Bit1 keeps getting set for the ID.

I attached the code (very basic) that i have made. Can someone please check to see if there is any mistake there?

Hello,

Thank you for the sharing.

The attached txt contains a configuration of Normal mode contrarily to what you said in the first post.

For efficiency purposes, please attach a complete minimal working project in Loopback mode that you used to reproduce the behavior. 

Thank you.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.