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
18 REPLIES 18

I'm going based off what the person said.  

I've tried the MCO output, and it does not solve this issue. 

Seth K

Can you explain why this is an issue?  The FDCAN_CopyMessageToRAM function calls the function FDCAN_CopyMessageToRAM, which copies the contents to the queue.  So even if the struct is destroyed, the frame is in the queue.  (Admittedly, there is an inefficiency in re-making and destroying the struct, which doesn't change. But that's an improvement I can make after this behavior is resolved.)

Also, the frame is being sent correctly each time. 

Seth K

@sethkaz wrote:

I'm going based off what the person said.  

I've tried the MCO output, and it does not solve this issue. 


It depends on what stlink is outputting. STLINK itself could generate MCO output from its internal clock source or from its external crystal. So you need to use STSW-LINK007 tool to set the MCO output source. You need to set an integer value for HSE to find suitable velues when you set prescalers later on.

SofLit_0-1714584577865.png

According to NUCLEO-U545RE-Q schematics STLINK module is clocked by a 24MHz.

SofLit_1-1714584735479.png

Unfortunately I don't have that board to test but as stated before you need to configure STLINK MCO to output a clock generated from its 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.

So, the MCO isn't an issue. I was able to get the U545 running with the MCO output at 8MHz.

However, running the U545 from the MCO does not solve the issue. 

Seth K

Hello,

I created two projects with NUCLEO-U545 and NUCLEO-L432. I didn't reproduce that "repeating" frame behavior on oscilloscope.

The example consist of:

U545 is sending a frame at 150ms period, L432 receiving it and sending it back to U545 MCU.

Each time a frame is received the Green LED is toggling for each device.

Could you please use my projects to test from your side and get back to me with the results?

EDIT: I used MCP2562 as transceivers.

 

 

 

 

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.

Hi SofLit,

Thanks for taking the time to set that up.  I think you may have forgotten to include the attachments.

Seth K

Sorry.. I've attached the two projects :)

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.

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

Hello @sethkaz ,

Could you please give a status of this issue?

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.