再问如何以DMA方式产生互补的两路PWM信号

所属分类:ST其他产品 浏览数:408 提问者:calljiqing 提问时间:2017-10-12
标签:STM32PWMDMA

问:

前几天经高手指点,学会了借助TIM_CCxChannelCmd以及HAL_TIM_PWM_Start_DMA和HAL_TIMEx_PWMN_Start_DMA实现了同一DMA通道的两路互补PWM。但是如果想实现第二个和第三个DMA通道的两路互补PWM(一共6路PWM)却遇到新问题: 我做了一下测试,第一个DMA通道的两路互补PWM总是屏蔽后面通道的所有PWM,如果删掉第一个通道,第二个通道的两路互补PWM就会正常显现,以此类推。难道还需要做其它什么设置吗? 有点急,请再赐教,见谅。


答:hi,不知你是否就是想利用DMA同时传输下CCR1/2/3寄存器的值。若是, 感觉你搞复杂了。你看下手册关于定时器DMA传输的部分。不看手册是要不得地。 Example of how to use the DMA burst feature In this example the timer DMA burst feature is used to update the contents of the CCRx registers (x = 2, 3, 4) with the DMA transferring half words into the CCRx registers. This is done in the following steps: 1. Configure the corresponding DMA channel as follows: – DMA channel peripheral address is the DMAR register address – DMA channel memory address is the address of the buffer in the RAM containing the data to be transferred by DMA into CCRx registers. – Number of data to transfer = 3 (See note below). – Circular mode disabled. 2. Configure the DCR register by configuring the DBA and DBL bit fields as follows: DBL = 3 transfers, DBA = 0xE. 3. Enable the TIMx update DMA request (set the UDE bit in the DIER register). 4. Enable TIMx 5. Enable the DMA channel
回答者:xmshao 回答时间:2017-10-12

登录后回答。
图书推荐
STM32 HAL库开发实战指南

STM32 HAL库开发实战指南

基于野火挑战者F7开发板和HAL库,全书共980页,全书由浅入深,步步为营,有广度也有深度。
Beginning STM32: Developing with FreeRTOS, libopencm3 and GCC

Beginning STM32: Developing with FreeRTOS, libopencm3 and GCC

Using FreeRTOS and libopencm3 instead of the Arduino software environment, ...
Programming With STM32 : Getting Started With the Nucleo Board

Programming With STM32 : Getting Started With the Nucleo Board

Get up and running programming the STM32 line using the hands-on information ...
广告