完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,伙计们。我最近在一个关于可寻址LED的论坛上看到了一个老帖子。这些在我的下一个项目中会很方便。我计划使用PIC32 MX250和这些。请参阅附件timangs.PNG文件。PIC的PBLK为40MHz,因此每小时刻度为25nS。我不想使用BIT。我想让你们知道我的想法,看看你们的想法。所以:一个零点是14个刻度,一个是36个-解码一个24位的颜色,每一个颜色为一个大的缓冲区24个字节,从而产生一个14和36的序列。RAM不是这个项目的关注点,我最多使用20个LED。在PWM模式下运行一个OC模块。它指出一旦一个周期结束,OCRS被使用,从而允许改变占空比无毛刺。-使用DMA来更新OCRS寄存器。DMA的启动IRQ与OC模块所使用的计时器相同。这似乎是可行的,请参阅附加范围图像。前2幅图像使用的是RiGOL上的自动特征,我不知道为什么它会强加脉冲。谁知道为什么?单模捕获似乎证实了该方法是可行的。这是我不确定的。由于DMA使用OC的计时器,当计时器中断发生2件事:-DMA从缓冲器更新OCRS OC模块使用新的OCRS值,但如何知道DMA在OC模块开始使用新的OCRS值之前更新OCRS?这2种操作不是同时发生的吗?谢谢您。
以上来自于百度翻译 以下为原文 Hi guys. I've recently seen an old thread on the forums about addressable leds. These would come handy in my next project. I plan on using a PIC32MX250 and these https://www.pololu.com/product/2536. See the attached timings.png file. The PIC's PBCLK is 40MHz thus 25ns per tick. I do not want to use bit banging. I want to run my idea by you and see what you guys think. So: - a ZERO is 14 ticks, a ONE is 36 - decode 24bit colors into 24bytes per color in a large buffer thus resulting in a sequence of 14 and 36. RAM is not a concern in this project and I would use up to 20 leds. - Run an OC module in PWM mode. It states that OCRS is used once a period is over thus allowing for changing the duty cycle glitch free. - Use DMA to update the OCRS register. The DMA's start IRQ is the same as the timer used for the OC module. This seems to work, see attached scope images. The first 2 images are using the AUTO feature on the RIGOL and I cannot tell why it super imposes the pulses. Anyone knows why? The single mode capture seems to confirm that the approach is feasible. Here is what I am not sure about. Since DMA uses the OC's timer, when the timer interrupt occurs 2 things happen: - DMA updates OCRS from the buffer - OC module uses new OCRS value But how do I know that the DMA gets to update OCRS before the OC module starts using the new OCRS value? Don't these 2 operations happen at the same time? Thank you. Attached Image(s) |
|
相关推荐
6个回答
|
|
了解你的武器,这就是范围的工作方式。它在每一个上升沿触发,并显示所有跟随触发器的波。这些波中的一些将是短脉冲,其中一些将是长的。你们都看到了。
以上来自于百度翻译 以下为原文 Know thy weapons. That's the way a scope works. It triggers on every rising edges and shows you all waves that follow the trigger. Some of these waves will be short pulses, some of them will be long. You see both. |
|
|
|
谢谢你,诺斯盖伊。这是有意义的。这是我的第一个范围,还有很多关于它的了解。回到DMA vs OC。一个很大的区别是,DMA从PBCLK中撤消了SysCLK和OC。在这种情况下,它们是相同的,PBDIV=1。我正在浏览CPU MK4数据表,希望能够解释或确认DMA可以在OC使用之前更新OCRS。它说DMA和USB、以太网一起在高速总线上,也许对内部设备有更深入理解的人可以澄清。
以上来自于百度翻译 以下为原文 Thank you NorthGuy. That makes sense. This is my first scope and there is a lot to know about it/them. Going back to DMA vs OC. The one big difference is that DMA works off SYSCLK and OC off the PBCLK. In this case they are the same, PBDIV = 1. I'm glancing over the CPU MK4 datasheet in hopes of an explanation or confirmation that DMA can update the OCRS before OC can use it. It says DMA is on the high speed bus along with USB, Ethernet. Maybe someone with a more deep understanding of the internals can clarify. |
|
|
|
DMA将无问题地更新OCRS.这里是它如何工作的时间:-OC模块触发DMA - DMA更新OCRS -一旦OC时钟滚过,OCRS加载到Organd等等。唯一的担心是DMA应该在OC时钟周期内完成传输。您还可以使用SPI(仅MOSI,没有时钟)代替OC。您需要4个SPI位。做一个脉冲。转移1110会产生很长的脉冲。转移1000会给你一个短脉冲。如果你使用32位SPI传输,这会给你每次传输8位——DMA上的负载减少8倍(和OC不同),即使DMA晚了,也不会有人受伤。
以上来自于百度翻译 以下为原文 DMA will update OCRS without problems. Here's how it works in time: - OC module triggers DMA - DMA updates OCRS - once the OC clock rolls over, OCRS gets loaded into OCR and so on. The only concern is that DMA should complete the transfer during the OC clock period. You can also use SPI (only MOSI, no clock) instead of OC. You'll need 4 SPI bits to make one pulse. Transferring 1110 will make a long pulse. Transferring 1000 will give you a short pulse. If you use 32-bit SPI transfers, this gives you 8 bits per transfer - 8 times less load on DMA and (unlike OC) even if DMA gets late, no one gets hurt. |
|
|
|
你比我描述的更佳:我打赌这个确切的序列,但是我不确定DMA是否在OC时钟期间完成。它似乎没有。SPI也将释放定时器用于奥坎这个PIC也可以忽略SDI索诺需要阅读SPIPUF。再次感谢诺斯盖伊。
以上来自于百度翻译 以下为原文 You rephrased it better than I described it :) I am betting on that exact sequence but I am not sure if DMA finishes during the OC clock period. It seems it does. SPI would also free up the timer used for OC and this PIC can also ignore SDI so no need to read SPIBUF. Nice! Thank you again NorthGuy. |
|
|
|
如果有问题,可以尝试调整BMXARB,让DMA更优先访问内存总线。
以上来自于百度翻译 以下为原文 If there's a problem with that, you can try to tweak BMXARB to give DMA more priority in accessing the memory bus. |
|
|
|
嗨,我已经使用了一个ChIPKIT PIC32 MX250。我的项目(只是一个演示)正在驱动一个60个SK68 12RGBW(4通道)LED的字符串。我用DMA从32字节的任何一个数组中驱动OC4,每个字节代表一个比特。它是为Chipkit(ARDUINO)编写的,但是使用了正常的。PIC寄存器的设置等,因此应该相当容易遵循和使用作为起点在MPLABX。你可以看到这个项目在这里。HTTPS://GITHUBCOM/CATMACEY/PIC32
以上来自于百度翻译 以下为原文 Hi, I've done pretty much this using a Chipkit PIC32MX250. My project (just a demo really) was driving a string of 60 SK6812 RGBW (4 channel) LEDs. I'm using the DMA to drive OC4 from any array of 32 bytes with each byte representing a single bit. It's written for Chipkit (Arduino) but uses the normal PIC registers for setup etc. so should be fairly easy to follow and use as a starting point in MPLABX. You can see the project here. https://github.com/Catmacey/PIC32_SK6812_DMA/ |
|
|
|
只有小组成员才能发言,加入小组>>
4779 浏览 9 评论
1815 浏览 8 评论
1734 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2941 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2043 浏览 5 评论
423浏览 1评论
1101浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
345浏览 0评论
253浏览 0评论
LAN9252使用SQI通信,进行数字复位后读BYTE_TEST异常
1751浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-3-29 21:20 , Processed in 1.059554 second(s), Total 81, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 深圳华秋电子有限公司
电子发烧友 (电路图) 粤公网安备 44030402000349 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号