STM32作为主控芯片,72Mhz,利用DMA+PWM实现驱动WS2812,创建16个并行800kBit / s数据流的想法如下: 使用定时器每1.25us创建一个800kHz的时基和一个DMA请求。 使用2个比较模块在低位时间(350ns)和高位时间(700ns)下创建DMA请求 1.25us DMA请求将GPIO端口的所有位设置为高电平 350ns DMA请求将数据从帧缓冲区传输到GPIO端口。如果该位为0,GPIO引脚将变为低电平,否则将保持高电平。 700ns DMA请求将所有GPIO引脚设置为低电平。 重复步骤1到3,直到发送所有位。 这产生脉冲周期为1.25us,脉冲宽度为350ns或700ns的脉冲流,具体取决于脉冲表示的位值,通过DMA将数据传输到GPIO端口意味着每16个LED每位需要一个字(两个字节)。每个LED 24位,每16个LED 24个字(48个字节)。
资源文件列表
【19】DMA PWM WS2812 GPIO输出16组/CORE/core_cm3.c , 17273
【19】DMA PWM WS2812 GPIO输出16组/CORE/core_cm3.h , 85714
【19】DMA PWM WS2812 GPIO输出16组/CORE/startup_stm32f10x_hd.s , 15503
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/misc.h , 8982
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_adc.h , 21690
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_bkp.h , 7555
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_can.h , 27559
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_cec.h , 6573
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_crc.h , 2162
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_dac.h , 15233
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_dbgmcu.h , 3818
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_dma.h , 20754
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_exti.h , 6824
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_flash.h , 25445
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_fsmc.h , 27016
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_gpio.h , 20175
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_i2c.h , 30029
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_iwdg.h , 3828
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_pwr.h , 4383
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_rcc.h , 30452
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_rtc.h , 3857
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_sdio.h , 21863
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_spi.h , 17725
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_tim.h , 52427
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_usart.h , 16548
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/inc/stm32f10x_wwdg.h , 2966
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/misc.c , 7046
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_adc.c , 47201
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_bkp.c , 8463
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_can.c , 45103
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_cec.c , 11656
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_crc.c , 3347
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_dac.c , 19087
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_dbgmcu.c , 5149
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_dma.c , 29607
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_exti.c , 6959
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_flash.c , 62551
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_fsmc.c , 35484
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_gpio.c , 23221
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_i2c.c , 45781
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_iwdg.c , 4916
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_pwr.c , 8759
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_rcc.c , 51271
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_rtc.c , 8598
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_sdio.c , 28933
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_spi.c , 30224
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_tim.c , 109159
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_usart.c , 38308
【19】DMA PWM WS2812 GPIO输出16组/FWLIB/src/stm32f10x_wwdg.c , 5735
【19】DMA PWM WS2812 GPIO输出16组/HARDWARE/LED/led.c , 685
【19】DMA PWM WS2812 GPIO输出16组/HARDWARE/LED/led.h , 97
【19】DMA PWM WS2812 GPIO输出16组/Listings/startup_stm32f10x_hd.lst , 51188
【19】DMA PWM WS2812 GPIO输出16组/Listings/Template.map , 81963
【19】DMA PWM WS2812 GPIO输出16组/Objects/core_cm3.crf , 3959
【19】DMA PWM WS2812 GPIO输出16组/Objects/core_cm3.d , 129
【19】DMA PWM WS2812 GPIO输出16组/Objects/core_cm3.o , 11376
【19】DMA PWM WS2812 GPIO输出16组/Objects/delay.crf , 348891
【19】DMA PWM WS2812 GPIO输出16组/Objects/delay.d , 1877
【19】DMA PWM WS2812 GPIO输出16组/Objects/delay.o , 385400
【19】DMA PWM WS2812 GPIO输出16组/Objects/led.crf , 349084
【19】DMA PWM WS2812 GPIO输出16组/Objects/led.d , 1848
【19】DMA PWM WS2812 GPIO输出16组/Objects/led.o , 385780
【19】DMA PWM WS2812 GPIO输出16组/Objects/main.crf , 353007
【19】DMA PWM WS2812 GPIO输出16组/Objects/main.d , 1658
【19】DMA PWM WS2812 GPIO输出16组/Objects/main.o , 389572
【19】DMA PWM WS2812 GPIO输出16组/Objects/misc.crf , 348874
【19】DMA PWM WS2812 GPIO输出16组/Objects/misc.d , 1711
【19】DMA PWM WS2812 GPIO输出16组/Objects/misc.o , 382856
【19】DMA PWM WS2812 GPIO输出16组/Objects/startup_stm32f10x_hd.d , 67
【19】DMA PWM WS2812 GPIO输出16组/Objects/startup_stm32f10x_hd.o , 6832
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_dma.crf , 351982
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_dma.d , 2008
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_dma.o , 386472
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_fsmc.crf , 354389
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_fsmc.d , 2041
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_fsmc.o , 407236
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_gpio.crf , 352372
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_gpio.d , 2041
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_gpio.o , 389212
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_it.crf , 348328
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_it.d , 1949
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_it.o , 383464
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_rcc.crf , 355947
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_rcc.d , 2008
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_rcc.o , 393688
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_tim.crf , 370960
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_tim.d , 2008
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_tim.o , 417344
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_usart.crf , 354485
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_usart.d , 2074
【19】DMA PWM WS2812 GPIO输出16组/Objects/stm32f10x_usart.o , 393348
【19】DMA PWM WS2812 GPIO输出16组/Objects/sys.crf , 348600
【19】DMA PWM WS2812 GPIO输出16组/Objects/sys.d , 1805
【19】DMA PWM WS2812 GPIO输出16组/Objects/sys.o , 384368
【19】DMA PWM WS2812 GPIO输出16组/Objects/system_stm32f10x.crf , 350052
【19】DMA PWM WS2812 GPIO输出16组/Objects/system_stm32f10x.d , 2030
【19】DMA PWM WS2812 GPIO输出16组/Objects/system_stm32f10x.o , 383352
【19】DMA PWM WS2812 GPIO输出16组/Objects/Template.axf , 363016
【19】DMA PWM WS2812 GPIO输出16组/Objects/Template.build_log.htm , 1874
【19】DMA PWM WS2812 GPIO输出16组/Objects/Template.hex , 29960
【19】DMA PWM WS2812 GPIO输出16组/Objects/Template.htm , 75636
【19】DMA PWM WS2812 GPIO输出16组/Objects/Template.lnp , 656
【19】DMA PWM WS2812 GPIO输出16组/Objects/Template.sct , 479
【19】DMA PWM WS2812 GPIO输出16组/Objects/Template_Template.dep , 27874
【19】DMA PWM WS2812 GPIO输出16组/Objects/usart.crf , 349642
【19】DMA PWM WS2812 GPIO输出16组/Objects/usart.d , 1922
【19】DMA PWM WS2812 GPIO输出16组/Objects/usart.o , 386656
【19】DMA PWM WS2812 GPIO输出16组/SYSTEM/delay/delay.c , 523
【19】DMA PWM WS2812 GPIO输出16组/SYSTEM/delay/delay.h , 117
【19】DMA PWM WS2812 GPIO输出16组/SYSTEM/SYS/sys.c , 107
【19】DMA PWM WS2812 GPIO输出16组/SYSTEM/SYS/sys.h , 144
【19】DMA PWM WS2812 GPIO输出16组/SYSTEM/USART/usart.c , 2511
【19】DMA PWM WS2812 GPIO输出16组/SYSTEM/USART/usart.h , 298
【19】DMA PWM WS2812 GPIO输出16组/user/main.c , 15687
【19】DMA PWM WS2812 GPIO输出16组/user/readme , 19846
【19】DMA PWM WS2812 GPIO输出16组/user/stm32f10x_conf.h , 3259
【19】DMA PWM WS2812 GPIO输出16组/user/stm32f10x_it.c , 4405
【19】DMA PWM WS2812 GPIO输出16组/user/stm32f10x_it.h , 2086
【19】DMA PWM WS2812 GPIO输出16组/user/system_stm32f10x.c , 36557
【19】DMA PWM WS2812 GPIO输出16组/user/Template.uvguix.Administrator , 138821
【19】DMA PWM WS2812 GPIO输出16组/user/Template.uvguix.SPT , 140483
【19】DMA PWM WS2812 GPIO输出16组/user/Template.uvoptx , 12729
【19】DMA PWM WS2812 GPIO输出16组/user/Template.uvprojx , 18396
