fozztexx / ws2812-demo Goto Github PK
View Code? Open in Web Editor NEWDemo & driver using the RMT peripheral of the ESP32 to control WS2812 RGB LEDs
Demo & driver using the RMT peripheral of the ESP32 to control WS2812 RGB LEDs
Hello, I just tried this with latest esp-idf 0a678ebe8c8bb78053f2a2dc4bd26124adde9122
I get repeated stack overflow errors every few seconds
Adityas-MacBook-Air:ws2812-demo Ady$ make monitor
--- forcing DTR inactive
--- forcing RTS inactive
--- Miniterm on /dev/tty.usbserial-AK05ER17 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0008,len:8
load:0x3fff0010,len:3388
ho 0 tail 12 room 4
load:0x40078000,len:7504
load:0x40080000,len:252
entry 0x40080034
I (48) boot: ESP-IDF v2.0-rc1-18-g0a678eb 2nd stage bootloader
I (48) boot: compile time 22:45:34
I (74) boot: Enabling RNG early entropy source...
I (74) boot: SPI Speed : 40MHz
I (81) boot: SPI Mode : DIO
I (93) boot: SPI Flash Size : 4MB
I (105) boot: Partition Table:
I (117) boot: ## Label Usage Type ST Offset Length
I (139) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (163) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (186) boot: 2 factory factory app 00 00 00010000 00100000
I (209) boot: End of partition table
I (222) boot: Disabling RNG early entropy source...
I (239) boot: Loading app partition at offset 00010000
I (726) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (727) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x061b4 ( 25012) map
I (743) boot: segment 2: paddr=0x000261c4 vaddr=0x3ffb0000 size=0x02428 ( 9256) load
I (773) boot: segment 3: paddr=0x000285f4 vaddr=0x40080000 size=0x00400 ( 1024) load
I (796) boot: segment 4: paddr=0x000289fc vaddr=0x40080400 size=0x13c8c ( 81036) load
I (860) boot: segment 5: paddr=0x0003c690 vaddr=0x400c0000 size=0x00000 ( 0) load
I (861) boot: segment 6: paddr=0x0003c698 vaddr=0x00000000 size=0x03970 ( 14704)
I (879) boot: segment 7: paddr=0x00040010 vaddr=0x400d0018 size=0x21c78 (138360) map
I (906) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (929) heap_alloc_caps: At 3FFB5650 len 0002A9B0 (170 KiB): DRAM
I (950) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (971) heap_alloc_caps: At 4009408C len 0000BF74 (47 KiB): IRAM
I (991) cpu_start: Pro cpu up.
I (1003) cpu_start: Starting app cpu, entry point is 0x40080a40
I (0) cpu_start: App cpu up.
I (1034) cpu_start: Pro cpu start user code
I (1298) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
I (1747) cpu_start: Starting scheduler on PRO CPU.
***ERROR*** A stack overflw[ in0 t;as3k 2wsm281I2 ra(inbow has been 734) cpu_start: Starting scheduler on APP CPU.
detected.
abort() was called at PC 0x40085184
Guru Meditation Error: Core 0 panic'ed (abort)
Backtrace: 0x4000beb4:0x3ffb9510 0x00000000:0x3ffb9530 0x40083742:0x3ffb9550 0x40084bc7:0x3ffb9570 0x40084c58:0x3ffb9590 0x400f0075:0x3ffb95d0 0x400efc77:0x3ffb95f0
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0008,len:8
load:0x3fff0010,len:3388
ho 0 tail 12 room 4
load:0x40078000,len:7504
load:0x40080000,len:252
entry 0x40080034
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0008,len:8
load:0x3fff0010,len:3388
ho 0 tail 12 room 4
load:0x40078000,len:7504
load:0x40080000,len:252
entry 0x40080034
I (48) boot: ESP-IDF v2.0-rc1-18-g0a678eb 2nd stage bootloader
I (48) boot: compile time 22:45:34
I (70) boot: Enabling RNG early entropy source...
I (70) boot: SPI Speed : 40MHz
I (81) boot: SPI Mode : DIO
I (93) boot: SPI Flash Size : 4MB
I (105) boot: Partition Table:
I (117) boot: ## Label Usage Type ST Offset Length
I (139) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (163) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (186) boot: 2 factory factory app 00 00 00010000 00100000
I (209) boot: End of partition table
I (222) boot: Disabling RNG early entropy source...
I (239) boot: Loading app partition at offset 00010000
I (726) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (727) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x061b4 ( 25012) map
I (743) boot: segment 2: paddr=0x000261c4 vaddr=0x3ffb0000 size=0x02428 ( 9256) load
I (773) boot: segment 3: paddr=0x000285f4 vaddr=0x40080000 size=0x00400 ( 1024) load
I (796) boot: segment 4: paddr=0x000289fc vaddr=0x40080400 size=0x13c8c ( 81036) load
I (860) boot: segment 5: paddr=0x0003c690 vaddr=0x400c0000 size=0x00000 ( 0) load
I (861) boot: segment 6: paddr=0x0003c698 vaddr=0x00000000 size=0x03970 ( 14704)
I (879) boot: segment 7: paddr=0x00040010 vaddr=0x400d0018 size=0x21c78 (138360) map
I (906) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (929) heap_alloc_caps: At 3FFB5650 len 0002A9B0 (170 KiB): DRAM
I (950) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (971) heap_alloc_caps: At 4009408C len 0000BF74 (47 KiB): IRAM
I (991) cpu_start: Pro cpu up.
I (1003) cpu_start: Starting app cpu, entry point is 0x40080a40
I (0) cpu_start: App cpu up.
I (1034) cpu_start: Pro cpu start user code
I (1309) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
I (1751) cpu_start: Starting scheduler on PRO CPU.
***ERROR*** A stack overflw[ in0 t;as3k 2wsm281I2 ra(inbow has been 738) cpu_start: Starting scheduler on APP CPU.
detected.
abort() was called at PC 0x40085184
Guru Meditation Error: Core 0 panic'ed (abort)
Backtrace: 0x4000beb4:0x3ffb9500 0x00000000:0x3ffb9520 0x40083742:0x3ffb9540 0x40084bc7:0x3ffb9560 0x40084c58:0x3ffb9580 0x400f0075:0x3ffb95c0 0x400efc77:0x3ffb95e0
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0008,len:8
load:0x3fff0010,len:3388
ho 0 tail 12 room 4
load:0x40078000,len:7504
load:0x40080000,len:252
entry 0x40080034
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0008,len:8
load:0x3fff0010,len:3388
ho 0 tail 12 room 4
load:0x40078000,len:7504
load:0x40080000,len:252
entry 0x40080034
I (48) boot: ESP-IDF v2.0-rc1-18-g0a678eb 2nd stage bootloader
I (48) boot: compile time 22:45:34
I (74) boot: Enabling RNG early entropy source...
I (74) boot: SPI Speed : 40MHz
I (81) boot: SPI Mode : DIO
I (93) boot: SPI Flash Size : 4MB
I (105) boot: Partition Table:
I (117) boot: ## Label Usage Type ST Offset Length
I (139) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (163) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (186) boot: 2 factory factory app 00 00 00010000 00100000
I (209) boot: End of partition table
I (222) boot: Disabling RNG early entropy source...
I (239) boot: Loading app partition at offset 00010000
I (726) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (727) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x061b4 ( 25012) map
I (743) boot: segment 2: paddr=0x000261c4 vaddr=0x3ffb0000 size=0x02428 ( 9256) load
I (773) boot: segment 3: paddr=0x000285f4 vaddr=0x40080000 size=0x00400 ( 1024) load
I (796) boot: segment 4: paddr=0x000289fc vaddr=0x40080400 size=0x13c8c ( 81036) load
I (860) boot: segment 5: paddr=0x0003c690 vaddr=0x400c0000 size=0x00000 ( 0) load
I (861) boot: segment 6: paddr=0x0003c698 vaddr=0x00000000 size=0x03970 ( 14704)
I (879) boot: segment 7: paddr=0x00040010 vaddr=0x400d0018 size=0x21c78 (138360) map
I (906) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (929) heap_alloc_caps: At 3FFB5650 len 0002A9B0 (170 KiB): DRAM
I (950) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (971) heap_alloc_caps: At 4009408C len 0000BF74 (47 KiB): IRAM
I (991) cpu_start: Pro cpu up.
I (1003) cpu_start: Starting app cpu, entry point is 0x40080a40
I (0) cpu_start: App cpu up.
I (1034) cpu_start: Pro cpu start user code
I (1330) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
I (1496) cpu_start: Starting scheduler on PRO CPU.
I **(*ERROR*** A stack o4ve8rf3low in task ws2812 rainb)ow has cpu_start: Starting scheduler on APP CPU.
been detected.
abort() was called at PC 0x40085184
Guru Meditation Error: Core 0 panic'ed (abort)
Backtrace: 0x4000beb4:0x3ffb9500 0x00000000:0x3ffb9520 0x40083742:0x3ffb9540 0x40084bc7:0x3ffb9560 0x40084c58:0x3ffb9580 0x400f0075:0x3ffb95c0 0x400efc77:0x3ffb95e0
Rebooting...
FYI, there's an open issue in the ESP IDF that affects my code as well as yours when built against master - basically, the RMT is no longer producing output.
I'm opening this issue so you are aware and can track it in case it turns out we need to make code changes in our respective projects as a result.
I want to use this library with IDF for making a LED indicator for our project.
I tried with demo but it fails to compile with following error
CC main.o
CC ws2812.o
In file included from /Users/shirishbytelens/esp/esp-idf/components/soc/esp32/include/soc/soc.h:20:0,
from /Users/shirishbytelens/esp/esp-idf/components/esp32/include/rom/ets_sys.h:21,
from /Users/shirishbytelens/esp/esp-idf/components/freertos/include/freertos/FreeRTOSConfig.h:108,
from /Users/shirishbytelens/esp/esp-idf/components/freertos/include/freertos/FreeRTOS.h:99,
from /Users/shirishbytelens/esp/ESP32-ws2812-demo-master/main/./ws2812.c:11:
/Users/shirishbytelens/esp/ESP32-ws2812-demo-master/main/./ws2812.c: In function 'ws2812_init':
/Users/shirishbytelens/esp/esp-idf/components/esp32/include/esp_assert.h:23:13: error: static assertion failed: "(Cannot use SET_PERI_REG_MASK for DPORT registers use DPORT_SET_PERI_REG_MASK)"
_Static_assert(__builtin_choose_expr(__builtin_constant_p(CONDITION), (CONDITION), 1), #MSG); \
^
/Users/shirishbytelens/esp/esp-idf/components/soc/esp32/include/soc/soc.h:138:38: note: in expansion of macro 'TRY_STATIC_ASSERT'
#define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(_r), (Cannot use OP for DPORT registers use DPORT_##OP));
^
/Users/shirishbytelens/esp/esp-idf/components/soc/esp32/include/soc/soc.h:229:13: note: in expansion of macro 'ASSERT_IF_DPORT_REG'
ASSERT_IF_DPORT_REG((reg), SET_PERI_REG_MASK); \
^
/Users/shirishbytelens/esp/ESP32-ws2812-demo-master/main/./ws2812.c:129:3: note: in expansion of macro 'SET_PERI_REG_MASK'
SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_RMT_CLK_EN);
Hello,
Firstly, thanks for making this!
I just got the latest esp-idf and built this with default menuconfig. I see a static pattern on my 8 led strip. I tried changing the number of pixels to 2, it then lights up only two pixels with red. However, I never see any rainbow animation. Is there any special SDK setting required in menuconfig for this peripheral to work?
This worked only with WS2812B devices (WS2812 failed). I looked at the signals with a logic analyzer and the values were way off. I suspect you had a typo that just happened to work given the particular ways WS2812s are timing tolerant in general - but they are very strict in other ways, which is why the older ones with slightly different specs failed.
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.