3
\$\begingroup\$

I have a legacy expansion connector on an MCU board that I am looking to use in a new mode. I have full firmware control over all the pins going to the connector.

The interface has I2C SCL/SDA pins which are currently used. It also has currently unused SPI pins. However, when the board was first designed, only three SPI pins were defined: MOSI, MISO, and SCK, i.e. there is no chip select.

Since I can guarantee in the firmware that I2C and SPI transactions never overlap, I am considering re-purposing the SDA line as a chip select during SPI transactions.

To do this, at the start of the SPI transaction I would force the SDA line low through the GPIO control registers, run the transaction, and then reconnect the SDA line to the I2C controller so that it goes high again.

A side effect of using SDA to enable the SPI interface is that for every SPI transaction you generate a START condition (SDA H->L with SCL high) followed by a STOP condition (SDA L->H with SCL high), but with no data in between.

Does anyone know if START followed by STOP with nothing in between is a legal sequence of states on I2C?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

From I2C specifications:

A START condition immediately followed by a STOP condition (void message) is an illegal format. Many devices however are designed to operate properly under this condition.

So, as per the specs, it is illegal, but in practice, it depends on the chips on the bus. Some I2C peripherals of MCUs do not like sequences that are not by the protocol, even though there is nothing wrong in theory about sending START and STOP.

\$\endgroup\$
1
  • \$\begingroup\$ I did not know the term "void message". Looking for info on that I found a good link to more info: e2e.ti.com/support/processors/f/791/t/… . From the note, it seems that the I2C master on the MCU is the thing that will be the most likely to be negatively affected. Since the I2C devices attached to my board will not change, I think I'll give it a try and see what happens. \$\endgroup\$
    – crj11
    Commented Sep 4, 2020 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.