3 Wire SPI

Status
Not open for further replies.

OhioJim

Well-known member
Can the Teensy 4.0 support 3 wire SPI?

If so, how would that be done? Is it in the driver sketch?
 
I assume you already checked the Reference manual Chapter 48?

I don't see any obvious way to use the LPSPI in 3 wire mode. ..

Can you do it other ways? Maybe...

You might be able to do it bit-banging... i.e. software emulation of it.

Or you might be able to use Flex IO to do it. I have played some with FlexIO to emulate normal SPI... But have not tried it for 3 wire...

Good luck
 
The hardware should support it, according to the RM, but no it's not in library support that I know of.

47.3.2.4 *Pin Configuration

The LPSPI_SIN and LPSPI_SOUT pins can be configured via the PINCFG configuration

to swap directions or even support half-duplex transfers on the same pin
 
What I have now are two ADXL337 accelerometers, feeding an ADS1256 ADC, which is on an SPI port. The purpose is to sense the tilt angles of the two accelerometers. I am not satisfied with the results, since it seems like a lot of work in the software---reading the ADC, scaling, averaging, etc, etc.

I am trying to replace the two ADXL337 with two ADXL313, which seem a lot simpler in my application. The ADXL313 can be configured for 3 or 4 wire SPI, or I2C and does the ADC on chip. Since I am already using SPI I looked at that first, but because of the limited wires on the existing cables I would have to use 3 wire SPI, and still have to swap out some connectors.

After further research I see that using I2C would be easier, as I can use the existing cables and connectors, and it is plenty fast enough for my application.
 
I should clarify...

Even though 3 wire SPI and I2C require only 3 wires (plus power and ground), 3 wire SPI also requires a chip select for each device. Since I have two ADXL313, that means 2 extra pins and I would have to redo my connectors and cables.

I2C does not have a chip select and multiple devices can be on the same buss so long as they have different addresses. The cables and connectors I already have installed for use with the ADXL337/ADS1256 will work as is.
 
Status
Not open for further replies.
Back
Top