完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我正在实验中的SPI增强模式,其中TX/RX缓冲器被称为8级深。设备是DSPIC33 EP256MU806,但是根据我的实验,我发现它是10级深的。检查我的代码:int模式(17)={0x800,0x400,0x2000,0x1000,0x0800,0x0400,0x0200,0x0100。020、0x000、0x000、0x000、2、0x000、2、0x000、1、0x000 };int pP;int级;空隙α属性表((α中断子,NoAutoPoSpv,阴影)){SPI2IIF=0;水平=0;ASM(“BTG LATF,α0”);//LED闪存(SPI2STATBITS.SPITBF=0){{SycCyChuff= SPI2BUF;SPI2BUF=模式[PP++];IF;IF;,0x00 80,0x00 40,0x0(PP=17)PP=0;水平++;}返回;}在从属模式下SPI以12MHz的时钟速率运行。16位。当TX为空时,它被设置为中断。用我的示波器测量的输出是一个稳定的脉冲速度,由于旋转模式,它的频率比字速率低大约十六分之一。这表明所有的工作都很好,但是LED以37.5kHz的频率切换,这意味着中断以7kHz的速率命中。一些计算告诉我们,每个中断处理12e6/ 75000=160比特。这意味着FIFO必须是10个等级,等级变量证实了这一点,你说呢?我一定做了一些错误的计算,因为我不认为Mchip增加了两个水平只是为了好。我之所以发布这个问题是因为我有点不愿意使用一个没有文档的“特征”。
以上来自于百度翻译 以下为原文 Hi again. I'm experimenting with the SPI in enhanced mode where the TX/RX buffers are said to be 8 levels deep. The device is dsPIC33EP256MU806 But according to my experiments, I have found it to be 10 levels deep. Check my code: int pattern[17]= {0x8000,0x4000,0x2000,0x1000, 0x0800,0x0400,0x0200,0x0100, 0x0080,0x0040,0x0020,0x0010, 0x0008,0x0004,0x0002,0x0001,0x0000 }; int pP; int levels; void __attribute__((__interrupt__, no_auto_psv,shadow ))_SPI2Interrupt(void) { _SPI2IF = 0; levels=0; asm("btg LATF, #0"); // Led flash while( SPI2STATbits.SPITBF == 0){ sync_check = SPI2BUF; SPI2BUF= pattern[pP++]; if( pP==17) pP=0; levels++; } return; } The SPI runs with a clock rate of 12Mhz in slave mode. 16 bits. It is set to interrupt when the TX is empty. The output, measured with my oscilloscope, is a steady pace of pulses with approximately one sixteenth lower frequency than the word rate, due to the rotating pattern. This indicates that everything works fine. But the led toggles with a frequency of 37.5khz which means that the interrupt hits in a 75khz rate. Some calculations tells us that it handles 12e6 / 75000 = 160 bits every interrupt. This means that the fifo must be 10 levels. The levels variable confirms this. What do you say? I must have made some erroneous calculations, since I don't think Mchip has added two levels just to be nice. :) I'm posting this issue since I'm a bit reluctant to use an undocumented "feature". Cheers. |
|
相关推荐
1个回答
|
|
FIFO就像他们说的那么深刻。注意,移位寄存器是除了FIFO之外的。
以上来自于百度翻译 以下为原文 The fifo is a deep as they say it is. Note that the shift register is in addition to the the fifo. |
|
|
|
只有小组成员才能发言,加入小组>>
4814 浏览 9 评论
1823 浏览 8 评论
1743 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2949 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2055 浏览 5 评论
452浏览 1评论
1107浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
355浏览 0评论
260浏览 0评论
LAN9252使用SQI通信,进行数字复位后读BYTE_TEST异常
1777浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-19 07:02 , Processed in 1.048022 second(s), Total 68, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号