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
Different SPI settings; Is that possible
Moderator: Benj
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel