Simple I2C example
-
I would like Spresense (I2C Master) to communicate with an Arduino Uno ( (I2C Slave) over I2C pins (specifically I2C0_SCL/I2C0_SDA). I am using nuttx on the Spresense. The closest example I could find is hostif but it assumes two Spresense boards. I would like to see a minimal example to send a text command to Arduino Uno over I2C.
PS: I have tried the Arduino I2C Master/Slave example on both of the boards and it works as expected so I believe there should be something similar in nuttx Spresense SDK.
Thanks,
Naveen -
Hi @yokonav,
Here you can find how to send and receive data as I2C master: https://github.com/sonydevworld/spresense/blob/master/examples/hostif/host_i2c_main.c
Alternatively, you can see the Wire library implementation in the Spresense Arduino because it also uses the NuttX: https://github.com/sonydevworld/spresense-arduino-compatible/blob/master/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Wire/Wire.cpp
Best Regards,
Kamil Tomaszewski