# Libcancard for stm32f103

**URL:** <https://forum.opencyphal.org/t/libcancard-for-stm32f103/180>\
**Category:** Libcanard\
**Created:** [October 8, 2018, 8:55am UTC](https://forum.opencyphal.org/t/libcancard-for-stm32f103/180 "2018-10-08T08:55:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skyyuzhang](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/skyyuzhang/32/65_2.png) [@skyyuzhang](https://forum.opencyphal.org/u/skyyuzhang)\
**Post date:** [October 8, 2018, 8:55am UTC](https://forum.opencyphal.org/t/libcancard-for-stm32f103/180/1 "2018-10-08T08:55:12Z")

</div>

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!!!

---

<div class="post-metadata">

**Author:** ![j3qq4hch](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/j3qq4hch/32/26_2.png) [@j3qq4hch](https://forum.opencyphal.org/u/j3qq4hch)\
**Post date:** [October 8, 2018, 10:35am UTC](https://forum.opencyphal.org/t/libcancard-for-stm32f103/180/2 "2018-10-08T10:35:21Z")

</div>

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);`

---

<div class="post-metadata">

**Author:** ![skyyuzhang](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/skyyuzhang/32/65_2.png) [@skyyuzhang](https://forum.opencyphal.org/u/skyyuzhang)\
**Post date:** [October 9, 2018, 12:34pm UTC](https://forum.opencyphal.org/t/libcancard-for-stm32f103/180/3 "2018-10-09T12:34:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![j3qq4hch](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/j3qq4hch/32/26_2.png) [@j3qq4hch](https://forum.opencyphal.org/u/j3qq4hch)\
**Post date:** [October 10, 2018, 11:28am UTC](https://forum.opencyphal.org/t/libcancard-for-stm32f103/180/4 "2018-10-10T11:28:43Z")

</div>

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