|
Hello.
I'm successfully able to communicate with an accelerometer using the SPI (at91sam7x256). However, it was necessary to use a command line that I still kind of don't understand.
For example, when I want to get the accel. values, I just send the command byte and then a dummy byte to get the values:
// Request accel. values write_spi(READ_BYTE | SINGLE_BYTE | REG_OUTX_L); // X_axis low byte xlow = write_spi(0xFF);
It's been working because after writing the command byte to SPI_TDR, if the dummy byte is sent, I set the LASTXFER bit to rise the NPCS. And there is the point that I got stuck: When using SPI and clearing CSSAT bit, the datasheet says that the NPCS rises after the TDR data has been sent. However, it NEVER happens unless a set the LASTXFER after the last byte of my wish...
Could anyone explain it to clear my mind please?
I really thank for the attention.
Sylvio
|