From 560440a5221cf0fdbf2063cb8a76eb0e8bcb884d Mon Sep 17 00:00:00 2001 From: Adam Green Date: Sat, 30 Dec 2023 19:08:37 -0800 Subject: [PATCH] WS2812: Support more than 5 pins in parallel mode ws2812_parallel_program_init() contained an unneeded call to sm_config_set_set_pins(). When this is called with the pin_count parameter set to a value larger than 5, the set pin count value in the pinctrl register overflows into the side-set pin count. This can result in hard to diagnose issues where low numbered GPIO pins don't work as expected. There is an existing valid_params_if() check in sm_config_set_set_pins() which would catch this error but it is ignored in Release builds. This commit just removes this sm_config_set_set_pins() call as SET commands aren't even used by the associated PIO code. Discovered when trying to explain symptoms noted in this forum thread: https://forums.raspberrypi.com/viewtopic.php?t=362071 --- pio/ws2812/ws2812.pio | 1 - 1 file changed, 1 deletion(-) diff --git a/pio/ws2812/ws2812.pio b/pio/ws2812/ws2812.pio index 3c31fd6c9..4df772a74 100644 --- a/pio/ws2812/ws2812.pio +++ b/pio/ws2812/ws2812.pio @@ -72,7 +72,6 @@ static inline void ws2812_parallel_program_init(PIO pio, uint sm, uint offset, u pio_sm_config c = ws2812_parallel_program_get_default_config(offset); sm_config_set_out_shift(&c, true, true, 32); sm_config_set_out_pins(&c, pin_base, pin_count); - sm_config_set_set_pins(&c, pin_base, pin_count); sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX); int cycles_per_bit = ws2812_parallel_T1 + ws2812_parallel_T2 + ws2812_parallel_T3;