STM32 LED Strip (WS2812b) control 1: Theory and implementation

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ธ.ค. 2024

ความคิดเห็น •

  • @steppeschool3629
    @steppeschool3629  2 ปีที่แล้ว

    I am happy to announce that I have a Patreon page🙂 where you can access projects' source code, including this one: patreon.com/user?u=80399744&Link&

  • @brianblasius
    @brianblasius 11 หลายเดือนก่อน +3

    I understand how these addressable LEDs work after watching this video. Keep doing great work. 💪

  • @amiral3187
    @amiral3187 11 หลายเดือนก่อน +1

    It works well but I'm a bit confused about the data structure newpixel_led, why are you using uint16_t instead of uint8_t? and why a 3 elements of that size if every color is represented with only 8-bits?

    • @steppeschool3629
      @steppeschool3629  11 หลายเดือนก่อน

      Hi,
      If we look at the data structure:
      typedef struct
      {
      uint16_t g[8];
      uint16_t r[8];
      uint16_t b[8];
      } neopixel_led;
      Each member is an array with 8 elements, corresponding to the number of bits per color. For each bit, we need to generate a PWM signal with a particular duty cycle. For that purpose, we need 16-bit values. Hope I could answer your question.

  • @20LBEeee002SRINIVASAN
    @20LBEeee002SRINIVASAN 5 หลายเดือนก่อน

    hey I have one doubt I want to connect more led stripes in parallel then i want use the different timer pwm but I have problem in the configuration DMA request another timer dma does not show that dma trigger option But I will change the code like that but my code run only single timer In my main c this for tim 2 reset_all_leds(leds, NUMBER_OF_LEDS);
    HAL_TIM_PWM_Start_DMA(&htim2, TIM_CHANNEL_3, (uint32_t*)leds, NUMBER_OF_LEDS1 * 24 + 24);
    HAL_Delay(300);
    set_all_leds(leds, NUMBER_OF_LEDS1);
    HAL_TIM_PWM_Start_DMA(&htim2, TIM_CHANNEL_3, (uint32_t*)leds, NUMBER_OF_LEDS1 * 24 + 24); and
    this one is same code
    tim 3
    led_pos_counter++;
    if(led_pos_counter == NUMBER_OF_LEDS)
    {
    led_pos_counter = 0;
    }
    temp_neo_pixel = circular_pattern_led[led_pos_counter + NUMBER_OF_LEDS];
    circular_pattern_led[led_pos_counter + NUMBER_OF_LEDS];
    circular_pattern_led[2* NUMBER_OF_LEDS];
    HAL_TIM_PWM_Start_DMA(&htim3, TIM_CHANNEL_1, (uint32_t*)&circular_pattern_led[led_pos_counter], NUMBER_OF_LEDS * 24 + 24);
    HAL_Delay(100);
    circular_pattern_led[led_pos_counter + NUMBER_OF_LEDS] = temp_neo_pixel;