crazy-geeks / stm32-argb-dma Goto Github PK
View Code? Open in Web Editor NEWSTM32 Library for Addressable LEDs: WS2812(b), WS2811, SK6812, etc. Supports RGB & RGBW LEDs.
License: MIT License
STM32 Library for Addressable LEDs: WS2812(b), WS2811, SK6812, etc. Supports RGB & RGBW LEDs.
License: MIT License
В процах серии f4xx (проверял конкретно на f407vet, но скорее всего и на других этой серии так же), тактирование таймеров от от шин APB, отличается о тех что указаны в библиотеке. В коде использую таймер 1 с DMA2 CH2.
Для себя сделал следующую коррекцию файла ARGB.c :
/// Timer's RCC Bus
// #if TIM_NUM == 1 || (TIM_NUM >= 8 && TIM_NUM <= 11)
// #define APB1
// #else
// #define APB2
// #endif
/// Timer's RCC Bus (для stm32f407VET) //отредактировал ShadowPRM
#if (TIM_NUM >= 2 && TIM_NUM <= 7) || (TIM_NUM >= 12 && TIM_NUM <= 14)
#define APB1
#else
#define APB2
#endif
Первоисточник: RM0090 Reference manual STM32F405/415, STM32F407/417, STM32F427/437 and STM32F429/439 advanced Arm®-based 32-bit MCUs (с.180).
Дополнительная информация: https://microsin.net/programming/arm/stm32-timers-clocked-from-internal-clock-frequency-apb1-i-apb2.html
Можно прошерстить разные серии процов и написать опцию в ARGB.c (выбор серии проца).
The datasheet is for SK6812 RGB but the implementation is for SK6812 RGBW.
Hello Crazy-Geeks,
Thank you for this lib. I try to add it to my Nucleo G0B1RE project but I have several problems.
First of all I had to change APBfq init because of "implicit declaration of function" :
Unfortunatlly, I the execution get stuck in the second ARGB_show() call. Whane checking DMA_HANDLE.State it is HAL_DMA_STATE_BUSY.
I use a picoscope for debugging which is directly connected to the TIM4_CHANNEL1 pin and the it stays low.
Do you think the problem comes from the APBfq changes ? Could you please help me find out where does the problem comes from ?
Thank you for your time.
antoi-q
Hi there,
Thanks for all the work in putting this together, very clear code & instructions. I am trying to use this lib on an STM32F411 (Nucleo STM32F411RE) and the output signal is incorrect:
This is the signal supposed to be sent for to clear a strip of one pixel:
ARGB_Init(); // Initialization
ARGB_Clear(); // Clear strip
while (ARGB_Show() != ARGB_OK); // Update - Option 1
//ARGB_SetBrightness(100); // Set global brightness to 40%
//ARGB_SetRGB(2, 0, 255, 0); // Set LED №3 with 255 Green
//while (!ARGB_Show()); // Update - Option 2
//ARGB_SetHSV(0, 0, 255, 255); // Set LED №1 with Red
//while (!ARGB_Ready()); // Update - Option 3
//ARGB_Show();
//ARGB_FillWhite(230); // Fill all white component with 230
//while (ARGB_Ready() == ARGB_BUSY); // Update - Option 4
//ARGB_Show();
//ARGB_FillRGB(200, 0, 0); // Fill all the strip with Red
//while (!ARGB_Show());
I have checked all the CubeMX configuration which is as per your instructions and really don't understand what's happening. Any idea?
For reference, here is my clock configuration:
Timer configuration:
RCC configuration:
In this method:
Line 173 in d64712f
Hi!
I'm trying to run this library on STM32F030K6T6, but I have a trouble with it.
All configs are correctly set, but the frequency is 4 times slower than that supposed to.
Of course I added the TIM_NUM 17 to ARGB.c and hard-coded frequency, which should not effect on performance:
void ARGB_Init(void) { u32_t APBfq = 48000000; // Clock freq #ifdef WS2811S
ARGB.h:
`#define WS2812 ///< Family: {WS2811S, WS2811F, WS2812, SK6812}
// WS2811S — RGB, 400kHz;
// WS2811F — RGB, 800kHz;
// WS2812 — GRB, 800kHz;
// SK6812 — RGBW, 800kHz
#define NUM_PIXELS 100 ///< Pixel quantity
#define USE_GAMMA_CORRECTION 1 ///< Gamma-correction should fix red&green, try for yourself
#define TIM_NUM 17 ///< Timer number
#define TIM_CH TIM_CHANNEL_1 ///< Timer's PWM channel
#define DMA_HANDLE hdma_tim17_ch1_up ///< DMA Channel
#define DMA_SIZE_WORD ///< DMA Memory Data Width: {.._BYTE, .._HWORD, .._WORD}`
Fix info about buffer width in CubeMX
Compile Doxygen page
where to get
#include "stm32_dma.h"
#include "pwm.h"
#include "math.h"
??
this is not a part of HAL package
Now strip works only when APB frequency is 72 MHz. I tried to set it to 8 MHz and change counter to 9 (8x10^6/8x10^5 = 10), but strip didn't work at all. In several weeks I'll buy logic analizator to watch what happens at GPIO pin.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.