Coder Social home page Coder Social logo

crazy-geeks / stm32-argb-dma Goto Github PK

View Code? Open in Web Editor NEW
81.0 2.0 23.0 4.32 MB

STM32 Library for Addressable LEDs: WS2812(b), WS2811, SK6812, etc. Supports RGB & RGBW LEDs.

License: MIT License

C 100.00%
dma cubemx peripheral pwm timer-channel stm32 stm32f103 ws2812b ws2812 led

stm32-argb-dma's People

Contributors

crazy-geeks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

stm32-argb-dma's Issues

Работа библиотеки на stm32f407vet

В процах серии 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 (выбор серии проца).

Stuck in busy HAL_DMA_STATE_BUSY

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" :
image

Unfortunatlly, I the execution get stuck in the second ARGB_show() call. Whane checking DMA_HANDLE.State it is HAL_DMA_STATE_BUSY.

Please find my configs :
image

image

image

image

image

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

Incorrect signals on STM32F411

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:

image

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:

image

Timer configuration:

image

RCC configuration:

image

STM32F030K6T6 What I'm doing wrong?

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.

Screens:
obraz
obraz
obraz
obraz

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}`

Where we can took libraries

where to get

#include "stm32_dma.h"
#include "pwm.h"
#include "math.h"

??

this is not a part of HAL package

Work frequency

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.