I am working with the EFR32MG24 Wireless SoC Family. There is a controller and multiple sensors with custom cables and connectors. For flexibility it would be desirable to connect the cable two ways, i.e. by rotating the connector and thus swapping some cables.
Currently there are 5 connections aligned in a line as follows:
o o o o o
GND SCL V+ SDA GND
by rotating the connector cable by 180°, V+ and GND would still work but SCL/SDA would be swapped, thus the question. Note however, that the ports could be configured differently, but there are only 4 cables but 5 connections due to a previous SYNC cable not used anymore.
Now let's say there are two GPIO Pins, C05 and C06 to which the two I2C cables are connected. I am wondering, whether it is possible to somehow detect if e.g. SCL is connected to C05 and SDA to C06 or if it is vice versa.
An approach would be to just route them one way and test if works (potentially with some configuration communication) and if not, reset I2C and reroute the pins.
Another idea is as they are connected via GPIO, listen to one pin and detect, whether this one is the Clock or not.