cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 canbus loopback working but normal mode Bit timing Error

Sergen
Associate III

hello I today trying can communication loopback mode working but normal mode bit LEC register showing timing error.

1 ACCEPTED SOLUTION

Accepted Solutions

Indeed.. CAN is not UART nor SPI to test it in standalone. In Normal mode you should have at least two nodes on the bus for acknowledgement mechanism and listening of the bus. Otherwise use loopback mode for standalone config.

 

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.

View solution in original post

7 REPLIES 7
SofLit
ST Employee

Hello,

- What kind of HW you are using?

- Are you using a CAN transceiver in Normal mode? 

- Do you have another CAN node on the bus?

- Are you using HSE or HSI as system clock source?

Also, the values of BS1 and BS2 are not good to me. Please increase BS1 and BS2 as much as possible and decrease the prescaler as much as possible to match your 500kb/s knowing that BS1 must be between 70% and 80% of the bit time.

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.
SofLit
ST Employee

@Tesla DeLorean : thank you for pointing this thread out.

@Sergen , please don't duplicate a thread on the community.

Now seeing the previous one. I don't have the visibility of all your environment but I have to add:

- Check RS pin of SN65HVD230 transceiver: connect it to GND.

- In normal mode you have to have at least two nodes on the bus.

- The two STM32 (nodes) have to be clocked with HSE with an external crystal not with HSI. The two nodes have to have the exact bitrate.

 

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 checked the RS pin, there was no problem, then I solved the bit timing problem by editing the time segment quanta and prescaler values, but the only thing I'm curious about is that when my device is not connected to any node, something like this picture appears as a frame from my CAN TX output.

Indeed.. CAN is not UART nor SPI to test it in standalone. In Normal mode you should have at least two nodes on the bus for acknowledgement mechanism and listening of the bus. Otherwise use loopback mode for standalone config.

 

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.

Thanks your support

PranavGurav
Associate II

Hi @Sergen @SofLit @Tesla DeLorean after using two nodes also i am getting the same waveform.