MISO problem when controlling an EVB with SPI

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?

I moved your topic to an appropriate forum category @yi_ting_chen.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.