cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN on NUCLEO-H743ZI

Alberto Vignani
Associate
Posted on October 16, 2017 at 15:31

I succeeded in transmitting CAN messages from my new Nucleo-H743 board (after adding the needed transceivers), but there are oddities.

I made a project with CubeMX, not using for the moment any FD feature, setting the CAN clock to 64MHz, the prescaler to 8 and the CAN timings to 9-4-3, as expected for generating a 500kHz signal; it didn't work.

With the help of an oscilloscope and some retries I determined that to get 500kHz I must set the prescaler to 16(?) and the CAN clock to 66MHz; with these settings the Canalyzer shows the messages without errors.

I suspect some problem in the Clock Calculator of CubeMX, but so far the generated code looks fine.

Can anyone explain this?

Alberto

Follow-up: I made a new CubeMX configuration from scratch, and this one makes more sense. Now there is an 8MHz input clock instead of the previous 25MHz (from where did it come?), and the FDCAN works with the 64MHz input clock. The only remaining oddity is that I still need to set its prescaler to 16 instead of the expected 8.

7 REPLIES 7
Imen.D
ST Employee
Posted on October 19, 2017 at 13:16

Hello,

Please share your .ioc file for check.

Kind Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Szymon PANECKI
Senior III
Posted on October 19, 2017 at 13:57

Hello Alberto,

Thanks for your interest in STM32 MCUs and CAN interface. Obtaining CAN speed is a not an easy task, as you need to take into account many input parameters (clock feeding CAN peripheral, prescaler, time quantas) and CubeMX doesn't provide direct relationship between these parameters and CAN speed. For purpose of doing it in more automatic way I use this website:

http://www.bittiming.can-wiki.info/

 . Once you select CAN peripheral (STMicroelectronics bxCAN) and clock frequency (8MHz, 64MHz or other), you will get a table with different CAN speeds and parameters values related to these speeds. For example if I set slock frequency as 8MHz, I get such table:0690X00000608gYQAQ.png

I hope this information will be helpful to you.

Regards

Szymon
Alberto Vignani
Associate
Posted on October 19, 2017 at 16:48

Thank you, but I know very well the CAN timings.

I'm attaching my current IOC file; I have set the CAN segments to 9-4-3 (could also have been the default 10-3-3) to have 16 clocks per bit and get 500kHz from an 8MHz clock. I start from a 64MHz clock (or at least this is what CubeMX shows), and I should divide it by 8, not by 16, to get 8MHz.

Anyway, apart this, all now works fine for both adapters, and I'll start shortly to test the FD-related features.

I already have a CAN-FD running on an NXP board, using an extension of the SLCAN protocol (done by me) to control it; so I will use it a a tester for the ST32 device.

Alberto

________________

Attachments :

h743d.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyEj&d=%2Fa%2F0X0000000b6V%2FnQUKGIidWdaez4XHAbE0N2mGJnetLDx.7iLog_PUByY&asPdf=false
Posted on February 02, 2018 at 16:18

Hi,

From this table, how do you map it to NominalPrescaler, NominalSyncJumpWidth, NominalTimeSeg1 and NominalTimeSeg2?

It would be great to have the baudrate config part of CubeMx.

regards,

A.

Posted on February 02, 2018 at 16:43

Hello,

Please find below an example of translation between table and CubeMX.

0690X00000609a7QAA.pngI fully agree with you that it would be good if CubeMX would allow to fill in the CAN baudrate directly instead of forcing user to configure all parameters manually. Of course configuration of these parameters should be available, but in the first step they could be filled in by CubeMX based on CAN baudrate declared by user. I hope this feature will be available in one of future CubeMX releases.

Regards

Szymon

Posted on February 05, 2018 at 11:32

Thanks, it makes things easier. But what about 

NominalSyncJumpWidth? is it always 1? 

Posted on May 30, 2018 at 17:20

Hi

alberto.vignani

‌,

RM0433 STM32H7x3 advanced ARM®-based 32-bit MCUs may help you to dig into the problem.

May you inspect FDCAN registers to verify that fdcan_tq_ck is correctly configured compared fdcan_ker_ck input?

For instance with a gdb debugger console, you can do the following commands:

print /x FDCAN_CCU->CCFG

print /x FDCAN1->NBTP

Hoping it helps solving your issue.

Regards.

Cyril