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.
Hello,
I have TMS320F28379D which connects to a RTC module via SPI interface (4-wire).
The RTC module provides 8 bits length address and data.
When I configured the SPI with 16 bits (SPICHAR = 15) and used 16 bits read/write, the results are correct:
spi_writeByte(0x0100);
second = spi_readByte(); //read register 0x01
However if the length of data is set to 8 (SPICHAR = 7), all the received data is wrong in the following two cases:
1.
spi_writeByte(0x01); // seconds register read address
spi_readByte(); // dummy read
spi_writeByte(0x01);
second = spi_readByte(); //read register 0x01
2.
spi_writeByte(0x0100);
second = spi_readByte(); //read register 0x01
Am I missing something?
Thanks,
HL
The read serial bit stream is simultaneously clocked into the register with the transmit.clock
After the data is transmitted the slave data has already shifted into the register.
The read reads the contents of the register.
Hi Henry
Did you get your problem resolved or do you still have some problems?
-Marlyn
Henry,
For SPI, the master is the only one that supplies the clocks and it does so only during transmit.
If your custom design is to transmit an address, then the slave receives it and it is in the pipeline to respond during the next transmit.
Is your slave a 8 bit or 16 bit slave? normally it is the same as the master.
For my application example, the address is always the same so I transmit out the value that was converted by the ADC in the uC that I use to graph the response and the slave transmits a voltage representation of the model's calculated output back to the uC during the same transmit.