CAN driver for stm32F072 absent?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

CAN driver for stm32F072 absent?

Post by DeusExMachina »

Hello,

I tried to use common CAN lld STM32 driver for STM32F072.
But it doesn't work at all (2.6.8 and 3.0) . It seems that CAN module in STM32F072 uses just single interrupt vector, but existing CAN driver is based on usage of 4 interrupts (TX, RX0, RX1, SCE).
How can I make this driver workable?

Can anybody provide more advanced example for CAN driver usages for Chibios?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: CAN driver for stm32F072 absent?

Post by Giovanni »

The driver requires a change because the unified IRQ vector, it is in the to-do list. About examples, the demo does about everything there is to it except filters, those are documented in the Reference Manual in case you need them. Do you need a specific example?

Giovanni
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: CAN driver for stm32F072 absent?

Post by DeusExMachina »

I updated lld driver for one common IRQ. Testhal example now works fine, but it is very basic.
Maybe it is better to make some testhal example for F4 with two CANs?
It is possible to send from CAN1 to CAN2. I think some filtering example could be also useful.
Also, it unclear to me how to set communication speed.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: CAN driver for stm32F072 absent?

Post by Giovanni »

Hi,

Communication speed must be set following the indications of the STM32 Reference manual, it is not matter of setting simply the baud rate. On the RM there is a table with values for various speeds, see "32.7.7 Bit timing" section on the F4 manual (RM0090), the settings are those documented for the CAN_BTR register. Do you need a specific setting?

About the demo, it simulates two boards communicating using the CAN "loopback mode" those two threads, placed on different boards would operate exactly as in the demo, you just need to disable the loopback in the configuration structure.

I will updated the CAN driver to use a single IRQ during the weekend, P6 will contain the fix.

Giovanni
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: CAN driver for stm32F072 absent?

Post by DeusExMachina »

Thank you!
Post Reply