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.

TMS320F28035: Encoder interfacing via SPI

Part Number: TMS320F28035


Hii,

I am interfacing CUI AMT203 Encoder with the TI TMS320F2835 microcontroller. According to the datasheet of encoder, I understand that the clock polarity = 0, clock phase = 1 should be used.

When clock phase = 0, clock polarity = 1, (0x10 is the command for reading position from the encoder)

MOSI Line
(Master output)
Command Sent
MISO Line
(Slave output)
Response Received
0x10 0x00
0x00 0x10
0x00 0x00
0x00 0x00

However I tried out, clock polarity =0 and clock phase =0, I find the following response from the encoder:

MOSI Line
(Master output)
Command Sent
MISO Line
(Slave output)
Response Received
0x10 0xA5
0x00 0xA5
0x00 0xA5
0x00 0xA5

0xA5 is the byte which encoder returns when there is no data to be sent

Can anyone please help me with, why there is such behavior observed? Can the encoder respond to both modes of SPI? In both the modes, I was not able to read the position of the encoder.

Thanks in advance,

Shalini Addepalli

  • Hi Shalini,

    I did not get why you would use the second configuration to send the data. When you send the the data with the different configuration than what is expected, the slave might interpret the data in a different way.
    Like in your case, with clock polarity= 0, the SPI sends/reads the data at rising edge and with clock polarity=1, it sends/reads the data at falling edge.
    I recommend you to use the configuration specified in the datasheet

    Regards,
    Veena
  • Hii Veena,

    Thanks for your reply.

    The encoder (SPI slave) does not respond with 0xA5, when the command (0x00) is sent, when the clock polarity = 0 and clock phase = 1.(Which should be the configuration according to the datasheet).

    But when I send the command (0x00) with clock polarity = 0 and clock phase = 0, it responds with 0xA5.

    Can you please interpret why such behavior is observed? In both the cases the command sent to the encoder is 0x00.

    Thanks,
    Shalini Addepalli
  • Hi Shalini,

    I believe it could be best explained by the encoder vendor. Have you asked this question to them?

    Regards,
    Veena