Page 1 of 1

Different SPI settings; Is that possible

Posted: Thu Jul 10, 2014 1:10 pm
by henker
Hello,
I have a project where I'm using different components (real time clock, light sensor and temperature sensor) that are using the SPI protocol.
From my PIC I have made a SPI bus connecting these sensors to collect their data. The problem I have now is that of the three components, one requires a different SPI setting. For the RTC and light sensor I use
SPI clock polarity: Idle_High
SPI clock edge: Data transmit on rising clock edge
SPI sample bit: Sampled at the middle.

Unfortunately, the TC77 temp. sensor requires the following settings to work:
SPI clock polarity: idle_low
SPI clock edge: Data transmit on falling clock edge
SPI sample bit: Sampled at the middle.

Is there any way that this can be re-solved in the SPI legacy module, or, do I need to write a bit banging routine for the TC77?

Thanks
Henk

Re: Different SPI settings; Is that possible

Posted: Thu Jul 10, 2014 2:07 pm
by Benj
Hello Henk,

I don't think you can do this unless you uninitialise and reinitialise the bus before talking to the different devices. This should work ok.

Or you can set the alternate SPI component to use the software channel and then use other pins on your microcontroller to drive the second SPI bus. This will not effect the setup of the other two SPI components and do the bit banging for you.

Re: Different SPI settings; Is that possible

Posted: Thu Jul 10, 2014 6:18 pm
by henker
Thanks for the quick reply Ben,

I'll give this a try
Henk