# Nucleo STM32F303RE, FREERTOS node.start freeze

**URL:** <https://forum.opencyphal.org/t/nucleo-stm32f303re-freertos-node-start-freeze/1593>\
**Category:** LibCyphal\
**Created:** [February 10, 2022, 3:53pm UTC](https://forum.opencyphal.org/t/nucleo-stm32f303re-freertos-node-start-freeze/1593 "2022-02-10T15:53:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rui\_Loureiro](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/rui_loureiro/32/1041_2.png) [@Rui\_Loureiro](https://forum.opencyphal.org/u/Rui_Loureiro)\
**Post date:** [February 10, 2022, 3:53pm UTC](https://forum.opencyphal.org/t/nucleo-stm32f303re-freertos-node-start-freeze/1593/1 "2022-02-10T15:53:45Z")

</div>

Hi everybody,

I’m attempting to develop a UAVCAN subscriber node while using an STM Nucleo board and RTOS. I’m using the Nucleo STM32F303RE.

I have followed the examples in this repo: [https://github.com/raimapo/UAVCAN-examples](https://github.com/raimapo/UAVCAN-examples) which I find to be very simple and easy to understand. I’m using the exact same files as the author is as a library.

I have defined the chip.h file manually (as I’m using the latest cubeMx auto-configuration and it is not generated by default)  
It goes like this:

chip.h file

```auto
#ifndef CHIP_UAVCAN_CONFIG_H
#define CHIP_UAVCAN_CONFIG_H

#include <stm32f3xx.h>

#define STM32F3XX 

#define CAN1_TX_IRQHandler CAN_TX_IRQHandler // was CAN1_TX_IRQHandler in example
#define CAN1_RX0_IRQHandler CAN_RX0_IRQHandler // was CAN1_RX0_IRQHandler in example
#define CAN1_RX1_IRQHandler CAN_RX1_IRQHandler // was CAN1_RX1_IRQHandler in example

#define STM32_PCLK1 (36000000ul) // was 42000000ul in example
#define STM32_TIMCLK1 (72000000ul) // was 84000000ul in example

#endif

```

Also, I have defined these variables:

```auto
UAVCAN_CPP_VERSION=UAVCAN_CPP11
UAVCAN_STM32_FREERTOS=1
UAVCAN_STM32_TIMER_NUMBER=2
UAVCAN_STM32_NUM_IFACES=1

```

Lastly, the only difference with the shown examples are the GPIO CAN configs, like this:

```auto
	//CAN1 GPIO Configuration
	//PB8 , d15 ------> CAN1_RX
	//PB9 , d14 ------> CAN1_TX
    GPIO_InitTypeDef GPIO_InitStruct = {0};

	__HAL_RCC_CAN1_CLK_ENABLE();

	GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
	GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
	GPIO_InitStruct.Pull = GPIO_NOPULL;
	GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
	GPIO_InitStruct.Alternate = GPIO_MODE_AF_PP;

	HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

```

When in the task, on the `node.start()` the whole system freezes…  
I have checked this topic as well [here](https://forum.opencyphal.org/t/libuavcan-cubemx-freertos-systemworkbenchforstm32/430).

Is there anything I am missing?  
Do I need to manually setup the Timer or does the code do it by itself?

Thank you, any information would be greatly appreciated, best regards!

---

<div class="post-metadata">

**Author:** ![raimondas](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@raimondas](https://forum.opencyphal.org/u/raimondas)\
**Post date:** [February 11, 2022, 7:22am UTC](https://forum.opencyphal.org/t/nucleo-stm32f303re-freertos-node-start-freeze/1593/2 "2022-02-11T07:22:47Z")

</div>

Hi,

After I have removed stmcube CAN driver generation it solved me some problems. I just added few line to define used pins directly in the code.

Also please carefully check version of the UAVCAN v0 library, because I have needed to change a branch, because of some sort of bug at that time. At my github in the module subdirectory is working branch of the libuavcan.

Am I am using also with stm32f303 and FreeRTOS  
[https://github.com/raimapo/GMM\_BIG\_V2\_Firmware](https://github.com/raimapo/GMM_BIG_V2_Firmware)

Now I am waiting of fully finished V1 to make a new examples for the stm32. But because of absolutelly different approach I think I will need Pavel’s or others small help 😃 or maybe some day by visiting TalTech I visit Zubax 😃

---

<div class="post-metadata">

**Author:** ![Rui\_Loureiro](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/rui_loureiro/32/1041_2.png) [@Rui\_Loureiro](https://forum.opencyphal.org/u/Rui_Loureiro)\
**Post date:** [February 11, 2022, 8:17am UTC](https://forum.opencyphal.org/t/nucleo-stm32f303re-freertos-node-start-freeze/1593/3 "2022-02-11T08:17:34Z")

</div>

Thank you for your feedback.

I will definitely check your repository.

If I have any further development I will update this thread

---

<div class="post-metadata">

**Author:** ![Rui\_Loureiro](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/rui_loureiro/32/1041_2.png) [@Rui\_Loureiro](https://forum.opencyphal.org/u/Rui_Loureiro)\
**Post date:** [February 11, 2022, 9:46am UTC](https://forum.opencyphal.org/t/nucleo-stm32f303re-freertos-node-start-freeze/1593/4 "2022-02-11T09:46:57Z")

</div>

I have found the problem.

It was GPIO configuration all the time, here is the corrected GPIO Init:

```auto
	//CAN1 GPIO Configuration
	//PB8 , d15 ------> CAN1_RX
	//PB9 , d14 ------> CAN1_TX
    GPIO_InitTypeDef GPIO_InitStruct = {0};

	__HAL_RCC_CAN1_CLK_ENABLE();

	GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
	GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
	GPIO_InitStruct.Pull = GPIO_NOPULL;
	GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
	**GPIO_InitStruct.Alternate = GPIO_AF9_CAN;**

	HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

```

Special thanks to @raimondas for pointing me to his code. After the correction, it worked instantly

---

<div class="post-metadata">

**Author:** ![xbron](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/xbron/32/985_2.png) [@xbron](https://forum.opencyphal.org/u/xbron)\
**Post date:** [February 15, 2022, 10:06am UTC](https://forum.opencyphal.org/t/nucleo-stm32f303re-freertos-node-start-freeze/1593/5 "2022-02-15T10:06:06Z")

</div>

Hello, Rui, can you share link with your project, please? I am also working with NUCLEO F303RE and I think about using FreeRTOS in my project. But currently I use UAVCAN V1 (specifically libcanard v2.0).
