Different SPI settings; Is that possible

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
henker
Posts: 45
Joined: Mon Dec 22, 2008 11:22 pm
Location: Prospect, NS, Canada
Has thanked: 7 times
Been thanked: 2 times
Contact:

Different SPI settings; Is that possible

Post 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

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: Different SPI settings; Is that possible

Post 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.

henker
Posts: 45
Joined: Mon Dec 22, 2008 11:22 pm
Location: Prospect, NS, Canada
Has thanked: 7 times
Been thanked: 2 times
Contact:

Re: Different SPI settings; Is that possible

Post by henker »

Thanks for the quick reply Ben,

I'll give this a try
Henk

Post Reply