SPI Output 0x55

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
kurt_k
Posts: 10
Joined: Wed Dec 13, 2017 2:37 am
Has thanked: 1 time
Been thanked: 2 times
Contact:

SPI Output 0x55

Post by kurt_k »

I hope some else has seen this and has a solution. I am trying to communicate with a digital temperature sensor(ADT7301)via SPI . Reading through the data sheet I came to find that the sensor would prefer to have input data streamed as zero's. Looking at the SPI output, I've notice that during a read of the SDI line the SDO line is outputting 0x55. Does anyone know of a way to change this value? I really would like it to output 0x00. Anyone know how to work around this? Any help would be much appreciated.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SPI Output 0x55

Post by Benj »

Hello,

SPI comms is bi-directional in nature but 99% of the time only the outgoing byte or incoming byte is used at any one time. Therefore for the read we are simply outputting an arbitrary value.

If the SPI slave device you're using requires both input and output bytes to contain valid data then instead of using the SPI master component you can use the SPI CAL component available from the Tools component menu. This component has a Master_Byte function which allows you to harness the transmitted byte and the received byte.

Let us know how you get on.

kurt_k
Posts: 10
Joined: Wed Dec 13, 2017 2:37 am
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: SPI Output 0x55

Post by kurt_k »

Thank you for pointing out the peripheral components. I hadn't even noticed them. Using the SPI from that group seemed to do the trick. I was able to retrieve the correct values out of the sensor.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: SPI Output 0x55

Post by stefan.erni »

Hi Kurt

Can you show me how did you use this Cal_SPI

regards

Stefan

Post Reply