cancel
Showing results for 
Search instead for 
Did you mean: 

Hello. I am a student who is studying through STM32F446. I want to real-time CAN how about them? What should I do? And do you have an example?

KBumS
Associate II
 
4 REPLIES 4
Ozone
Lead

Not sure what you mean with real-time CAN - there is no such thing.

CAN is not a real-time bus, a message delivery in a defined time limit cannot be guaranteed by design.

It is used by some real-time application, though, because of other design advantages.

I'm sure the respective CubeMX version contains CAN examples.

However, Cube code tends to be convoluted, and skip error checks & handling a proper application would need.

But you could use it as a starting point.

I mean, every time(sampling time) I try to send and receive CAN.

T J
Lead

I used a CanDo unit from the UK to start with,

I set the CanDo unit to transmit every 1 second a short frame at 10KHz.

then I could see it on the Scope..

I worked on the receiver code first, I started to receive at 10KHz and worked on the DMA systems.

Then I set the CanDo unit to 250KHz and to send 10 different frames every 10mS

It was all running in 2 days. then I worked on the transmitter, it took a few more days...

it was a bit tricky to understand the addressing system and bus contention.

You have to set ABOM ON.

Today I see the New Cube repository has a fix for the CanBus transmitter code, I really hope it is ok, or I will go back to my code..

anyhow I will be working on this over the next week on the F072 processor.

Do you have a dongle to work with ?

I cant help you if you don't have a scope and a dongle.

You have to pull up the Rx pin, if you dont have a transceiver.

it is very difficult to work with without a transceiver and a terminator.

You absolutely need a terminator if you have a transceiver.

Good recommendations.

Some CAN viewer software (usually associated with the dongle) will be helpful, too.

A university supposedly has both available, scope and CAN software.

BTW, I'm not sure about the STM32F44x. For this MCUs, there might still be an "old" SPL library available.

The SPL (Standard Peripheral Library) examples used to be less confusing and convoluted, and not mixed with irrelevant HAL stuff.

Especially the setup and periodic runtime processing was easier to understand.

For a start, you might get away with two nodes, and, if you have access to chip level signal of the other node, direct pin-to-pin connections without transceivers.