完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我使用的是MRF89XA无线模块和Enc424J600以太网。我不得不减慢我的SPI速度从500到250K的无线,即使数据表说它可以处理1M。在500 K时,我得到的RSSI值波动。我使用的是同一个SPI总线,而不是改变速度。这使我的以太网速度变慢了。我下载了一些文件,SPI总线变成了让我慢下来的东西。因此,我在以太网中更改了ActuthCHIPSOnter和DeSufftCHIPSION,使其达到10MbPs。超高速都在工作,所以我的问题是切换SPI速度行吗?这是正确的方法吗?我只是在这里复制了我的定义。没什么想法。
以上来自于百度翻译 以下为原文 I am using the MRF89xa wireless module and ENC424J600 ethernet. I had to slow down my SPI speed for the wireless from 500k to 250k even though the datasheet says it can handle 1M. At 500k I was getting fluctuating RSSI values. I was using the same SPI bus and not changing the speed. This made my ethernet slow. I download some files and the SPI bus became the thing slowing me down. So I Changed the AssertChipSelect and DeassertChipSelect in the ethernet to make it go at 10Mbps. Super Fast all is working. #define AssertChipSelect() do{PHY_IRQ1_En=0; SPI1STATbits.SPIEN = 0; SPI1CON1bits.PPRE = 3; SPI1CON1bits.SPRE = 6; SPI1STATbits.SPIEN = 1; ENC100_CS_IO = 0;}while(0) #define DeassertChipSelect() do{ENC100_CS_IO = 1; SPI1STATbits.SPIEN = 0; SPI1CON1bits.PPRE = 1; SPI1CON1bits.SPRE = 4; SPI1STATbits.SPIEN = 1; PHY_IRQ1_En=1;}while(0) So my question is switching SPI speeds OK? Is this the correct way to do it? I just copied the setup into my defines here. Not much thought. |
|
相关推荐
7个回答
|
|
|
|
|
|
您可能希望在您的初始硬件设置中设置用于SPI引脚的LAT和TRIS,这样当禁用/启用SPI模块时不会出现故障。这真的不应该是一个问题,因为奴隶芯片的选择应该是高的,但人们永远不会知道。
以上来自于百度翻译 以下为原文 you may want to set up the LAT & TRIS for the SPI pins in your initial hardware setup so that there are no glitches when you disable/enable the SPI module. It really should not be a problem since the slaves Chip Selects should be high, but one can never tell. |
|
|
|
嗨,不知道为什么你做…..(0)一个宏将只与括号一起工作。这是标准C。如果你想让它更具可读性,可以在回车之前使用反斜线来跨越很多行。你还没有识别出你的芯片。张贴在PIC24中,值得一提的是,很多PIC24s不能在SPI上实现10MHz。除数可以设置为这个,但数据表有一个警告,通知你限制到8MHz(由于PPS)。通常只有专用PIN SPI端口可以达到8~9MHz以上。只要检查一下你的数据表就行了。Yorky。
以上来自于百度翻译 以下为原文 Hi, Not sure why you have do..while(0) a macro will work with just the brackets. This is standard C. Also if you want to make it a bit more readable the back slash can be used prior to Carriage Return to spread across numerous lines. You haven't identified your chip. Posted in the PIC24, just worth mentioning that many PIC24s can not achieve 10MHz on the SPI. The divisors can be set to this but the data sheets have a warning that informs you to limit to 8MHz (due to PPS). Normally only dedicated pin SPI ports can achieve above 8-9MHz. Just worth checking your data sheet. T Yorky. |
|
|
|
我认为DO { }(0)是原始微芯片宏的一部分。这是一个宏技术,确保它被当作一个语句,所以可以遵循和()等,并允许一个半冒号跟踪宏。直{}通常不遵循A;
以上来自于百度翻译 以下为原文 I think the do {} while(0) was part of the original microchip macros. It's a macro technique that ensures its treated as one statement, so can follow and if() etc and allows a semi-colon to follow the macro. Straight {} is not normally followed by a ; |
|
|
|
嗨,作为一个例子,下面是从一个工作项目中定义的一些代码……定义…//-------------------------------------------------------------------------------//^。为了保证类似的模拟/ /或销钉不会干扰引导加载程序使用的PIN/LED接口。=0B000 000 000亿;\ANSELG= 0B000 000亿,},并在应用程序中使用…//+------------------------------------------------------------+//~。EADER用于建立CPU和外围设备。类似的PrSimaCurrPuthCuuluxA类似物;//用于串行TX/RX UMeCyActhOngOnTracxIDLeTeX的设备特定配置引脚;MaxActoNo.StimxPotoWrand;MaultActuurPixFordTX;MaulActhOngSeRtxPrtoWrand;宏配置PixFrrx;/ /设备特定宏,用于配置状态DeLeMeCalm的PINIONIOSSEDLID.IDLeTalm;MaulActhOngStEnLeDig.PotoWrand;返回;}尝试它。它有效。T Yorky。
以上来自于百度翻译 以下为原文 Hi, As an example, below is some code cut from a working project... definition... //+---------------------------------------------------------------------------------------+ //| Device action to configure the analogue pins to digitals | //| Note that the Boot Loader does not use analogues and is provided to ensure analogue | //| pins do not interfere with pins used by the boot loader comms/LED interface. | //+---------------------------------------------------------------------------------------+ #define macroCPU_Configure_Analogues { ANSELB = 0b0000000000001100; ANSELC = 0b0000000000000000; ANSELD = 0b0000000000000000; ANSELE = 0b0000000000000000; ANSELG = 0b0000000000000000; } And use in the application... //+---------------------------------------------------------------------------------------+ //| Initialise the device to operate as the Boot Loader | //| Macros defined in the DeviceMap header are used to set up the CPU and peripherals. | //| | void InitialiseChipAndPeripherals(void) { // Device specific macro to disable all Interrupts macroCPU_Disable_All_Interrupts; // Device specific macro to configure the clock operation macroCPU_Configure_Clock; // Device specific macro to configure the analogue pins macroCPU_Configure_Analogues; // Device specific configure pins for Serial Tx/Rx use macroAction_SetTxIdleState; macroAction_SetTxPortDirection; macroConfigurePinForTx; macroAction_SetRxPortDirection; macroConfigurePinForRx; // Device specific macro to configure pin for an status LED macroAction_SetLED_IdleState; macroAction_SetLED_PortDirection; return; } Try it. It works. T Yorky. |
|
|
|
关于SPI速度不工作。你应该用一个范围来查看SPI时钟和数据线。将额外的设备添加到总线将增加电容,并减缓上升时间。许多PIC芯片没有好的驱动程序。我有一个PIC18F26K22项目,它驱动SPI总线上的MPC22S17 I/O扩展器。它在4 MHz驱动9个I/O扩展器上工作良好。我需要把扩张器的数量增加到26个,而且太多了。我在SPI线路中添加了A7HC125缓冲器,大大提高了上升时间。我尝试了7VHC125芯片,它们太快了,我在公共汽车线路上打过电话。幸好我登上了面包板!我的新板卡是今天从FAB交货的(4月1日是的!)把这个范围拿出来!我有一个安捷伦/KiVIEW DSO-2014A,它解码SPI,I2C,CAN和串行。爱它!-克雷格
以上来自于百度翻译 以下为原文 Regarding the SPI speeds not working. You should look at the SPI clock and data lines with a scope. Adding additional devices to the bus will add capacitance and slow down the rise times. Many of the PIC chips do not have good drivers. I have a PIC18F26K22 project that drives MPC22S17 I/O expanders on the SPI bus. It worked well at 4 MHz driving 9 I/O expanders. I needed to increase the number of expanders to 26 and that loaded down the bus too much. I have added a 74HC125 buffer to the SPI lines and they greatly improved the rise times. I tried 74VHC125 chips and they were too fast, I had ringing on the bus lines. Its a good thing I bread boarded that! My new boards are due from fab today (yes on April 1st!). So get the scope out! I have a Agilent/Keysight DSO-X 2014A and it decodes SPI, I2C, CAN and serial. Love it! - Craig |
|
|
|
不要忘记SPI时钟速度只与主站和主站之间的交换有关。单个位在上升或下降位上交换(由CKP和CKE位设置决定),它们可以按照您希望的那样发生。(当然,你必须遵守最大时钟频率规格)(这是为什么不使用从SS的奴隶信号可能是如此糟糕的一个原因-如果奴隶看到SCK线路上的噪声,那么它可以被解释为时钟脉冲,这意味着奴隶与主机失去同步。从属设备不关心时钟脉冲之间经过多长时间,它只是跟随。)因此,您可以随时切换速度(只要主机可以处理),从属者将跟随。此外,交换机的速度将与以太网E的速度无关。xchange用于分组,但可以对分组之间的时间产生影响。苏珊
以上来自于百度翻译 以下为原文 Don't forget that the SPI clock speed only relates to the exchange between the master and the slave. The individual bits are exchanged on the rising or falling bits (as determined by the CKP and CKE bit settings) and they can occur as far apart as you want them to be. (Of course you have to observe the maximum clock frequency specs.) (This is one of the reasons why not using the SS signal for the slave can be so bad - if the slave sees noise on the SCK line then it can be interpreted as a clock pulse which means the slave gets out of sync with the master. The slave does not care how long a time elapses between clock pulses, it just follows along.) Therefore you can switch speed any time you like (as long as the master can handle it) and the slave will tag along. Further, the speed of the exchange will have little to do with the speed of the Ethernet exchange for a packet, but can have an impact on the time between packets. Susan |
|
|
|
只有小组成员才能发言,加入小组>>
5184 浏览 9 评论
2005 浏览 8 评论
1932 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3179 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2230 浏览 5 评论
742浏览 1评论
629浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
512浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
641浏览 0评论
538浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-29 08:32 , Processed in 1.446930 second(s), Total 89, Slave 72 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号