完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我在MPLABX v3.45中使用MCC v3.1.5配置24EP512GP202(带有16MHz外部晶体)。我看到,如果设置:Primary OSC:16000000PLL:.soFosc=16000000,UART1可以正常工作。但是如果设置:Primary OSC:16000000PLL:enableconfiguring PLL以获得Fosc=140000000000,UART1将运行。错误的字符。在详细信息中,例如“TEST”,它打印“Txxx”,其中xxx是错误的符号。我还看到,配置PLL以获得较低的Fosc,例如Fosc=64000000,还正确地传输了第二符号……例如,它传输“TExx”而不是“TEST”。16000000或更低的传输字符都可以。我想有一个定时计算问题,对于PLL,对于外部晶体频率,增加Fosc变得越来越重要。我已经尝试使用不同的UARTx波特率(从2400到115200,但是它具有相同的行为w.我也尝试了以下两种传输方式:-用MCC启用“重定向打印到UARTx”并使用printf(“测试”)直接编写UARTx TX寄存器,但我总是得到相同的结果。
以上来自于百度翻译 以下为原文 Hi all, I'm configuring 24EP512GP202 (with 16MHz external crystal) using MCC v3.1.5 in MPLABX v3.45. I saw that if I set: Primary OSC: 16000000 PLL: disable so Fosc = 16000000 the UART1 works properly. but if I set: Primary OSC: 16000000 PLL: enable configuring PLL to obtain Fosc = 140000000, the UART1 prints out wrong chars. In the detail if I tx, for example, "TEST" it prints "Txxx" where xxx are wrong symbols. I also saw that configuring PLL to obtain a lower Fosc, for example Fosc = 64000000, also the 2nd symbol is trasmitted properly...for example it trasmits "TExx" instead "TEST". If I configure PLL to obtain Fosc = 16000000 or lower the trasmitted chars are all ok. I suppose there is a timing calculation issue that becomes increasingly critical increasing Fosc with PLL respect to the external crystal frequecy. I already tried to use different UARTx baud rate (from 2400 to 115200 but it has the same behaviour with all of them) and both using UART1 and UART2. I also tried the following 2 ways to transmit: - enabling "redirect printf to UARTx" with MCC and using printf("TEST") - writing the UARTx TX register directly but I had always the same result. Thanks in advance, Nicola |
|
相关推荐
5个回答
|
|
更新:查看这个线程(HTTP://www. McCHIP.COM/FUMMS/M959560.ASPX)?tree=true)我试图修改生成的PLLDIV,使其值减少2(例如,从PLLFBD=0x0023到PLLFBD=0x0021),以这种方式,UART也开始正常工作,Fosc=140000000。现在我遇到了一些麻烦,因为我真的不知道什么是正确的值;我还试图进一步降低它的值(从0x0022到0x001F),UART继续正确地处理所有这些值。反馈=1:35(280MHz)后标尺=1:2(140MHz)FoCC=1400万,谢谢!!
以上来自于百度翻译 以下为原文 UPDATE: Looking at this thread (http://www.microchip.com/forums/m959560.aspx?tree=true) I tryed to modify the generated PLLDIV reducing its value by 2 (for example from PLLFBD = 0x0023 to PLLFBD = 0x0021) and in this way the UART starts to work properly also with Fosc = 140000000. Now I have some troubles because I really don't know what is the right value; I also tried to decreast its value more (from 0x0022 to 0x001F) and the UART continues to work properly with all these values. My configuration in MCC system moduel is: Primary Osc = 16000000 PLL Enable Prescaler = 1:2 (8MHz) FeedBack = 1:35 (280MHz) Postscaler = 1:2 (140MHz) Fosc = 140000000 Thanks!! |
|
|
|
最后更新:我可以确认在MCC V3.1.5中有一个关于PLL计算的问题:如果我们考虑以下配置:主OSC=1600万PLL Enable PrimeClER=1:2(8MHz)反馈=1:35(280MHz)后标尺=1:2(140MHz)-& Fosc;考虑到所考虑的PLL设置,我们有:N1=2N2=2M=35Mo,MCC应该设置以下的值:PLLPROP= N1 - 2=0PLLPOST=N2/2=1 PLLDIV(PLLFBD)=M=2=33,但是在MCC.C中,在CLKDIV寄存器中找到PLLPRE和PLLPOST的正确值,但是WronPLLFBD寄存器中的G值为35,而不是33。因此,为了解决这个问题,等待一个新的MCC版本,有必要修改生成的MCC.C文件,减少了2的集合PLLDIV(PLLFBD)值。
以上来自于百度翻译 以下为原文 FINAL UPDATE: I can confirm there is an issue on PLL calculation in MCC v3.1.5: If we consider the following configuration: Primary Osc = 16000000 PLL Enable Prescaler = 1:2 (8MHz) FeedBack = 1:35 (280MHz) Postscaler = 1:2 (140MHz) -> Fosc = 140MHz According with the Equation 9-2 at page 154 of the datasheet, with the considered PLL setting we have: N1 = 2 N2 = 2 M = 35 so the MCC should set the related register with the following values: PLLPRE = N1 - 2 = 0 PLLPOST = N2/2 - 1 = 0 PLLDIV (PLLFBD) = M - 2 = 33 but in the MCC.c I find the proper values for PLLPRE and PLLPOST in the CLKDIV register but a wrong value for PLLDIV in the PLLFBD register that is set to 35 instead of 33. So, to fix this issue waiting for a new MCC release, it's necessary to modify the generated MCC.c file reducing by 2 the set PLLDIV (PLLFBD) value. Nicola |
|
|
|
您好,尼古拉和“Ctuuft”,感谢报告的问题,并感谢您的分析。它的详细和非常有助于更好地理解这个问题并找到根本原因。我同意你的结论。1。PLLPRE和PLLPOST具有适当的值。2。PLLFBD值没有正确生成。在生成的代码中需要减少2。我们将在下一个16位外围库的版本中修复它。同时,作为解决办法,PLLFBD值需要在代码生成之后在API-OSCILLATOR_Initialize()中手动减少2。如果您有任何问题,请告诉我关于万卡
以上来自于百度翻译 以下为原文 Hello Nicola & "cteufert", Thanks for reporting the issue and appreciate your analysis. It's detailed and very helpful to better understand the issue and find the root cause. I agree with your conclusion. 1. PLLPRE and PLLPOST are having proper values. 2. PLLFBD value is not generated correctly. It needs to be reduced by 2 in the generated code. We will be fixing it in our next release of 16-bit peripheral library. Meanwhile, as a work around - the PLLFBD value needs to be reduced manually by "2" in the API - OSCILLATOR_Initialize() after code generation. Let me know if you have any questions. Regards Vanka |
|
|
|
嗨,我也有同样的问题。我用MCC(v3.25)来设置振荡器配置。我在引脚OSC1和OSC2上使用外部石英16MHz。这是我在代码配置窗口中的设置:16000000主振荡器_ PLL使能_ 8Mhz 1:2预分频器_ 240MHz 1:30反馈_ 120MHz 1:2Postscaler=>Fosc=120MHz=&g当我用TMR1周期1MILISH检查Fosc时,我测量0.94MS,所以Fosc=128MHz,而不是120 MHz。与UART相同的错误:我测量123000bps,而不是115200bps。所以我检查振荡器配置生成的代码:void OSCILLATOR_Initialize(void){//CF无时钟故障;NOSC PRIPLL;CLKLOCK解锁;OSWEN开关完成;u builtin_write_OSCCONL((uint8_t)(0x300&//FRCDIV FRC/2;PLLPRE 2;DOZE 1:8;PLPLLPIV 1:8;PLLPOST 1:2;PLLPOST 1:2;DOEN禁用;ROI禁用;ROI禁用;CLKDIV;ROKDIV=0x3100;ROCTUN=0x3100;//TUN中心频率;OSCTUN=0x0=0x0;//TON禁用;OSCTUN=0x0;//ROON禁用;ROSEL禁用;RODIV基本时钟值;RODIV禁用;RODIV基准时钟值;ROSSLP禁用;REFOFOCON;REFOCON=0x0;//PLFOFOCON CPFOCON=0x0;//PLFOCON 30;REdSATA禁用;ACCSAT禁用;CORCONbits.RND=0;CORCONbits.SATB=0;CORCONbits.SATA=0;CORCONbits.ACCSAT=0;//WDTO禁用;TRAPR禁用;SLEEP禁用;BOR禁用;CM禁用;SWDTEN禁用;EXTR禁用;POR禁用;VREGSF禁用;IDLE禁用;IOPUWR磁盘故障;RCON= 0x0;}问题是“PLLFBD=0x1e”;而不是0x1c(对于PLLDIV=30)。
以上来自于百度翻译 以下为原文 Hi, I had the same problem. I use MCC (v3.25) to set oscillator configuration. i use external quartz 16MHz on pins OSC1 and OSC2. Here is my setup in code configurator window : _ 16000000 Primary oscillator _ PLL enable _ 8Mhz 1:2 Prescaler _ 240MHz 1:30 Feedback _ 120MHz 1:2 Postscaler => Fosc=120MHz => Fosc/2=60MHz When i check the Fosc with TMR1 period 1milisecond, I measure 0.94ms, so Fosc=128MHz instead of 120MHz. It is the same error with UART : I measure 123000bps instead of 115200bps. So i check the code generated of the oscillator configuration : void OSCILLATOR_Initialize(void) { // CF no clock failure; NOSC PRIPLL; CLKLOCK unlocked; OSWEN Switch is Complete; __builtin_write_OSCCONL((uint8_t) (0x300 & 0x00FF)); // FRCDIV FRC/2; PLLPRE 2; DOZE 1:8; PLLPOST 1:2; DOZEN disabled; ROI disabled; CLKDIV = 0x3100; // TUN Center frequency; OSCTUN = 0x0; // ROON disabled; ROSEL disabled; RODIV Base clock value; ROSSLP disabled; REFOCON = 0x0; // PLLDIV 30; PLLFBD = 0x1E; // RND disabled; SATB disabled; SATA disabled; ACCSAT disabled; CORCONbits.RND = 0; CORCONbits.SATB = 0; CORCONbits.SATA = 0; CORCONbits.ACCSAT = 0; // WDTO disabled; TRAPR disabled; SLEEP disabled; BOR disabled; CM disabled; SWR disabled; SWDTEN disabled; EXTR disabled; POR disabled; VREGSF disabled; IDLE disabled; IOPUWR disabled; VREGS disabled; RCON = 0x0; } The issue is "PLLFBD = 0x1E;" instead of 0x1C (for PLLDIV=30) |
|
|
|
我看到的问题与MCC 3.36和CKDIVE设置为内部振荡器操作PIC24FJXXGCXX。对于一个骨架测试项目来说是很好的,但是对于ADC/DAC/I2C项目来说,时钟速度为一半。
以上来自于百度翻译 以下为原文 I'm seeing issues with MCC 3.36 and CLKDIV settings for internal oscillator operation on PIC24FJxxGCxx. Works fine for a skeleton test project, but clocking at half speed for an ADC/DAC/I2C project. |
|
|
|
只有小组成员才能发言,加入小组>>
5202 浏览 9 评论
2016 浏览 8 评论
1942 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3188 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2243 浏览 5 评论
753浏览 1评论
640浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
545浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
652浏览 0评论
552浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-4 09:29 , Processed in 1.415332 second(s), Total 84, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号