This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Good evening.
I am using f28027 launchpad for communicating with a DRV8301 through SPI.
The communication problem seems to be that the SPISTE pin remains always at low state even though I try to make the transition from high to low, as the DRV requires for its RX. I tried to find the register that determines this transition from the 'SPRUG71B' but I am still confused.
Can anyone explain here which register determines the SPISTE state to activate the RX state on the Slave DRV from the Master F28027,
or post a code example which acts in this way?
My code is as follows:
for(i=0; i<2; i++)
{
sdata = 0x1438;
spi_xmit(sdata);
// Wait until data is received
while(SpiaRegs.SPIFFRX.bit.RXFFST !=1) { }
// Check against sent data
rdata = SpiaRegs.SPIRXBUF;
sdata = 0x9438;
spi_xmit(sdata);
while(SpiaRegs.SPIFFRX.bit.RXFFST !=1) { }
rdata = SpiaRegs.SPIRXBUF;
}
for(;;);
}
void spi_init()
{
SpiaRegs.SPICCR.all =0x4F;
SpiaRegs.SPICTL.all =0x000E // Enable master mode, normal phase,
// enable talk, and SPI int disabled.
SpiaRegs.SPIBRR =0x7F;
//SpiaRegs.SPICCR.all =0x009F; // Relinquish SPI from Reset
SpiaRegs.SPICCR.all =0x8F;
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=0x2040;
SpiaRegs.SPIFFCT.all=0x0;
}
Mark.
Thank you very much for the information.
You are right, I checked the EALLOW and somehow I forgot to set it. I also used the 'CLOCK PHASE' for 'half-cycle' on the SPICTL register and worked fine.
So now all data are transmitted and DRV replies as should.
Thanks again for the support.
George