-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RMT Example (led_strip) doesn't work properly (IDFGH-10221) #11487
Comments
Hi @aquiot-inc when you see the "zero" frame, it's because the example is "clearing" the LEDs in here I think it's not a bug neither in the example nor the driver. The v4.4 version is also having this clearing logic: https://github.com/espressif/esp-idf/blob/release/v4.4/examples/peripherals/rmt/led_strip/main/led_strip_main.c#L111 |
diff --git a/examples/peripherals/rmt/led_strip/main/led_strip_example_main.c b/examples/peripherals/rmt/led_strip/main/led_strip_example_main.c
index f29c32184d..65cb57e066 100644
--- a/examples/peripherals/rmt/led_strip/main/led_strip_example_main.c
+++ b/examples/peripherals/rmt/led_strip/main/led_strip_example_main.c
@@ -118,9 +118,11 @@ void app_main(void)
}
// Flush RGB values to LEDs
ESP_ERROR_CHECK(rmt_transmit(led_chan, led_encoder, led_strip_pixels, sizeof(led_strip_pixels), &tx_config));
+ ESP_ERROR_CHECK(rmt_tx_wait_all_done(led_chan, portMAX_DELAY));
vTaskDelay(pdMS_TO_TICKS(EXAMPLE_CHASE_SPEED_MS));
memset(led_strip_pixels, 0, sizeof(led_strip_pixels));
ESP_ERROR_CHECK(rmt_transmit(led_chan, led_encoder, led_strip_pixels, sizeof(led_strip_pixels), &tx_config));
+ ESP_ERROR_CHECK(rmt_tx_wait_all_done(led_chan, portMAX_DELAY));
vTaskDelay(pdMS_TO_TICKS(EXAMPLE_CHASE_SPEED_MS));
}
start_rgb += 60; Maybe you can try the above fix to see if it helps. |
Thanks for having a look. Below gives a recognizable pattern. Especially since I only have 2 LEDs. The That being said, the reason I tried the example is because my app broke (was emitting strange pulse codes like all 1's when trying to write a dim red) when porting to the new framework. So I will have to revisit my actual app but in the meantime I'm just going to keep using the old framework for now. In the meantime, perhaps someone will create/update a component for driving RGB LEDs with the new framework. This for example: https://github.com/JSchaenzle/ESP32-NeoPixel-WS2812-RMT -#define RMT_LED_STRIP_GPIO_NUM 0
+#define RMT_LED_STRIP_GPIO_NUM 13
-#define EXAMPLE_LED_NUMBERS 24
+#define EXAMPLE_LED_NUMBERS 2
#define EXAMPLE_CHASE_SPEED_MS 10
static const char *TAG = "example";
static uint8_t led_strip_pixels[EXAMPLE_LED_NUMBERS * 3];
/**
* @brief Simple helper function, converting HSV color space to RGB color space
*
* Wiki: https://en.wikipedia.org/wiki/HSL_and_HSV
@@ -104,25 +104,28 @@ void app_main(void)
ESP_LOGI(TAG, "Start LED rainbow chase");
rmt_transmit_config_t tx_config = {
.loop_count = 0, // no transfer loop
};
while (1) {
for (int i = 0; i < 3; i++) {
for (int j = i; j < EXAMPLE_LED_NUMBERS; j += 3) {
// Build RGB pixels
hue = j * 360 / EXAMPLE_LED_NUMBERS + start_rgb;
- led_strip_hsv2rgb(hue, 100, 100, &red, &green, &blue);
+ led_strip_hsv2rgb(hue, 100, 10, &red, &green, &blue);
led_strip_pixels[j * 3 + 0] = green;
led_strip_pixels[j * 3 + 1] = blue;
led_strip_pixels[j * 3 + 2] = red;
}
// Flush RGB values to LEDs
ESP_ERROR_CHECK(rmt_transmit(led_chan, led_encoder, led_strip_pixels, sizeof(led_strip_pixels), &tx_config));
+ // ESP_ERROR_CHECK(rmt_tx_wait_all_done(led_chan, portMAX_DELAY));
vTaskDelay(pdMS_TO_TICKS(EXAMPLE_CHASE_SPEED_MS));
- memset(led_strip_pixels, 0, sizeof(led_strip_pixels));
- ESP_ERROR_CHECK(rmt_transmit(led_chan, led_encoder, led_strip_pixels, sizeof(led_strip_pixels), &tx_config));
- vTaskDelay(pdMS_TO_TICKS(EXAMPLE_CHASE_SPEED_MS));
+ // memset(led_strip_pixels, 0, sizeof(led_strip_pixels));
+ // ESP_ERROR_CHECK(rmt_transmit(led_chan, led_encoder, led_strip_pixels, sizeof(led_strip_pixels), &tx_config));
+ // ESP_ERROR_CHECK(rmt_tx_wait_all_done(led_chan, portMAX_DELAY));
+ // vTaskDelay(pdMS_TO_TICKS(EXAMPLE_CHASE_SPEED_MS));
}
- start_rgb += 60;
+ start_rgb += 5;
}
} |
Answers checklist.
IDF version.
v5.0.2
Operating System used.
Windows
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
CMD
Development Kit.
ESP32-WROOM
Power Supply used.
USB
What is the expected behavior?
The LED rainbow chase pattern is expected on the LEDs
What is the actual behavior?
The LEDs have a pattern that seems random. Sometimes RGB=[0,0,0] is sent to all LEDs. This was verified by a RIGOL scope.
Steps to reproduce.
Debug Logs.
More Information.
I have also tried with ESP-IDF v5.0.1, same result
I tried the example when my own code wasn't working as expected.
I was previously using ESP-IDF v4.4 with the old driver
#include "driver/rmt.h"
and it worked fine. The old deprecated driver will also work properly in v5.0.x. Only"driver/rmt_tx.h"
doesn't work properly.Example of all pixel values of zero (this should not happen):
At other times, the pattern looks more like expeted:
The text was updated successfully, but these errors were encountered: