完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在努力在任何处理器上使用DMA,我想确保我已经正确配置了DMA模块。这里的目标是在没有处理器干预的情况下通过SPI发送阵列的内容。最终设计将实现AN1606来驱动一串WS28 11 LED。我已经在PIC16F18325上工作了,但是我想把它移植到PIC18F25K42。为什么?因为我能。除了我还不能,因为DMA似乎不起作用。直接将值推送到SPI1TXB中,所以我假设问题是用DMA。1。我无法从数据表中确定是否需要启用全局中断和/或特定外围中断(SPI1TX),以便使用硬件触发。是硬件触发仅基于中断标志,还是我真的需要启用中断来工作?如果它只是标志,这意味着不需要启用中断,对不对?2。我的DMA1SSA和DMA1DSA的作业是否正确?把这些转换成Uti1616T是很尴尬的,但是因为它们代表一个物理地址,所以我想不出它们会是什么类型。3。假设所有其他外围设备都被正确配置,我希望设置DMA1CON0BITS。SIRQEN=1将导致阵列被发送一次,然后DMA模块将停止发送数据,直到我再次设置该标志。我能正确地理解这一点吗?
以上来自于百度翻译 以下为原文 I'm making my first effort at using DMA on any processor, and I want to make sure I've configured the DMA module correctly. The goal here is to transmit the contents of an array via SPI without processor intervention. The final design will implement AN1606 to drive a string of WS2811 LEDs. I already have this working on a PIC16F18325 but I want to port it to a PIC18F25K42. Why? Because I can. Except I can't yet because DMA doesn't seem to be working. Pushing values directly into SPI1TXB works, so I'm assuming the problem is with DMA. 1. I couldn't determine from the data sheet if global interrupts and/or the specific peripheral interrupt (SPI1TX) need to be enabled in order to use hardware triggering. Is hardware triggering based only on the interrupt flag or do I actually need to enable interrupts for this to work? If it's only the flag, this means no interrupts need to be enabled, right? 2. Are my assignments for DMA1SSA and DMA1DSA correct? It feels awkward to cast these to uint16_t but since they represent a physical address I can't think of what other type they would be. 3. Assuming all other peripherals are configured correctly, I would expect setting DMA1CON0bits.SIRQEN = 1 would cause the array to be transmitted once, and then the DMA module would stop sending data until I set that flag again. Am I understanding this correctly? void InitDMA(void) { DMA1CON1bits.SMR = 0b00; /* DMA1 source memory region is GPR/SFR */ DMA1CON1bits.SMODE = 0b01; /* DMA1 source pointer increments after each transfer */ DMA1CON1bits.SSTP = 1; /* Clear DMA1 SIRQEN when source counter reloads */ DMA1CON1bits.DMODE = 0b00; /* DMA1 destination pointer remains unchanged after transfer */ DMA1CON1bits.DSTP = 0; /* Do not clear SIRQEN when destination counter reloads */ DMA1SSA = (uint16_t)(colorData); /* DMA1 source is colorData array */ DMA1DSA = (uint16_t)(&SPI1TXB); /* DMA1 destination is SPI1 transmit buffer */ DMA1SSZ = MAX_LED_INDEX + 1; /* DMA1 source size is length of colorData array */ DMA1DSZ = 1; /* DMA1 destination size is 1 */ DMA1SIRQ = 21; /* DMA1 source trigger IRQ is SPI1TX */ DMA1CON0bits.EN = 1; /* Enable DMA1 */ } |
|
相关推荐
1个回答
|
|
我完全错过了第17.9部分中的步骤7(包括锁定系统仲裁器优先级)。这就是问题所在。现在开始工作了。谢谢你的帮助。
以上来自于百度翻译 以下为原文 I completely missed step 7 in section 17.9 (which includes locking the system arbiter priorities). That was the problem. It's working now. Thanks for the help. |
|
|
|
只有小组成员才能发言,加入小组>>
5170 浏览 9 评论
2001 浏览 8 评论
1931 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3176 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2228 浏览 5 评论
737浏览 1评论
622浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
509浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
635浏览 0评论
531浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 21:04 , Processed in 1.260268 second(s), Total 79, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号