完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好。我在我的DSIC33 EP32 GS502(包SO28)板上遇到了一些问题。在将代码上传到设备(使用PICtiT3)之后,我可以在示波器上看到PWM,无论是PWM1H还是PWM1L(互补的,中心对齐模式)。但是在断开PICTIT3之后,PWM板消失了,只有PWM、核心工作良好(LED闪烁、UART保持发送/接收等)。由于程序员连接器只使用GoalPin阵列,当决定改变设备的频率源时,这个PWM问题开始发生,只需要对UART通信有更大的稳定性,因此增加16MHz石英(制造新的PCB)。检查频率请求和获得:FPLLI=16MHZ/lt;PLLPRE 2+2和gt;=48MHZ频率要求为0.8MHZFVCO=4MHZ*& lt;PLLDIV 58+2和gt;=240MHZ频率要求为120 MHz & lt;fvCo和lt;340MHZOFCC=240MHZ/lt;2 * PLLPOST & Gt;=120 MHZ频率要求为lt=120 MHZI。认为一切都很好,UART和计时器运行,所以必须罚款?由于需要60MHz的指令周期,不能使用FVCO作为PWM用途(MAX是120 MHz,而我有240MHz),所以必须使用FRC作为APLL的辅助振荡器时钟源。FPLL=7.37 MHz×16=11792MHz,满足小于1MHz和大于112MHz的要求。所以它应该很好,还是我错过了什么?也用示波器和X100探头(我没有任何FET探头)检查晶体振荡器得到预期的正弦信号(16MHz)。振荡电容器为C0G介质型22PF@ 50V情况0402,加1M电阻跨振荡器。测量电压:VCAP=1.96V(电容器为10uf@ 20V陶瓷,外壳0805,X7R),VDD=3.44 V。两种电压均为平滑、无尖峰等。VDD上升时间=2.2MS(0~3.44 V),因此应满足POR定时器(PoR定时器)。最小1V/ms根据数据表)。不幸的是,有简单的线性调节器KA33 RM(78线),所以它可能比开关调节器的阶跃响应更差,但仍然应该工作(在加电后和之后没有发现任何电压下降)。在DSPIC和CAPS之间的跟踪比最大推荐长度短,在DSPIC和CAPS之间的跟踪之前,CAPS是最早的。不知道如何进行PWM工作。希望有人能帮助我解决这个问题。下面附上一些源代码。配置(来自MCC)振荡器功能(来自MCC):PWM初始化功能
以上来自于百度翻译 以下为原文 Hello. I got some problems with PWM on my dsPIC33EP32GS502 (package SO28) board. After upload code to device (using PICkit3) I can see PWM on oscilloscope, both PWM1H and PWM1L (complementary, center-aligned mode as desired). But after disconnecting PICkit3 form board PWM is gone, only PWM, core is working well (LEDs blinking, UART keep send/recive, etc.). As programmer connector use simply goldpin array. This PWM problem starts to happen when decided to change frequency source for device, just needed more stability for UART communication, so added 16MHz quartz (made new PCB). Checked frequency requiments and get: Fplli = 16MHz/ I think everything is fine up there, UART and timers are operating so it have to be fine? Because needed 60MHz instruction cycle, cannot use Fvco for PWM purpose (max is 120MHz, and I have 240MHz there), so have to use FRC as auxiliary oscillator clock source for APLL. Fapll = 7.37MHz * 16 = 117.92MHz, it meets requiments less than 120MHz and more than 112MHz. So it should work fine or I miss something? Checked also crystal oscillator with oscilloscope and x100 probe (I dont have any FET probe) get sinusiodal signal as expected (16MHz). Oscillator capacitors are C0G dielectric type 22pF@50V case 0402, plus 1M resistor across oscillator. Measured voltages: Vcap = 1.96V (capacitor is 10uF@20V ceramic, case 0805, X7R), Vdd = 3.44V. Both voltages are smooth, no spikes etc. Vdd rise time = 2.2ms (0-3.44V) so it should satisfy POR timer (min 1V/ms according to datasheet). Unfortunlly theres simply linear regulator KA33RM (78 line) so it probably get worse step response than switching regulator but still should work (never find any voltage drops while and after powerup). Also put decopuling capacitors as mentioned in data sheet (Chapter2.0 Guidelines... RECOMMENDED MINIMUM CONNECTION) - caps are first before dsPIC in power chain also traces between dsPIC and caps are shorter than maximum recommended length. Have no idea how to made PWM work. Hope someone of You guys can help me with this issue. Below attached some source code. Configuration (from MCC): // FOSCSEL #pragma config FNOSC = PRIPLL // Oscillator Source Selection->Primary Oscillator with PLL module (XT + PLL, HS + PLL, EC + PLL) #pragma config IESO = ON // Two-speed Oscillator Start-up Enable bit->Start up device with FRC, then switch to user-selected oscillator source // FOSC #pragma config POSCMD = HS // Primary Oscillator Mode Select bits->HS Crystal Oscillator Mode #pragma config OSCIOFNC = OFF // OSC2 Pin Function bit->OSC2 is clock output #pragma config IOL1WAY = ON // Peripheral pin select configuration bit->Allow only one reconfiguration #pragma config FCKSM = CSECME // Clock Switching Mode bits->Both Clock switching and Fail-safe Clock Monitor are enabled #pragma config PLLKEN = ON // PLL Lock Enable Bit->Clock switch to PLL source will wait until the PLL lock signal is valid Oscillator function (from MCC): 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/1; PLLPRE 4; DOZE 1:1; PLLPOST 1:2; DOZEN disabled; ROI disabled; CLKDIV = 0x2; // TUN Center frequency; OSCTUN = 0x0; // ROON disabled; ROSEL disabled; RODIV Base clock value; ROSSLP disabled; REFOCON = 0x0; // PLLDIV 58; PLLFBD = 0x3A; // ENAPLL enabled; APSTSCLR 1:1; FRCSEL FRC; SELACLK Auxiliary Oscillators; ASRCSEL No clock input; ACLKCON = 0xA740; // LFSR 0; LFSR = 0x0; } PWM Initialize function #define DEF_MIN_F 12625 #define PWM_DT_100ns 96 void Initialize_PWM(void) { IOCON1bits.PENH = 1; // PWM1H controlled by PWM module IOCON1bits.PENL = 1; // PWM1L controlled by PWM module IOCON1bits.PMOD = 0; // PWML & PWMH complementary IOCON2bits.PENH = 0; IOCON2bits.PENL = 0; PWMCON1bits.CAM = 1; // Set Center-aligned mode PWMCON1bits.ITB = 1; // Independent Timebase requied for Center-aligned mode PWMCON1bits.DTC = 0; // Positive Dead Time PHASE1 = DEF_MIN_F; // set starting freq PHASE1 = (PHASE1 & 0b1111111111111000); PDC1 = DEF_MIN_F/2; // set duty cycle ALTDTR1 = (PWM_DT_100ns); // set dead time } |
|
相关推荐
2个回答
|
|
在PLL监视器位被设置之前,在PLL监视器位中有一些错误。在设置PLL和设置PWM之间,我通常在我的init中有一个哑铃循环。此外,我通常使用7.5MHz XTAL来计时整个事件。除此之外,我什么也看不见。
以上来自于百度翻译 以下为原文 There is something in the errata about the aux pll monitor bit being set before the pll being settled. I normally have a dummy for loop in my init between setting up the pll and setting up the pwm. Also I normally use a 7.5MHz xtal to clock the whole thing. I can’t see any other than that. |
|
|
|
谢谢你的回复,艾萨克西威尔,它给了我一个线索。用新的PCB I开关振荡器到FRC并尝试以这种方式运行,但是当断开PICTIT3时,PWM再次下降。因此,用PICkit的信号对PWM进行操作,并找到它的ISCPDAT,相应的PIN被设置为输入并连接到其他设备。经过简短的调查发现,在DSPIC和传感器之间,程序员跟踪是很好的,因此只得到了与ICSPDAT相连的天线,导致了所有的APLL问题。当PICTIT3连接到内部时,4.7K下拉驱动线稳定到低状态。
以上来自于百度翻译 以下为原文 Thanks for Your reply Isaac_Sewell, it gives me a clue. With new PCB I switch oscillator to FRC and try to run this way, but when disconnect PICkit3 again PWM goes down. So checked with signal from PICkit is requied for PWM to operate, and found its ISCPDAT, corresponding pin is set as input and connected to other device. After short investigation found broken trace (between dsPIC and sensor, programmer trace was fine), so got just antenna connected to ICSPDAT and causing all APLL problems. When PICkit3 was connected internall 4.7k pull downs drive line to stable low state. |
|
|
|
只有小组成员才能发言,加入小组>>
5125 浏览 9 评论
1984 浏览 8 评论
1914 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3148 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2212 浏览 5 评论
696浏览 1评论
583浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
465浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
601浏览 0评论
494浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-1 16:17 , Processed in 1.238678 second(s), Total 81, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号