cancel
Showing results for 
Search instead for 
Did you mean: 

CAN interface stack for STM32F0 series controllers

Tom MacDonald
Associate III
Posted on January 24, 2017 at 18:54

I am building a peripheral device that will use an STM32 microcontroller.  This peripheral device will communicate with a master/supervisory device over a CAN interface.  We have tentatively chosen the STM32F091CC as the controller of the peripheral device.  This MCU has a hardware CAN module integrated into it.

I have been reading through documentation on the various CAN protocols and looking through various datasheets and community forums regarding CAN implementation on STM32 microcontrollers.

I am now scared that we chose the wrong microcontroller, since I am having an extremely hard time finding CAN libraries that are written for STM32F0 series microcontrollers. There appears to be a fair amount of CAN library stuff out there for STM32F1 and STM32F2 series, however I don't see anything for STM32F0 series.

For example, there are CANopen stacks for sale for F1,F2, and F4 series microcontrollers that cost about $10,000 and up.  The fact that these stacks don't seem to be available for the F0 series worries me.

  In my case, I don't need to use a high-level protocol like CANopen, I just need to be able to communicate serially with the master/supervisory device.  Incorporating other nodes onto the CAN network can be left to future product development/refinement.

I believe I only need some kind of hardware abstraction layer and limited CAN stack to coordinate communication over the CAN bus.  The stack I envision would allow me to receive, transmit, and filter CAN messages.

Having never delved much into the world of microcontroller HAL programming, I am wondering if I should stop the presses and change our selected MCU to a STM32F1 or F2 series.

Does anyone know of an open-source CAN stack that I could use on the F0 series?

#can #stm32f0 #can-bus #f0
5 REPLIES 5
Posted on January 24, 2017 at 19:02

>>

There appears to be a fair amount of CAN library stuff out there for STM32F1 and STM32F2 series, however I don't see anything for STM32F0 series.

It is third-party IP, is the implementation really any different on the F0 than the F2/F4?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 24, 2017 at 19:28

That's what I'd like to know!   

Posted on January 24, 2017 at 22:34

A review of the registers and the reference manual should give you some insight there. As would the SPL, along with the example I've posted for the F2/F4 CAN interface

STM32F0xx_StdPeriph_Lib_V1.5.0\Projects\STM32F0xx_StdPeriph_Examples\CAN\CAN_Networking\main.c

I'm not actively using the F0 Cortex-M0 parts, or have F0 boards with CAN on them, so not something I'm looking to invest time into. From a cursory scan it looks identical.

Do a merge/diff of the SPL code/examples..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
T J
Lead
Posted on January 25, 2017 at 05:07

Hi,

I am also working with the '091 on CAN

If you need some testing, I may be able to try your stuff on my bear metal os.

how can I enable the FIFO1 ...  ?

although I have a 16frame buffer

FIFO1 never gets a frame and I am always missing 4 frames..from 16 exactly, which is odd in itself.

Clive, where did you post the F2/F4 CAN examples ?, I tried to find them.

The example here above from Clive from StdPeriph library only Transmits and receives frames, but is it a network stack ?

Posted on January 25, 2017 at 21:22

 ,

 ,

 ,

 ,
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..