cancel
Showing results for 
Search instead for 
Did you mean: 

How to start with HAL CAN Development on STM32F3 Discovery?

Maximilian Pohl
Associate II

 I want to implement a Normal CAN interface RX and TX. I get TX running but RX makes some trouble. It is also very hard to find any good turorial, documentation or example project. CAN is very very bad documented by ST. I hoped that when i use Cube it will be easyer than the direct way, but it looks like that Cube is not able to do this right. If you have any Tipps for me please let me know. Best regards

Max

4 REPLIES 4
Imen.D
ST Employee

Hello @Maximilian Pohl​ ,

You can found a CAN_Networking examples under the STM32CubeF3 firmware package:

STM32Cube_FW_F3_V1.10.0\Projects\STM32303C_EVAL\Examples\CAN\CAN_Networking

STM32Cube_FW_F3_V1.10.0\Projects\STM32373C_EVAL\Examples\CAN\CAN_Networking

You can re-use sections available in the CAN examples or get inspired from them.

Please find attached the presentation on how to develop a CAN application with new API for STM32L4 (the approach used should be the same for STM32F3).

This document will help you to configure CAN and use HAL functions from new CAN API.

Moreover, you find more details on 'how to use the new driver' in the driver header section itself.

With Regards,

Imen.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
T J
Lead

Are you designing your own CanBus or trying to read from an existing CanBus ?

I used the CanDo unit to get my receiver running first.

I set the CanDo to transmit every second until I got no errors, then cranked it up to 250KHz sending every 10mS.

It alll worked within a few days.

Transmit was very easy after that.

The Rx side has to be under interrupt control.

My Tx system is polled, in a foreground loop, if there is a packet ready, it will send it.

What is your trouble ?

Maximilian Pohl
Associate II

Hello, thank for you help. I want to set up a connection to a can motor controller.

I already get it running with the example. Thank you very much for that.

but there is still another question, how does it work with the input filter setting / masking?

I was not able to find any good documentation about it.

Best regards

max

T J
Lead

The filter settings are a little confusing,

the Mask shows the bits you want to be set, lets says you want addresses 0x0100 to 0x01FF

the Mask could be 0x0100 // only the 1 is tested

the filter could be 0x0100

now addresses 0x0100, 0x0300,0x0500 ... all odd higher addresses will pass through.

set the mask to 0x0F00

and the filter to 0x0100

now only addresses 0x0100 -0x01FF will pass through.