登录
首页 » C/C++ » 【19】DMA PWM WS2812 GPIO输出16组

【19】DMA PWM WS2812 GPIO输出16组

于 2020-12-15 发布 文件大小:2318KB
0 82
下载积分: 1 下载次数: 86

代码说明:

  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个字节)。(The idea to create 16 parallel 800kBit/s data streams is the following: Use a Timer to create an 800kHz time base and a DMA request every 1.25us. Use 2 compare modules to create DMA requests at the low bit time (350ns) and the high bit time (700ns) The 1.25us DMA request sets all bits of the GPIO port high The 350ns DMA request transfers the data from the frame buffer to the GPIO port. If the bit is a 0, the GPIO pin will go low, otherwise it will stay high. The 700ns DMA request sets all GPIO pins low. Repeat steps 1 to 3 until all bits have been transmitted. This creates a stream of pulses with a pulse period of 1.25us and a pulse width of either 350ns or 700ns depending on the bit value the pulse represents. Transferring the data via DMA to the GPIO port means that per 16 LEDs one half word (two bytes) is needed per bit. At 24 bits per LED that makes 24 half words (48 bytes) per 16 LEDs.)

文件列表:

【19】DMA PWM WS2812 GPIO输出16组\CORE\core_cm3.c
【19】DMA PWM WS2812 GPIO输出16组\CORE\core_cm3.h
【19】DMA PWM WS2812 GPIO输出16组\CORE\startup_stm32f10x_hd.s
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\misc.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_adc.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_bkp.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_can.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_cec.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_crc.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_dac.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_dbgmcu.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_dma.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_exti.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_flash.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_fsmc.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_gpio.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_i2c.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_iwdg.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_pwr.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_rcc.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_rtc.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_sdio.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_spi.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_tim.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_usart.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\inc\stm32f10x_wwdg.h
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\misc.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_adc.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_bkp.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_can.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_cec.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_crc.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_dac.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_dbgmcu.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_dma.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_exti.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_flash.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_fsmc.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_gpio.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_i2c.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_iwdg.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_pwr.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_rcc.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_rtc.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_sdio.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_spi.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_tim.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_usart.c
【19】DMA PWM WS2812 GPIO输出16组\FWLIB\src\stm32f10x_wwdg.c
【19】DMA PWM WS2812 GPIO输出16组\HARDWARE\LED\led.c
【19】DMA PWM WS2812 GPIO输出16组\HARDWARE\LED\led.h
【19】DMA PWM WS2812 GPIO输出16组\Listings\startup_stm32f10x_hd.lst
【19】DMA PWM WS2812 GPIO输出16组\Listings\Template.map
【19】DMA PWM WS2812 GPIO输出16组\Objects\core_cm3.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\core_cm3.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\core_cm3.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\delay.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\delay.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\delay.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\led.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\led.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\led.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\main.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\main.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\main.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\misc.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\misc.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\misc.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\startup_stm32f10x_hd.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\startup_stm32f10x_hd.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_dma.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_dma.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_dma.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_fsmc.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_fsmc.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_fsmc.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_gpio.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_gpio.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_gpio.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_it.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_it.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_it.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_rcc.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_rcc.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_rcc.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_tim.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_tim.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_tim.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_usart.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_usart.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\stm32f10x_usart.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\sys.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\sys.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\sys.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\system_stm32f10x.crf
【19】DMA PWM WS2812 GPIO输出16组\Objects\system_stm32f10x.d
【19】DMA PWM WS2812 GPIO输出16组\Objects\system_stm32f10x.o
【19】DMA PWM WS2812 GPIO输出16组\Objects\Template.axf
【19】DMA PWM WS2812 GPIO输出16组\Objects\Template.build_log.htm
【19】DMA PWM WS2812 GPIO输出16组\Objects\Template.hex

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696518资源总数
  • 104228会员总数
  • 45今日下载