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.

CC3220S-LAUNCHXL: SPI slave received shifted data?

Part Number: CC3220S-LAUNCHXL

Hi,
My continuity problem got resolved I was using SPI_MODE_BLOCKING earlier but now I am using SPI_MODE_CALLBACK. Now my issue is with the data I am receiving in the slave side cc3220 Rx buffer most of the time it is correct but some times it is getting shifted and reverse data for example:

case 1 : Shifted data

Original data to rx: 0x1514 = 0001 0101 0001 0100
Received data : 0x2A28 = 0010 1010 0010 1000

case 2: Reverse data

Original data to rx: 0x1514 = 0001 0101 0001 0100
Received data : 0x5141 = 0101 0001 0100 0001

Case 3: Reverse of shifted data

original data to rx: 0x1514 = 0001 0101 0001 0100
Received data : 0xA282 = 0101 0010 1000 0010

Can you help me resolving this?


Regards,
Nitin

  • Hi Nitin,

    What is the SPI clock frequency?
    In the case of bits being shifted on the CC3220 slave side, it is most likely due to the SPI signals at the CC3220 side not meeting the datasheet spec requirements as described in section 4.14.5.1.2:
    www.ti.com/.../cc3220.pdf

    Try checking the SPI signals with an oscilloscope and see if they match the spec. In particular, you should pay close attention to the SPI clock line. The CC3220 can be sensitive to any irregularity on the SPI clock line, and missing clock edges can certainly result in the behavior that you have described above. Assuming you discover that the SPI clock line doesn't meet the spec, you will have to experiment and see whether or not you can get that signal in spec since I am assuming that the SPI master is some non-TI device that I would not be able to test with. Some users with SPI clock issues have placed some resistance in series with the clock line (something on the order of 2.2k Ohms) and have seen positive results.

    In the end, you'll probably have to debug the hardware setup you have on your end, since the SPI software example and the SPI driver has been stress tested at 20MHz with TI launchpads and has been shown to work without any data errors.

    Let me know if you have further questions, or want some advice on interpreting debug data you get.

    Regards,
    Michael
  • Hi Michael,

    1) SPI clock frequency is 8 Mhz I tested it on 1 Mhz as well but got the same result.

    2) I am checking SPI signals using logic analyzer  there it is showing perfect clock and surely some delay is there in clock signal between each packet and I am using Arduino as Master.

    3) I tried using 2.2 K ohms resistance but it did not help.

    4) Surprisingly when I am connecting logic analyzer I am receiving correct data in slave side but I am not receiving anything in Arduino side at that time except FF.  

     

    Regards,

    Nitin

  • Hi Nitin,

    It's interesting that you get the same result at 1MHz. Does the data seem to get more corrupt as you increase the SPI clock rate, or does it seem to occur at about the same rate?

    When checking the SPI signals, you must use an oscilloscope and not a logic analyzer. The logic analyzer will only show you the logic states of the signal as it interprets the underlying analog signal to digital data. It will not show you the key timing parameters and signal transitions that you need to observe. I suggest you use an oscilloscope to check those signals.

    Also, make sure that the clock polarity and phase settings are set correctly. You can take a look at section 8.2.2.2.5 of the TRM:
    www.ti.com/.../swru465.pdf
    for an illustration of the clock and phase settings. If the settings on the CC3220 do not match that of the Arduino, then you will get unexpected results.

    Regards,
    Michael
  • Hi Michael,

    Since you told me there could be some issue with the clock so I tried coding with FPGA. Connected FPGA SPI master to cc3220 but I received some corrupt data. Then I applied 2.2 K ohm resistor but that did not change anything so I tried with 4.7K ohm some how I received few packets of correct data then I tried with with 6.8 K ohm it got little better but still getting a lot of shifted value. I do not understand why the data I am receiving gets shifted from Arduino and FPGA .

    Talking about mode then I am working with SPI mode1 I have checked nothing is wrong with it both the sides have same mode.

    Regards,
    NItin

  • Hi Michael,

    I tried a lot and now my problem is solved I simply added some delay and it started working fine for me. If anyone have same problem just go through above mentioned suggestions . If still there is some problem ping me may be I will be able to help you, and thank you Michael for your help.

    Regards,
    Nitin.