Homepage GitHub

Libcancard for stm32f103


(Skyyuzhang) #1

since I have read am basic tutorial of uavcan on zubax . I have been trying to use libcanard on stm32f103 board. In the tradition code for CAN BUS on stm32f103 we need to setup “CAN_InitStructure” and “CAN_FilterInitStructure” but I didn’t see both function in hwInit() fubction. Should I suppose to setup both function when using libcanard at stm32f103mcu? thank you!!!


(Alexander Sysoev) #2

Greetings! Indeed, you need to mess with CAN_InitStructure if you want to use stm32 SPL or HAL to work with CAN bus. And although stm32 SPL is used in these tutorials, everything concerning CAN bus is handled by canard library(as it embeds driver for CAN peripheral for stm32).
CAN is actually set up inside the function
static void swInit(void)
And to be precise in this string
result = canardSTM32Init(&timings, CanardSTM32IfaceModeNormal);


(Skyyuzhang) #3

should I think that “libcanard driver” or some function have initialized CAN BUS for me when using hwInit(); and
swInit(); whatever any MCU like STM32F3 STM32F1 anyway


(Alexander Sysoev) #4

Yes, this is just what happens. You provide library with your clock speeds and it initializes CAN peripheral for you properly