完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我试图用UDB编辑器创建一个16位加法器。首先,这是可能的吗?看来,如果我想要一个带有48个“引脚”的设备,我可能没有足够的寄存器来处理两个输入字和一个输出字。
我想背景可能会有帮助。我试图建立DMA以允许写入(至少),并且理想地也可以从SRAM上的4K阵列上读取PSoC 5(也可能是PSoC 4)。我有一个16位地址总线实现两套8 GPIO引脚。来自外部总线的访问是随机的,一次一个字节。R/W引脚指示数据流的方向,并且还有另外8个引脚用于D0—D7。目前在SRAM中写入单个UIT8的效果良好,但不能基于GPIO地址来处理多个位置。 我认为我需要的是这个加法器,所以我可以在启动时把它加载到数组的基地址,并将它添加到来自地址总线的较低12位的数组中的偏移量。 我一直在寻找索引的DMA解决方案,但是关于它的文档非常稀少,我仍然看不出它会怎么做我需要的。据我所知,索引DMA工作,如果你可以从其他地方获得绝对目的地地址。我可以得到相对偏移,但不是绝对地址…因此需要(我想)加法器。我确实看到Keil编译器允许在SRAM中进行一些明确的对象定位,但我使用的是GCC。 所以,我目前在UDB编辑器中的目标是这个加法器。很容易看到如何设置一些指令和状态机状态来从D0加载A0,然后将A0添加到D1,并从ALUUT中获得结果。我无法看到的是如何正确地在组件中使用字节或字宽的接口,这样我就可以将它们连接到我的PIN。UDB设计器允许我添加单针/位输入,它还允许我添加设计范围变量(但设计范围变量似乎几乎没有文件……)什么是注册与组合?允许哪些表达式?想想看,我真的只需要12个“PIN”的偏移地址从我的GPIO引脚。我可以在固件/软件中读写。 总而言之,这就是我认为我需要的: ---在解决方案中--- 1。从GPIO引脚连接AD0A12到加法器组件…也可以连接CS或其他启用信号或时钟 2。配置DMA使用来自加法器输出的地址作为目的地 ---跑步时--- 1。创建4K UIT8阵列 2。将数组起始地址的Lo16设置为加法器 三。(当一个新的地址可用时,加法器将提供一个计算的绝对对应地址到4K数组中,以便DMA读写请求可以发出或存储正确的字节位置)。 我一直在阅读UDB编辑器上的AN。我还没有找到我需要的东西。我得到的印象是,我需要先使用FIFO寄存器来加载D0和D1,但我仍然不知道如何从硬件输入加载F0和F1。我也把控制寄存器丢到了设计中,但是我看不出如何把它绑定到任何东西上。 最坏的情况是,我可以通过中断将一个DMA接收到的字节复制到缓冲区中的正确位置,或者,我可以创建一个中断处理程序,在DMA完成后将每个写入的字节复制到数组中的正确位置,但这是一个非常麻烦的问题。我已经知道,在PoSoC 4上,整个CPU驱动的数据读取过程不够快。硬件/固件可寻址的DMA在这里看起来更优雅。 所以,先感谢一些我正在尝试做的指示,或者我应该阅读的文档。 谢谢,保罗 以上来自于百度翻译 以下为原文 I'm trying to create a 16-bit adder using the UDB Editor. First of all, is this even possible? It seems that if I want a device with 48 "pins" I may not have enough registers to handle two words of input and one word of output. Background might help, I guess. I am trying to set up DMA to allow write (at least), and ideally also read, from a 4K array in SRAM on PSOC 5 (and maybe also PSOC 4). I have a 16-bit address bus implemented in two sets of 8 GPIO pins. The access from the external bus is random, and one byte at a time. A R/W pin indicates the direction of data flow, and there are another 8 pins for D0-D7. This currently works fine for writing to a single uint8 in SRAM, but not for being able to address multiple locations based on the GPIO address. What I think I need is this adder, so I can load it with the base address of the array at startup, and have it add to that the offset into the array coming from the lower 12 bits of the address bus. I've been looking for indexed DMA solutions, but the documentation on that is really sparse and I still can't see how it would do what I need. As far as I can tell, indexed DMA works if you can get the absolute destination address from somewhere else. I can get the relative offset, but not the absolute address... thus the need (I think) for an adder. I do see that the Keil compiler allows some explicit object positioning in SRAM, but I'm using gcc. So, the goal I'm currently working towards in the UDB Editor is this adder. It's pretty easy to see how to set up some instructions and state machine states to load A0 from D0, then add A0 to D1 and have the result available from the ALUout. What I can't see is how to correctly make byte or word wide interfaces available in the component so I can connect them to my pins. UDB Designer allows me to add single pin/bit inputs, and it also allows me to add design-wide variables (but the design-wide variables seem to be almost undocumented... what is registered vs. combinatorial? what kinds of expressions are allowed for them?) Come to think of it, I really only need 12 "pins" for the offset address from my GPIO pins. Everything else I can read and write in firmware/software. To recap, here's what I think I need: --- in the solution --- 1. Connect AD0-A12 from GPIO pins to the adder component... maybe also connect CS or some other enable signal or clock 2. Configure DMA to use address from adder output as destination --- when running --- 1. Create 4K uint8 array 2. Set the LO16 of the array start address into the adder 3. (when a new address is available, the adder will be providing a computed absolute corresponding address into the 4K array so DMA read or write requests can source or store the correct byte location) I've been reading through the AN's on the UDB Editor. I'm not yet finding what I need. I get the impression that I need to use the FIFO registers to load D0 and D1 first, but I still don't see how to load F0 and F1 from hardware inputs. I also dropped a Control Register into the design, but I can't see how to hook that up to anything. Worst case, I might be able to make this work with an interrupt to copy a single DMA-received byte to the correct location in the buffer, or, I guess I could create an interrupt handler to copy each written byte into the correct place in the array after DMA is complete, but that's a lot messier and I already know the entire CPU-driven data read process isn't fast enough on PSOC 4. Hardware/firmware addressable DMA seems so much more elegant here. So, thanks in advance for some pointers on what I'm trying to do, or towards documentation that I should be reading. Thanks, Paul |
|
相关推荐
2个回答
|
|
|
在DMA完成后,我试图用一个中断来移动数据,但是这似乎花费了太长的时间,而且一旦我添加了第二个DMA来捕获地址的低8位,在我的项目中还有其他奇怪的和不良的副作用。
我确实设法通过在主自旋循环中添加一个显式CysStRyGr16调用来设置DMA的目的地到缓冲区中的正确位置。我需要做更多的测试,看看这是否真的够快和可靠。它仍然不理想,我认为,因为它需要依赖CPU来更新目的地地址,并且当PSoC CPU忙于执行其他任务时,也要求我禁用DMA写入。 如果它对其他人有帮助,我们在这个广告中不会想出更好的答案: /朝向主顶部 DMAI1In(); DMADSATAVE=(ReG16*)和Cyth-DMAY-TDMMENTHORESULTSRTPPT[DTMAD] TD1[2U]; //在for(;)循环中 LoTe= PixAddiSrsLoWaRead(); HAdv= PixAddiSrsHythRead(); PAGE=H地址和15; // 11以上的页面是R/W -设置DMA的目标地址 If(Page & G.;11) CythStIGReG16(DMADSATAVEL,RO16((UIT32)(和缓冲器[Page ] [L地址])); 其他的 CythStIGRIG16(DMASTADATION,RO16((UIT32)(&;DMADATA))); //DMADATA是一个假想的UIT8,以防有人试图写入R/O地址。 以上来自于百度翻译 以下为原文 I tried to set this up with an interrupt moving the data after DMA was complete, but this seemed to take too long, and there were other odd and undesirable side-effects in my project once I added a second DMA to capture the low 8 bits of the address. I did manage to get things maybe working by adding an explicit CY_SET_REG16 call in my main spin loop to set the destination of the DMA to the correct location in the buffer. I need to do some more tests to see if this is really fast and reliable enough. It is still not ideal, I think, because it does require dependence on the CPU to update the destination address, and also will require me to disable DMA writes when the PSoC CPU is busy doing other tasks. In case it's helpful to someone else, and we don't come up with better answers in this thead: //Towards the top of main DMA_1Init(); DMADestAddress = (reg16 *) &CY_DMA_TDMEM_STRUCT_PTR[DMATD].TD1[2u]; //In the for(;;) loop laddress = Pin_Address_Low_Read(); haddress = Pin_Address_High_Read(); page = haddress & 15; //Pages above 11 are R/W - this sets the target address for the DMA if (page > 11) CY_SET_REG16(DMADestAddress, LO16((uint32)(&buffer[laddress]))); else CY_SET_REG16(DMADestAddress, LO16((uint32)(&DMAData))); //DMAData is a dummy uint8 in case someone tries to write to a R/O address |
|
|
|
|
uwjfjsdfwer 发表于 2018-11-12 14:18 ……当我认为我在进步…呃。 这个解决方案和我以前使用的循环读取有相同的问题:当我写的值有1000个用于它们的前四个数据位时,设备接口的定时有点奇怪(我猜)。如果我把DMA设置成单个地址,就可以拾取所有的值。如果我将DMA目标设置在循环中,即使只使用低地址和无页面,甚至已经从环路中取出一些其他的东西,即使时钟摇动到79MHz,数据写入在128和143之间也总是下降。 我真的需要一个不需要CPU参与的解决方案。 以上来自于百度翻译 以下为原文 ...and, just when I think I'm making progress... ugh. This solution has the same issue as the loop read I was previously using: there's some oddness in the timing of the device with which I'm interfacing (I guess) when values being written have 1000 for their top four data bits. If I set the DMA to single address, it's fine to pick up all values. If I set the DMA destination in the loop, even with just the low address and no page, and even with having pulled out some other things from the loop, and even with the clock cranked to 79Mhz, data writes between 128 and 143 are always dropped. I really need a solution that doesn't require the CPU's involvement. |
|
|
|
|
只有小组成员才能发言,加入小组>>
786个成员聚集在这个小组
加入小组cyUSB3014一直显示2.1,不能到3.0情况,谁遇到过
7088 浏览 0 评论
2474 浏览 1 评论
2166 浏览 1 评论
4031 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
2073 浏览 6 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
7566浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
6114浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
742浏览 2评论
710浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
7962浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 02:27 , Processed in 0.776091 second(s), Total 74, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
522