Hi, I'm trying to use the SPI interface on Arduino Uno to control an EVB. For now I can successfully write data into IC. However, when I try to read data from IC register and print it out via the com port monitor, the output data is not exactly what I expect. The EVB's SPI read sequence and read command are shown below.
In order to visualize the reading operation, I wrote a function called read_op like the following code and keep alternating different 4 bytes data into register 0x01 to check if the writing operation is working.
Problem is, the local variable SDI_data inside read_op function is not suppose to change the read-back data since in the IC datasheet it say the last 16 bits is don't care. However it does, for example:
SDI_data = 0x0000=>output = 0x0000 0x0000 =>incorrect
SDI_data = 0xFFFF=>output = 0x0400 0x0400 =>incorrect
SDI_data = 0x0688=>output = 0x0688 0x0680 =>correct
SDI_data = 0x0680=>output = 0x0680 0x0680 =>incorrect
SDI_data = 0x0608=>output = 0x0688 0x0680 =>correct
SDI_data = 0x0588=>output = 0x0600 0x0600 =>incorrect
I don't really know what is happening here. Can there be some sort of extra operation performed inside Arduino chip itself to make the output wrong? Or can it be some hardware problem?