完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
嗨,我是新的PIC,但不是新的MCU-S和X86系统编程。得到一个任务来创建一个设备与PIC32 MZ2048 EFM144启动器套件(与LAN和密码)。虽然大量的文件可以找到,它没有任何细节作为其他制造商的文件。你下载参考手册为您的特定设备,它不断提到进一步的信息你应该查阅参考文件…花了我一些时间来写我自己的驱动程序/库,UART,I2C,定时器,I/O,键盘和OLED显示所有工作良好,但我遇到了一些问题机智HD DMA和密码引擎,希望PIC专家能启发我……问题:1,我设置了DMA从文本缓冲器A& & GT;B中传输很少的字节,没有中断,链接或模式匹配。这很好,但是如果我尝试在源缓存在Flash(静态关键字在定义)中做同样的事情,它不会传递任何东西。2,这是一个普遍的问题,我想使用密码引擎来做一个简单的文本字符串的Sa1。对于每个类型的密码和散列来说,它会伤害微芯片吗?有人能告诉我一些不使用中断(和和声)的Sa1代码吗?谢谢你,爱德华·艾尔利克
以上来自于百度翻译 以下为原文 Hi, I'm new to PIC, but not new to MCU-s and x86 system programming.Got a task to create a device with the PIC32MZ2048EFM144 starter kit (with LAN and Crypto). While plenty documentation can be found, it is nowhere as detailed as other manufacturer's documents. You download the reference manual for your particular device and it keeps mentioning for further info you should look up the reference document... Took me some time to write my own drivers/libraries, UART, I2C, Timers, I/O, Keypad and Oled display all working fine, however i run into some issues with DMA and Crypto engine and hoping for a PIC expert to enlighten me... Problems: 1, I set up the DMA to transfer few bytes from text buffer A -> B, no interrupts, chaining or pattern match. This works fine, however if i try to do the same where source buffer is in Flash (static keyword at defining), it does not transfer anything. 2, This is a general problem, i'd like to use the Crypto Engine to do a simple SHA1 of a text string. Would it hurt Microchip to provide an example for each type of cypher and hash? Could someone show me some code that does an SHA1 without using interrupts (and HARMony)? Thank you, Edo |
|
相关推荐
11个回答
|
|
|
你能提供从闪存读取DMA的设置吗?在FRM中,我设置了一些设置安全关联和缓冲描述符的片段。执行任何算法之间唯一的真正区别是安全关联中的ALGO字段,告诉它要执行什么。然后,在缓冲区描述符中设置正确的指针,以便将输出放在哪里。最困难的部分是确保SAS和BDS不会被缓存,或者刷新缓存,这样引擎就可以接收到更改并执行它。我来看看我是否可以为初学者工具包设置一个简单的例子。
以上来自于百度翻译 以下为原文 Can you provide your setup of the DMA for reading from Flash? In the FRM, I put some snippets of setting up the Security Association and the Buffer Descriptors. The only real difference between executing any of the algorithms is the ALGO field in the Security Association, to tell it what to execute. That, and setting up the correct pointers in the Buffer Descriptor for where to put the output. The hard part is making sure the SAs and BDs don't end up getting cached, or that you flush the cache, so that the engine can pick up the change and execute it. I'll see if I can set up a "simple" example for the starter kit. |
|
|
|
|
|
您好EdCeCrouy,您提到过,您还想要实现没有协调的LAN连接(TCP/IP)吗?当做
以上来自于百度翻译 以下为原文 Hi Edocecrous, Did you mention that you also want to implement LAN connection (TCP/IP) without Harmony ? Regards |
|
|
|
|
|
听起来像是缓存一致性问题?你能分享一个小代码示例来演示这个问题吗?你确信你的数据是直接从ROM访问的吗?你提到“静态”,而不是“const”。如果它是静态的,它显然是“在RAM中”,由C启动代码初始化,但是从硬件的角度来看,它可能还没有从数据缓存刷新到RAM。DMA引擎只直接访问RAM,而不是通过DCACH。查找1600:http://WW1. Microchip .com /…AppNOTE/000 00 1600 C.PDF
以上来自于百度翻译 以下为原文 Sounds like a cache coherency problem? Can you share a small code example demonstrating the problem? Are you sure your data is being accessed directly from ROM? You mention "static", but not "const". If it's static only, it'll apparently be "in RAM", initialised by the C startup code, but from a hardware perspective it may well not have been flushed from data cache to RAM yet. The DMA engine only accesses RAM directly, not through dcache. Look up AN1600: http://ww1.microchip.com/...AppNotes/00001600C.pdf |
|
|
|
|
|
您好,首先感谢您的回答和即时帮助!霍华德:谢谢你的文件,我会研究并尝试不同的设置。我写的是静态的,但我的意思是静态const。所以我的代码尝试使用DMA从Flash复制到RAM。我的源操作数在9D3030E8,它通过ANP;0x1FFFFFF转换为1D3030E8,我的目的地是800万C34,转换为00000 C34。那么,缓存(如果启用)只与RAM一起使用,还是与Flash一起使用?RISC:不,我刚才提到我有一个板,上面有LAN子板。在这个时候,我不需要实现网络(但如果我这样做,它将不和谐)。@拉里:试图附加一个文件,但得到“不允许访问服务器…”错误,我的帖子也丢失了。我的DMA“复制”函数如下:[ValueDMACPEP(Valu*DST,Value*Src,未签名int size){无符号int SDSCADR;未签名int dSTADDR;SRCADRD=(无符号INT)SRC&0x1FFFFFFF;/ /物理地址SRCDSTADDR=(无符号INT)DST和0x1FFFFFFF;/ /物理地址DST//SRCADRDR= KVAYToEPA(SRC);//DSTADDR=KVAY-TYPA(DST);IEC1CLR=0x000 010000;/ /禁用DMA通道0中断SIFTIFSF1CLR=0X000 010000;/ /清除现有DMA通道0中断FLALDMACON=0x8000;//DMA模块ONDCH0CONC=0x3;//DMA通道禁用,在块传输完成后禁用,优先级3(最高)DCH0ECON=0;/DMA传输不是由IRQ触发的,必须强制,没有模式MatCHDCCRON=0;//CRC模块OFDCHCH0IN=0;/ /中断DeabDeDCH0SSA=SRCADDR;//源启动ADSTRESDCH0DSA=DSTADDR;/ /目的地起始地址ADSDRESCH0SSIZ=大小;/ /源SsieDeCH0DSIZ=大小;/ /目的地n SsieDeCH0csiz=size;//单元大小字节,每个事件转移为0CdCrr= 0x000 FFFFF;//清除事件DC0CONSETSET=0x80;//信道ONDCH00EcCEART=0x80;//传输(CCHORE=1),(DCH0INT&AM.0x4);int dMAFLAGS=DCH0int;}[/COD] ]和我的全局变量是这样设置的:静态UTIN 8T屏幕[1024 ];静态const Unt8t背景[4×1024 ]={0x44,0x1c,…} [代码],我将查找FRM,一旦找出它是什么。并等待着你的“简单”的例子,关于初学者工具包的缓存。Csaba Bacskay(EdcCrrod)
以上来自于百度翻译 以下为原文 Hello, First of all, thank you for the answers and instant help! @Howard: Thanks for the document, i'll study it and try different settings. I wrote static, but i meant static const. So my code tries to use DMA to copy from FLASH to RAM i guess. My source operand is at 9D0030E8, that gets translated via & 0x1FFFFFFF to 1D0030E8, my destination is 80000C34 that gets translated to 00000C34. So then CACHE (if enabled) is used with RAM only, or also with FLASH? @RISC: No, i just mentioned that i have a board which has the LAN daughterboard on it. At this moment i don't have to implement networking (but if i do, it will go without Harmony). @Larry: Tried to attach a file but got a 'No permission to access to server..' error and my post also got lost. My DMA 'Copy' function is as follows: [code] void DMACopy(void * dst, void * src, unsigned int size){ unsigned int srcAddr; unsigned int dstAddr; srcAddr = (unsigned int) src & 0x1FFFFFFF; //Physical address of src dstAddr = (unsigned int) dst & 0x1FFFFFFF; //Physical address of dst //srcAddr=KVA_TO_PA(src); //dstAddr=KVA_TO_PA(dst); IEC1CLR=0x00010000; // disable DMA channel 0 interrupts IFS1CLR=0x00010000; // clear existing DMA channel 0 interrupt flag DMACON = 0x8000; // dma module on DCH0CON = 0x3; //DMA Channel Disable, turns disabled after block transfer complete, priority 3 (highest) DCH0ECON = 0; // dma transfer is not triggered by irq, has to be forced, no pattern match DCRCCON = 0; // crc module off DCH0INT = 0; // interrupts disabled DCH0SSA = srcAddr; // source start address DCH0DSA = dstAddr; // destination start address DCH0SSIZ = size; // source size DCH0DSIZ = size; // destination size DCH0CSIZ = size; // cell size bytes transfered per event DCH0INTCLR=0x00ff00ff; //clear events and disable interrupts DCH0CONSET = 0x80; //channel on DCH0ECONSET = 0x80; //transfer on (CFORCE=1) while (DCH0INT&0x4); int DMAFlags=DCH0INT; } [/code] And my global variables are set up like this: [code] static uint8_t screen[1024]; static const uint8_t background[4*1024] = {0x44, 0x1C, ...} [/code] I'll look up FRM once figure out what is it. And waiting eagerly for your 'simple' example regarding caching for the starter kit. To all, thank you for the help! Csaba Bacskay (Edocecrous) |
|
|
|
|
|
简化了,在KSEG1内存范围之外的所有东西都使用缓存。更详细地说,CP0.CONFIG寄存器中的K0位控制KSGE0是否被缓存,页表属性控制映射内存范围的一致性。
以上来自于百度翻译 以下为原文 Simplified, everything outside the KSEG1 memory range uses the cache. In further detail, the K0 bits in the CP0.Config register controls whether KSEG0 is cached or not, and page table attributes controls coherency for the mapped memory ranges. |
|
|
|
|
|
MZ设备中有没有一些关于闪存和密码的勘误表?
以上来自于百度翻译 以下为原文 Don't some of the MZ devices have an errata regarding Flash and crypto? |
|
|
|
|
|
在EC上,输出是大的Endiad格式,因此您必须在代码中交换输出。在EF上添加了一个比特,以便引擎自动地进行交换。在DA上,当密码引擎的DMA访问Flash时,总线有问题,并且我能围绕它工作的唯一方法是增加Flash等待状态。
以上来自于百度翻译 以下为原文 On EC, the output was in big-endian format, so you had to swap the output in code. On EF a bit was added so that the engine would do the swap automatically. On DA, there is an issue with the bus when the crypto engine's DMA accesses Flash, and the only way I could work around it was to increase the Flash wait states. |
|
|
|
|
|
这是一个有趣的线索。很高兴拉里跟随,因为他对这个主题的输入可能是有用的。我想在PIC32 MZ(EFM变体)上设置加密的引导加载程序。这些都有硬件密码。每一个PIC32都具有一些独特性(用于启动的MAC地址),它可以用于一些关键信息。这将使HEX文件分散到更安全的更新设备上。不过,如果Bootloader空间中有足够的NVRAM,我会努力解决这个问题。
以上来自于百度翻译 以下为原文 This is an interesting thread. Glad Larry is following, because his input on this topic might be useful. I want to set up an encrypted bootloader on a PIC32MZ ( EFM Variants ). These have the hardware crypto in them. Each PIC32 has some uniqueness built in ( The mac address for a start ) that coudl be used for some key information. This would make distriubtion of the hex file to update devices much more secure.. I'm trying to work out though if there is enough nvram in the bootloader space to pull this off. |
|
|
|
|
|
您好,DMA问题是由缓存引起的。副本是从Flash到RAM,目的地是800万C34虚拟的,C34物理的,目的数据与缓存内容不匹配,因此在检查变量时它显示了先前的状态。一旦我将目的地分配到KSGE1中[使用了γ-AdviTyth*((相干))],副本就成功了。我还想尝试一个缓存无效的例程,但是首先我必须找出在我的设置中使用的缓存方案,并且需要对这个主题进行更多的阅读。关于密码引擎,我知道SA中的ALGO字段控制使用什么,但是设置所有BUF。针对不同的算法和处理拉里提出的缓存问题确实存在问题,所以我希望他能写出他提到的例子。现在我唯一需要从密码引擎来做的是SHA-1。THX,爱德华·艾尔利克
以上来自于百度翻译 以下为原文 Hi, The DMA problem was caused by the cache. The copy was from Flash to RAM, destination was 80000C34 virtual, C34 physical.The destination data didn't match the cache contents, so when checking the variable it showed the previous state. Once i allocated the destination to be in KSEG1 [used __attribute__((coherent))], the copy was successful. I also would like to experiment with a cache invalidate routine, but first i have to find out which caching scheme is used in my setup right now and need more reading-up on the subject. Regarding the Crypto engine, i know that the ALGO field in the SA controls what to use, but setting up all the buffers for the different algorithms and dealing with the caching issue Larry stated does pose a problem, so i hope he can write the examples he mentioned. Right now the only thing i'd need from the Crypto engine is to do the SHA-1. thx, Edo |
|
|
|
|
|
下面是我在String上运行SHA-1的方法。注意,每次运行一个新的散列时,引擎都必须重置。我尝试更新缓冲区描述符并重新运行它,但总是产生不同的结果。
以上来自于百度翻译 以下为原文 Here's what I came up with for running a SHA-1 on a string. Note that the engine seems to have to be reset every time a new hash is run. I tried just updating the buffer descriptor and rerunning it, but it always came up with a different result. Attachment(s) crypto_sha1.c (9.08 KB) - downloaded 77 times |
|
|
|
|
|
谢谢,太棒了!!!!它在我的32 MZ上运行良好:通过WOLFSSL进行PoPhink,看起来它们也在哈希之后重置引擎。
以上来自于百度翻译 以下为原文 Thanks, that is great!!! It works fine on my 32MZ :P Poking through the wolfSSL it seems they also reset the engine after hashing. Edo |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1123浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1095浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 01:45 , Processed in 0.932938 second(s), Total 94, Slave 77 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2272