cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Frame Repeating, but is received

sethkaz
Associate III

Summary: I'm seeing a situation where the CAN frames are repeating when they should only be sent once.  However, the receiving device is receiving them just fine.  

Details:

I'm running an STM32U545 on it's Nucleo Board, and using a simple CAN transceiver chip.  I'm sending pre-made dummy messages to spoof an external device, and have verified those messages work using an STM32L431.  The frame is being sent once every 200ms, and the code is sitting in HAL_Delay() the rest of the time.  

The number of repeated frames is not consistent.  I'm looking on the scope/Saleae, and it can be anywhere from 1 to several (like 7 or 10), and anywhere in between.  The Saleae interpreter is reporting an ACK being received, so that shouldn't be the issue.  

Bit rate: 250k

Is there anything else I should check?

Seth K
1 ACCEPTED SOLUTION

Accepted Solutions

Hello,

I'm adding screenshots from my logic analyzer:

SofLit_1-1715174152411.png

If you can see the interval between frames are 150ms as I already programmed in the code and the frames on CAN_Tx and CAN_Rx are correct. So again no repeating behavior.

I've also attached the project with a minor changes: 

- Add disable/enable_irq in H5 FW.

- Add Tx header in L4 FW / data length = 2 bytes.

If it does answer your question, please mark accept as solution to close the thread.

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.

View solution in original post

18 REPLIES 18
SofLit
ST Employee

Hello,

If you disable the auto-retransmission? do you get the same behavior?

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.

Auto-retransmission was already disabled.  I tried enabling it, but it didn't fix the problem.  Nor did re-disabling it.  

I also tried changing it from FIFO to Queue mode, and no change in behavior. 

Seth K

You need to share your code for the two nodes STM32U545 and STM32L431.

What tranceiver you're using for both nodes?

What clock source are you using for both nodes? HSI? HSE? 

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 should be able to share my code, but let me double check before I do.

I'm using the VP230 transceiver for both.  

Clock source:
U545: PLL1Q @ 40MHz,  sourced by MSIS running at 4MHz
L431: MSI @ 48MHz. (I'm not seeing a dedicated CAN clock mux in the clock config window, so I'll have to hunt down which specific clock it's running off of, but they're all set to 48M)

Seth K

It's not recommended to use internal oscillators for CAN communication. You need to use an external crystal (HSE)

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.

Unfortunately, the Nucleo Board I have is missing the HSE oscillator.  I've ordered it from Digi-Key.

Is that recommendation documented in the datasheets somewhere?  (For my own knowledge, and ideally with an explanation why)

Also, is there something else we can eliminate while we wait for the oscillator to arrive?

And why is that working for the L431 chip, while it's failing for the U545 chip?

Seth K

I've attached the pertinent code for the U545 and L431 projects.  Everything not included is left as is from how the project is generated by STM32CubeIDE 1.13.

Seth K

Ordering the oscillator was unnecessary. The oscillator is left out because your clock source is derived from the ST-Link MCO output.

 

A simple Google search for the Nucleo boards will have links to ST's website for that board. From there they have all the documents including the schematics. From the schematics you would have known the oscillator is DNF. You then would have seen in place of the oscillator, the MCO goes to the oscillator input.

 

If you used STM32CubeIDE to set up the board, then the clock has already been set up correctly.

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

@sethkaz wrote:

I've attached the pertinent code for the U545 and L431 projects.  Everything not included is left as is from how the project is generated by STM32CubeIDE 1.13.


Your FDCAN_TxHeaderTypeDef txHeader_status needs to be defined as global instead of local. As soon as you exit the function, txHeader_status is destroyed. 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.