2015-03-11 03:38 PM
Hello,
I am having a little problem with my SPI between the nucleo board and the TI cc3200 launchpad. I have been using the SPI communication without any problem under the following configuration TI- Slave Nucleo-Master Now I have reversed the roles and I cant seem to get a proper response from the Slave(nucleo). e.g)I put the value 0x08 in the nucleo SPI_TX register.From the master I send a value (0x50).I am able to get and read this data on the slave RX reg and its correct.This transmission should push out the 0x08 value from the slave to master but on the master side I'm reading 0xC0. Every time I'm able to receive the data on the slave correctly but the master doesnt get the data stored in slave's SPI TX register. This is the code I'm using on the slave side
recv_data[0]= SPIsend(0x08);
unsigned short SPIsend(unsigned short data)
{
SPI1->DR=data;
while(!(SPI1->SR & SPI_SR_TXE));
while(!(SPI1->SR & SPI_SR_RXNE));
while (SPI1->SR & SPI_SR_BSY);
return (SPI1->DR);
}
The SPI word length on both side is 16bits wide.
Clk polarity and phase settings are the same on both sides.These were the same settings I used when I was sending data from nucleo to TI successfully.
Any help would be appreciated.
#spi
2015-03-11 06:58 PM
Wouldn't you want to check if the register is empty before putting something in it?
2015-03-11 07:11 PM
Only sending one word after reset so I assumed there wont be any problems.But I have also checked by moving the while(!(SPI1->SR & SPI_SR_TXE)); condition before writing to DR and I get the same result.
The update is I changed the clock speed at the master and now Im getting these resultsTX reg of slave TI Receives
0x44=0100 0100 0010 0010
0x45=0100 0101 0010 0010
0xF6=1111 0110 0111 1011
0xF9=1111 1001 0111 1100
It seems TI is receiving 1 bit right shifted version of the slave data.