全国服务热线: 18601085302
企业新闻

SPI时钟时序分析测试

发布时间:2023-12-17        浏览次数:4        返回列表
前言:SPI时钟时序分析测试
SPI时钟时序分析测试
寄存器说明Motorola定义的SPI寄存器包括:·SPI Control Register 1 (SPICR1) ·SPI Control Register 2 (SPICR2) ·SPI Baud Rate Register (SPIBR) ·SPI Status Register (SPISR) ·SPI Data Register (SPIDR) 其中除了状态寄存器SPISR为只读(Read-only),其它寄存器都是可读写的。通过往寄存器中写入不同的值,设置SPI模块的不同属性。1.控制寄存器1 SPICR1图6. 控制寄存器1 SPICR1SPIE — SPI Interrupt Enable Bit 1 = SPI interrupts enabled 0 = SPI interrupts disabledSPE — SPI System Enable Bit 1 = SPI enabled, port pins are dedicated to SPI functions 0 = SPI disabled (lower power consumption)SPTIE — SPI Transmit Interrupt Enable 1 = SPTEF interrupt enabled 0 = SPTEF interrupt disabledMSTR — SPI Master/Slave Mode SelectBit 1 = SPI is in Master mode 0 = SPI is in Slave modeCPOL— SPI Clock Polarity Bit 1 = Active-low clocks selected. In idle state SCK is high 0 = Active-high clocks selected. In idle state SCK is lowCPHA— SPI Clock Phase Bit 1 = Sampling of data occurs at even edges (2,4,6,…,16) of the SCK clock 0 = Sampling of data occurs at odd edges (1,3,5,…,15) of the SCK clockSSOE — Slave Select Output Enable SSOE 用于主设备设置SS管脚功能,它和MODFEN组合决定主设备SS管脚功能。如表1所示其功能组合:表1. SS输入/输出选择LSBFE — LSB-First Enable 1 = Data is transferred least significant bit first 0 = Data is transferred most significant bit first2.控制寄存器2 SPICR2图7. 控制寄存器1 SPICR2MODFEN — Mode Fault Enable Bit 1 = SS port pin with MODF feature 0 = SS port pin is not used by the SPIBIDIROE — Output enable in the Bidirectionalmode of operation 控制双向模式(Bidirectional Mode)下主设备的MOSI和从设备MISO的输出缓冲器 1 = Output buffer enabled 0 = Output buffer disabledSPISWAI — SPI Stop in Wait Mode Bit 1 = Stop SPI clock generation when in wait mode 0 = SPI clock operates normally in wait modeSPC0 — Serial Pin Control Bit 0 控制(单个)数据管脚是否配置为双向模式,与BIDIROE组合控制(单个)数据管脚同时支持收发功能(如下表2)表2. MOSI/MISO双向管脚配置3.波特率寄存器 SPIBR图8. 波特率寄存器 SPIBRSPPR2–SPPR0 — SPI Baud Rate Preselection Bits SPR2–SPR0 — SPI Baud Rate SelectionBits以上五个寄存器通过下面公式决定波特率除数因子(BaudRateDivisor),进而决定SCK时钟频率。除数因子:(通过五个参数计算出来的除数因子不仅包括2^N,还包括4/6/10等总计64个组合)波特率:举例,SPPR[2:0]设为101,SPR[2:0]设为000,计算得除数因子(5+1) * (2^1) = 12。如果系统时钟速率为25MHz,则SCK时钟速率 = 25MHz/12 = 2.0833MHz.4.状态寄存器 SPISR图9. 状态寄存器 SPISRSPISR表征SPI传输状态,只可读,不可写。
推荐产品
信息搜索
 
信息技术新闻
北京淼森波信息技术有限公司
  • 地址:北京市海淀区永泰庄北路1号天地邻枫2号楼A座B101
  • 手机:18601085302
  • 联系人:邓经理
分析测试新闻
分析测试相关搜索