This project provides a reference template for the NUCLEO-C071RB board based on the STM32Cube HAL API and the BSP drivers that can be used to build any firmware application.
It was created from STM32CubeMX using the ‘Start My project from ST board’ feature.
This template shows how to use the BSP drivers for the leds, user push-button and VCP COM port of the NUCLEO-C071RB board thanks to BSP resources initialization and demonstration codes:
BSP Led: LED_GREEN and LED_BLUE are initialized and switched on.
BSP Push-button: BUTTON_USER is initialized in interrupt mode and each key-press is detected through the corresponding EXTI4_15_IRQHandler(). Led is toggled at each key press.
At the beginning of the main program, the HAL_Init() function is called to initialize the systick used as 1ms HAL timebase.
The SystemClock_Config() function is used to configure the system clock (SYSCLK) to run at 48 Mhz.
Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds) based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower) than the peripheral interrupt. Otherwise the caller ISR process will be blocked. To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function.
The application needs to ensure that the SysTick time base is always set to 1 millisecond to have correct HAL operation.
Reference, Template, Start, Board, BSP
File | Description |
---|---|
Templates_Board/Inc/main.h | Header for main.c module |
Templates_Board/Inc/stm32c0xx_hal_conf.h | HAL Configuration file |
Templates_Board/Inc/stm32c0xx_it.h | Interrupt handlers header file |
Templates_Board/Inc/stm32c0xx_nucleo_conf.h | BSP Configuration file |
Templates_Board/Src/main.c | Main program |
Templates_Board/Src/stm32c0xx_hal_msp.c | HAL MSP module |
Templates_Board/Src/stm32c0xx_it.c | Interrupt handlers |
Templates_Board/Src/system_stm32c0xx.c | STM32C0xx system source file |
This template runs on STM32C071x devices.
This template has been tested with STMicroelectronics NUCLEO-C071RB boards and can be easily tailored to any other supported device and development board.
In order to make the program work, you must do the following :