Anyway it is very basic to use the SPI interface. Basically you just have to follow the format below:

For the write operation, you should write the OP-code 0xF0 (11110000) follow by the 2 bytes address and finally the 1 byte of data which you wanted to write.
For the read operation, you should write the OP-code 0x0F (00001111) follow by the 2 bytes address. Then, our chip will send you the 1 byte of data by the MISO line.
The SPI follows the timing diagram below:

Notice in the timing diagrm:
When sending the OP-CODE, the MISO line is 0x00.
When sending the address, the MISO line is 0x01 follow by 0x02
When the data is written, the MISO line is 0x03.
When the data is read, the MISO line is the requested data.
I hope you enjoy my article Thanks!
No comments:
Post a Comment