WS2812-LED-Driver_ChibiOS for ST_NUCLEO64_F411RE
Posted: Mon Feb 10, 2020 4:55 pm
Hello everybody,
based on the WS2812-LED-Driver_ChibiOS [1] project, I would like to control WS2812 leds.
When looking into the reference manual [2] on page 170, I decided to use the following setup:
#define PORT_WS2812 GPIOA // GPIO group
#define PIN_WS2812 1 // GPIO pin in group
#define WS2812_TIM_N 5 // timer, 1-11
#define WS2812_TIM_CH 3 // timer channel, 0-3
#define WS2812_DMA_STREAM STM32_DMA1_STREAM0 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection)
#define WS2812_DMA_CHANNEL 6 // DMA channel for TIMx_UP
halconf.h: (modified or appended to the file as found in the board specific demo)
[...]
#define HAL_USE_PWM TRUE
[...]
#define STM32_DMA_REQUIRED TRUE
mcuconf.h: (modified or appended to the file as found in the board specific demo)
[...]
#define STM32_PWM_USE_TIM5 TRUE
[...]
Makefile: (the most important section probably)
[...]
# Define project name here
PROJECT = ch
# Target settings.
MCU = cortex-m4
# Imported source files and paths.
#CHIBIOS = ../ChibiOS-master
CHIBIOS = ../ChibiOS-19.1.x
#CHIBIOS = ../ChibiOS-19.1.3
#CHIBIOS = ../ChibiOS-16.x
CONFDIR := ./cfg
BUILDDIR := ./build
DEPDIR := ./.dep
# Licensing files.
include $(CHIBIOS)/os/license/license.mk
# Startup files.
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
include $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F411RE/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Auto-build files in ./source recursively.
include $(CHIBIOS)/tools/mk/autobuild.mk
# Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32F411xE.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(ALLCSRC) \
$(TESTSRC) \
ws2812.c \
main.c
[...]
The firmware is built based on the stable_19.x branch.
Is there anything I missed? Anything that changed since ChibiOS 16.x, which needs to be done?
My level of expertise: I'm new to this level of microcontroller programming. Got my first touch on ChibiOS around 2 weeks ago. So I know the basic build up and I'm interested to program drivers (interop libraries) for the nanoframework.
Already, many thanks for any help!
- Thomas
[1] https://github.com/joewa/WS2812-LED-Driver_ChibiOS
[2] https://www.st.com/content/ccc/resource ... 119316.pdf
based on the WS2812-LED-Driver_ChibiOS [1] project, I would like to control WS2812 leds.
When looking into the reference manual [2] on page 170, I decided to use the following setup:
#define PORT_WS2812 GPIOA // GPIO group
#define PIN_WS2812 1 // GPIO pin in group
#define WS2812_TIM_N 5 // timer, 1-11
#define WS2812_TIM_CH 3 // timer channel, 0-3
#define WS2812_DMA_STREAM STM32_DMA1_STREAM0 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection)
#define WS2812_DMA_CHANNEL 6 // DMA channel for TIMx_UP
halconf.h: (modified or appended to the file as found in the board specific demo)
[...]
#define HAL_USE_PWM TRUE
[...]
#define STM32_DMA_REQUIRED TRUE
mcuconf.h: (modified or appended to the file as found in the board specific demo)
[...]
#define STM32_PWM_USE_TIM5 TRUE
[...]
Makefile: (the most important section probably)
[...]
# Define project name here
PROJECT = ch
# Target settings.
MCU = cortex-m4
# Imported source files and paths.
#CHIBIOS = ../ChibiOS-master
CHIBIOS = ../ChibiOS-19.1.x
#CHIBIOS = ../ChibiOS-19.1.3
#CHIBIOS = ../ChibiOS-16.x
CONFDIR := ./cfg
BUILDDIR := ./build
DEPDIR := ./.dep
# Licensing files.
include $(CHIBIOS)/os/license/license.mk
# Startup files.
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
include $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F411RE/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Auto-build files in ./source recursively.
include $(CHIBIOS)/tools/mk/autobuild.mk
# Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32F411xE.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(ALLCSRC) \
$(TESTSRC) \
ws2812.c \
main.c
[...]
The firmware is built based on the stable_19.x branch.
Is there anything I missed? Anything that changed since ChibiOS 16.x, which needs to be done?
My level of expertise: I'm new to this level of microcontroller programming. Got my first touch on ChibiOS around 2 weeks ago. So I know the basic build up and I'm interested to program drivers (interop libraries) for the nanoframework.
Already, many thanks for any help!
- Thomas
[1] https://github.com/joewa/WS2812-LED-Driver_ChibiOS
[2] https://www.st.com/content/ccc/resource ... 119316.pdf