如题,我用示波器测量SPI的波形,高电平是3.3v没问题,为什么低电平是2v?下面是我的程序
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
//#define LedReg (*((volatile Uint16 *)0x41FF))
//Uint16 *ExRamStart = (Uint16 *)0x100000;
void spi_xmit(Uint16 a);
void spi_fifo_init(void);
void spi_init(void);
void main(void)
{
Uint16 sdata; // send data
Uint16 rdata; // received data
InitSysCtrl();
InitXintf16Gpio(); //zq
InitSpiaGpio();
DINT;
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
spi_fifo_init(); // Initialize the Spi FIFO
spi_init(); // init SPI
sdata = 0xAAAA;
for(;;)
{
// Transmit data
spi_xmit(sdata);
// Wait until data is received
while(SpiaRegs.SPIFFRX.bit.RXFFST !=1) { }
// Check against sent data
rdata = SpiaRegs.SPIRXBUF;
//sdata++;
}
}
void spi_init()
{
SpiaRegs.SPICCR.all =0x000F; // Reset on, rising edge, 16-bit char bits
SpiaRegs.SPICTL.all =0x0086; // Enable master mode, with phase delay,
// enable talk, and SPI int disabled.
SpiaRegs.SPIBRR =0x006; //波特率7.5MHz
SpiaRegs.SPICCR.all =0x008F; // Relinquish SPI from Reset
SpiaRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb xmission
}
void spi_xmit(Uint16 a)
{
SpiaRegs.SPITXBUF=a;
}
void spi_fifo_init()
{
// Initialize SPI FIFO registers
SpiaRegs.SPIFFTX.all=0xE040;
SpiaRegs.SPIFFRX.all=0x205f;
SpiaRegs.SPIFFCT.all=0x0;
}
(顺便说一下,f28335的芯片资料上SPI波形的高电平不知道为什么是5v,是不是错了) |