完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
使用HARMony 2.00b和PIC32MX340F512HAll的配置是使用MHC中的图形“时钟图”来设置的。K=40MHZSPI1 SCK=10MHZZ,但取而代之的是,我得到了一个1MHz的SPI时钟。(用TEKTRONIX DPO3034—300 MHz示波器测量)知道我做错了什么吗?
以上来自于百度翻译 以下为原文 Using Harmony 2.00b and a PIC32MX340F512H All of the configuration is set up using the graphical "Clock Diagram" in MHC. Configuration bits generated by MHC (from `system_init.c`): /*** DEVCFG0 ***/ #pragma config DEBUG = OFF #pragma config ICESEL = ICS_PGx2 #pragma config PWP = OFF #pragma config BWP = OFF #pragma config CP = OFF /*** DEVCFG1 ***/ #pragma config FNOSC = PRIPLL #pragma config FSOSCEN = OFF #pragma config IESO = ON #pragma config POSCMOD = EC #pragma config OSCIOFNC = ON #pragma config FPBDIV = DIV_2 #pragma config FCKSM = CSDCMD #pragma config WDTPS = PS1048576 #pragma config FWDTEN = ON /*** DEVCFG2 ***/ #pragma config FPLLIDIV = DIV_2 #pragma config FPLLMUL = MUL_20 #pragma config FPLLODIV = DIV_1 And from `system_config.h`: #define SYS_CLK_FREQ 80000000ul #define SYS_CLK_BUS_PERIPHERAL_1 40000000ul #define SYS_CLK_UPLL_BEFORE_DIV2_FREQ 48000000ul #define SYS_CLK_CONFIG_PRIMARY_XTAL 8000000ul #define SYS_CLK_CONFIG_SECONDARY_XTAL 32768ul Then I set up SPI1 (not using the harmony SPI driver): void spi1_setup() { // Disable SPI interrupts PLIB_INT_SourceDisable(INT_ID_0, INT_SOURCE_SPI_1_ERROR); PLIB_INT_SourceDisable(INT_ID_0, INT_SOURCE_SPI_1_RECEIVE); PLIB_INT_SourceDisable(INT_ID_0, INT_SOURCE_SPI_1_TRANSMIT); PLIB_SPI_Disable(SPI_ID_1); PLIB_SPI_BufferClear(SPI_ID_1); // Set SPI interrupt priorities PLIB_INT_VectorPrioritySet(INT_ID_0, INT_VECTOR_SPI1, INT_PRIORITY_LEVEL1); PLIB_INT_VectorSubPrioritySet(INT_ID_0, INT_VECTOR_SPI1, INT_SUBPRIORITY_LEVEL0); SPI1BRG = 1; // set the baud rate divider FIXME: This is supposed to give us 10MHz SPI, but we only get 1MHz . PLIB_SPI_ReceiverOverflowClear(SPI_ID_1); PLIB_SPI_StopInIdleDisable(SPI_ID_1); PLIB_SPI_ClockPolaritySelect(SPI_ID_1, SPI_CLOCK_POLARITY_IDLE_LOW); PLIB_SPI_OutputDataPhaseSelect(SPI_ID_1, SPI_OUTPUT_DATA_PHASE_ON_ACTIVE_TO_IDLE_CLOCK); PLIB_SPI_InputSamplePhaseSelect(SPI_ID_1, SPI_INPUT_SAMPLING_PHASE_IN_MIDDLE); PLIB_SPI_CommunicationWidthSelect(SPI_ID_1, SPI_COMMUNICATION_WIDTH_8BITS); PLIB_SPI_FramedCommunicationDisable(SPI_ID_1); PLIB_SPI_MasterEnable(SPI_ID_1); PLIB_SPI_Enable(SPI_ID_1); // DMA interrupt priorities SYS_INT_VectorPrioritySet(INT_VECTOR_DMA3, INT_PRIORITY_LEVEL1); SYS_INT_VectorSubprioritySet(INT_VECTOR_DMA3, INT_SUBPRIORITY_LEVEL0); PLIB_DMA_Enable(DMA_ID_0); // RX DMA configuration PLIB_DMA_ChannelXSourceStartAddressSet(DMA_ID_0, DMA_CHANNEL_3, (uint32_t) &SPI1BUF); PLIB_DMA_ChannelXSourceSizeSet(DMA_ID_0, DMA_CHANNEL_3, 1); PLIB_DMA_ChannelXCellSizeSet(DMA_ID_0, DMA_CHANNEL_3, 1); PLIB_DMA_ChannelXStartIRQSet(DMA_ID_0, DMA_CHANNEL_3, DMA_TRIGGER_SPI_1_RECEIVE); // TX DMA configuration PLIB_DMA_ChannelXDestinationStartAddressSet(DMA_ID_0, DMA_CHANNEL_2, (uint32_t) &SPI1BUF); PLIB_DMA_ChannelXDestinationSizeSet(DMA_ID_0, DMA_CHANNEL_2, 1); PLIB_DMA_ChannelXCellSizeSet(DMA_ID_0, DMA_CHANNEL_2, 1); PLIB_DMA_ChannelXStartIRQSet(DMA_ID_0, DMA_CHANNEL_2, DMA_TRIGGER_SPI_1_TRANSMIT); } This should result in:
Any idea what I am doing wrong? |
|
相关推荐
6个回答
|
|
您好,您的外部XTAL的值是多少?看起来您的头文件中的系统时钟频率是8MHz(而不是80MHz)在图形时钟配置器中看到SYSCLK的80MHz吗?你能显示一个完整的时钟树的截图吗?当做
以上来自于百度翻译 以下为原文 Hi, What is the value of your external XTAL ? It seems your system clock frequency in header file is 8MHz (instead of 80MHz) Do you see 80MHz for SYSCLK in the graphical Clock configurator ? Can you show a screenshot of your complete clock tree? Regards |
|
|
|
它是一个具有8MHz晶体的ChIPKIT UC32板。哪个头文件?在SytSyCyfig.h中,我看到这是8个,七个零点到80MHz。我必须结合两个截图,因为这个图表不适合我的23个“高清屏幕”。此外,当我尝试贴附图像,我得到一个“访问拒绝”错误。这个论坛有点问题…http://dl。DROPPBOXUrCON…OM/U/6917461/Cord.PNG.不管我如何调整窗口大小,这些椭圆都在那里,我不能读取整个值。但这些登记表对我来说是正确的。我还检查了使用“自动计算”按钮:http://dl。DROPBOXUSECON…COM/U/6917461/Auto.png-感谢的帮助。还有其他想法吗?
以上来自于百度翻译 以下为原文 It is a chipKIT uC32 board with an 8MHz crystal. Which header file? In `system_config.h` I see: #define SYS_CLK_FREQ 80000000ul This is 8 with seven zeros → 80MHz. I had to combine two screenshots, because the diagram does not fit on my 23" HD screen. Also, when I try to post with attached images, I get an "access denied" error. This forum is a bit buggy... https://dl.dropboxusercon...om/u/6917461/clock.png No matter how I resize the window, those ellipses stay there, and I can't read the entire value. But the registers look right to me. I also checked using the "auto-calculate" button: https://dl.dropboxusercon...com/u/6917461/auto.png Thanks for the help. Any other ideas? |
|
|
|
看一下调试模式下的寄存器:COSC=000_电流振荡器=内部FRC振荡器NOSC=011_新振荡器=带有PLLThis的初级振荡器……COSC也应该是011,对吧?
以上来自于百度翻译 以下为原文 Taking a look at registers in debug mode:
|
|
|
|
您好,您调用的函数是:SYS_DEVCON_PerformanceConfig(SYS_CLK_SystemFrequencyGet());orSYSTEMConfig.(80000000);HTTP://www. McCHIP.COM/FUMMS/M40723.ASPX
以上来自于百度翻译 以下为原文 Hello, are you calling the function: SYS_DEVCON_PerformanceConfig(SYS_CLK_SystemFrequencyGet()); or SYSTEMConfigPerformance(80000000); somewhere at the beginning? http://www.microchip.com/forums/m404723.aspx |
|
|
|
是的,COSC应该与NOSC相同。我有过几次这个问题。检查振荡器的电气连接。你可以有错误的电容或电阻器的值,振荡器可以短路到地面。检查一切。
以上来自于百度翻译 以下为原文 Yes, COSC should be the same as NOSC. I had this problem a few times. Check electrical connections of your oscillator. You can have wrong values of capacitors or resistor, oscillator can be shorted to ground. Check everything. |
|
|
|
发现问题:主振荡器被设置为EC,而不是HS。由于“EC”代表“外部时钟”,因此我认为当使用外部晶体时,这是可以选择的,其他一切都使用内部谐振器。错了!根据PIC32系列参考手册第6.3节:XT=低速外部晶体HS=高速外部晶体EC=“将OSC1管脚配置为可由CMOS驱动器驱动的高阻抗输入”即不是晶体。
以上来自于百度翻译 以下为原文 Problem found: Primary oscillator was set to EC, instead of HS. Since "EC" stands for "External Clock", I though that was the option to choose when using an external crystal, and everything else used internal resonators. WRONG! According to section 6.3 of the PIC32 family reference manual:
|
|
|
|
只有小组成员才能发言,加入小组>>
5242 浏览 9 评论
2031 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3207 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2256 浏览 5 评论
778浏览 1评论
669浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
596浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
678浏览 0评论
577浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 16:04 , Processed in 2.007165 second(s), Total 87, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号