完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
Heloi最近遇到了一个奇怪的问题,我有一个通过EASART发送字符串的自定义函数,函数如下:ValeSerialWrrad(const char *x){(*x){easART1x编写(*x++);}其中,EasART1x写是MPLAB的默认函数。问题是我能够。使用此功能在PIC18F47 K40浸印足迹,但不UQFN40足迹。(顺便说一下,我上传了完全相同的程序,在两个脚印,DIP工作,但不是另一个)我试图做SerialWrand(“Hello”);在我的主程序,在我的笔记本电脑串口上看不到任何东西。然而,我发现我只能从UQFN40足迹中发送单个字符,例如EUARTAR1X写('H');我还用示波器检查了TX线,当我使用UQFN40足迹的函数SyralWrad时,看不到任何下拉,但是看到了单字符信号。EUARTAR1X写的好。UART连接对于我的PCB上的DIP足迹芯片和UQFN40芯片来说是简单和相同的:PIC18F47 K40TX-& GT;MCP2221 RXPIC18F47 K40RX——& McP2221 TXONE概念,问题可能是什么?
以上来自于百度翻译 以下为原文 Hello I have recently encountered a weird problem, I have a self-defined function for sending string through EUSART, function as follow: void serialWrite(const char *x) { while(*x) { EUSART1_Write(*x++); } } Where EUSART1_Write is the default function from mplab. The problem is that I was able to use this function in PIC18F47k40 DIP footprint but not UQFN40 footprint. (By the way, I uploaded the exact same program in both footprint, DIP worked but not the other) Where I tried to do serialWrite("Hello"); in my main program and could not see anything on my laptop serial port. However I found out that I was only able to send out single character from the UQFN40 footprint, e.g. EUSART1_Write('H');. I have also checked the TX line with oscilloscope, I could not see any pull down when I use the function serialWrite with UQFN40 footprint, but saw single character signal with EUSART1_Write alright. The UART connection is simple and identical for the DIP footprint chip and UQFN40 chip on my PCB: PIC18F47k40 Tx --> MCP2221 RX PIC18F47k40 Rx --> MCP2221 TX Any idea what the problem could be? |
|
相关推荐
1个回答
|
|
我猜想,不工作的芯片是Rev A2,而工作的芯片是一个后来的Rev Rev A2芯片需要臭名昭著的“NVMRG解决方案”(见脚注)。K40的勘误表文档给出了描述和一种方法来处理它,但是最简单的方法是在Pro上输入+NVMReg。注入-GT;XC8连接器-GT;附加选项-GT;勘误线。(对此,您不必将小汇编语言文件添加到您的项目中!)(请参阅附件)注意,这是一个链接器选项,而不是编译器选项。底线:这为应用程序的启动代码添加了两条指令。这是不需要以后的修订,但也不会伤害任何东西。问候,DaveFootnote:即使是谁看过这个错误的勘误,有时认为他们不需要解决办法,因为他们没有明确地使用TBRRD。但是(这是一个很大的但是)访问闪存数据的任何东西都需要这个。真正地。编译器使用TBLRD遍地。
以上来自于百度翻译 以下为原文 I'm guessing that the chip that does not work is Rev A2 and the chip that works is a later Rev. Rev A2 chips require the infamous "NVMREG workaround" (See Footnote.) The Errata document for the 'K40 gives a description and one way to work around it, but the simplest way is to enter +NVMREG on the Project->XC8 Linker->Additional Options->Errata line. (With this, you do NOT have to add the little assembly language file to your project!) (See Attachment.) Note that this is a Linker option, not a Compiler option. Bottom line: This adds two instructions to the startup code for the application program. It is not required for later revisions, but doesn't hurt anything either. Regards, Dave Footnote: Even people who have read the Errata about this bug sometimes think they don't need the workaround since they aren't explicitly using TBLRD. But (and this is a Big But) anything that accesses Flash data memory needs this. Really. The compiler uses TBLRD all over the place. Attached Image(s) |
|
|
|
只有小组成员才能发言,加入小组>>
5166 浏览 9 评论
2000 浏览 8 评论
1929 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3175 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2227 浏览 5 评论
736浏览 1评论
619浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
507浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
633浏览 0评论
530浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 04:13 , Processed in 1.260391 second(s), Total 79, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号