完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
我有三个DMA通道从内存缓冲器输出到SPI,DMA设置在定时器中断例程(VGA生成)中发生,我遇到一个问题,当缓冲存储器被主程序中的代码更新时,DMA的输出不会改变。如果我做了第二次改变,DMA然后更新到前一个。即内存正确更新,但DMA直到另一个内存访问发生时才看到变化。如果从程序的不同部分进行内存读取,DMA输出也会自行校正。我试着把一个读放到更新例程中,但是缓存太聪明了,不能被删除,DMA保持不正确。看来内存更新被困在缓存中,或者优化器正在保持寄存器的变化。我认为这是缓存,因为我已经尝试用AyAtAtditTyx编译内存写代码((优化(-O0))),并且更改是多字节的。有没有办法确保物理内存写回在我的更新缓冲程序结束时被强制。我已经看过了关于VILO V2.01B文档中PLIB预取缓存库的章节,但是看不到我需要做什么。谢谢所有的建议。
以上来自于百度翻译 以下为原文 I've got three DMA channels outputting from a buffers in memory to SPI with the DMA setup happening inside a timer interrupt routine (VGA generation) I'm having a problem that when the buffer memory is updated by code in the main program the output from the DMA doesn't change. If I then do a second change the DMA then updates to the previous one. i.e. the memory is updating properly but the DMA isn't seeing the change until another memory access happens. The DMA output also corrects itself if I do a memory read from within a different part of the program. I've tried putting a read into the update routine but the caching is too clever to fall for that and the DMA stays incorrect. It appears that the memory update is stuck in cache and/or the optimiser is keeping the change in registers. I think it is the caching because I have tried compiling the memory write code with __attribute__((optimize("-O0"))) and the changes are for many bytes. Is there a way to ensure that physical memory write-back is forced at the end of my update buffer routine. I've looked at the chapter on the plib pre-fetch cache library in the HARMony v2.01b documentation but can't see what I need to do. Thanks for all suggestions. |
|
相关推荐
4个回答
|
|
|
|
|
|
“你用的是什么芯片?”对不起:PIC32 MZ2048 EFH100
以上来自于百度翻译 以下为原文 "What chip are you using?" Sorry: PIC32MZ2048EFH100 |
|
|
|
您可以将缓冲区声明为相干的(如果是静态的)或者使用_u pic32_alloc_.()(如果是动态的),这将在未缓存的kseg1地址空间中分配它们,或者在DMA传输之前刷新缓存(u builtin_mips_cache(int op,const volatile void*addr))。che()函数,参见MIPS∈程序员体系结构II-A卷:MIPS32∈指令集手册,可从Imagi.Tech网站获得。
以上来自于百度翻译 以下为原文 You can either declare the buffers as coherent (if static) or use __pic32_alloc_coherent() (if dynamic), which will allocate them in un-cached kseg1 address space, or flush the cache prior to DMA transfer (__builtin_mips_cache(int op, const volatile void *addr)). e.g. uint8_t __attribute__((coherent)) buffer[1024]; uint8_t* buffer=__pic32_alloc_coherent(1024); ... __pic32_free_coherent(buffer); For use of the __builtin_mips_cache() function, see the MIPS® Architecture for Programmers Volume II-A: The MIPS32® Instruction Set Manual available from the Imagination Tech website. |
|
|
|
非常感谢——这给了我所需要的线索。
以上来自于百度翻译 以下为原文 Many thanks - that gave me the clue I needed. I eventually used myuncachedbuffer =__PIC32_UNCACHED_PTR ((uint32_t *)&_splim); to reserve the DMA buffer at the bottom of RAM |
|
|
|
只有小组成员才能发言,加入小组>>
5142 浏览 9 评论
1990 浏览 8 评论
1918 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3159 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2215 浏览 5 评论
710浏览 1评论
598浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
481浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
610浏览 0评论
508浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-10 16:02 , Processed in 0.967062 second(s), Total 51, Slave 46 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号