I2C and CANbus simultaneously on Electron

Hey, just wondering about using the CANbus and the I2C bus concurrently with the Electron.

When using I2C…

  • do pins D1 and C5 both broadcast SCL?
  • do pins D0 and C4 both broadcast SDA?

If these pins are hardwired together when the I2C bus is being utilized, it would appear that the Electorn pinout doesn’t “support” using both CANbus and I2C.

For example, if I want to start a CAN transaction on CAN2 bus (i.e. on D1 and D2), then will my outgoing message on CAN2_TX (D1) be seen on the SCL line (C5), and thus be interpreted as a clock signal by I2C peripherals?

If my I2C peripherals interpret an outgoing CAN message as a clock signal, does that matter (as long as the SDA pin is not active). If my CAN peripherals interpret the SCL clock signal as a CAN TX signal, does that matter?

Is there a scenario where the RTOS would be in the middle of a transaction on one bus and then start a transaction on the other bus (i.e. in the middle of a CAN transaction, it starts an I2C transaction)?

Here is my pinout plan. Will this work?

1 Like

Have you experienced these troubles or are you just making sure before going down that route?
AFAIK, using the dedicated objects for either D0/D1 or C4/C5 means using either the “default” location or the alternate pin locations without any cross talk.

Hence the comment in the docs

https://docs.particle.io/reference/firmware/electron/#wire-i2c-

If they were the same that note would be irrelevant and the extra object Wire1 would be superfluous too.

Just making sure before going down that route! I guess in retrospect it would be kinda weird if using I2C tied up 4 electron pins… kinda defeats the purpose!

Perhaps the pinout diagram datasheet should list SCL1 and SDA1 instead of just having two SCL and two SDA, to distinguish that they aren’t tied together when using I2C.