If I leave the Longan_I2C_CAN_Arduino lib unchanged I get one CAN message before the device reboots and I see the error I posted above.
It seems the standard Wire pins are configured properly.
If I add Wire.begin(2, 3) the device is not even starting Serial debug.
M5.Ex_I2C.release(); is not making any difference.
M
Latest posts made by minieigi
-
RE: M5Dial external i2C (port A) with Arduino Wire
-
M5Dial external i2C (port A) with Arduino Wire
I want to use a I2C CAN Bus Module https://docs.longan-labs.cc/1030017/ connected to the port A on the M5Dial.
The Longan_I2C_CAN_Arduino lib uses the Arduino Wire lib.
I get the following error probably because It uses the internal I2C.Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x4200f55c: e2e502ad 000000ff fd004136 ...
in the main.ino file I declare a second Wire instance and initialize it with the pins used on the M5Dial.
TwoWire i2Ctwo(2); I2C_CAN CAN(0x25, &i2Ctwo); // Set I2C address and Wire instance void setup() { int8_t SDA_2 = M5.Ex_I2C.getSDA(); // 2 (G13) int8_t SCL_2 = M5.Ex_I2C.getSCL(); // 3 (G15) i2Ctwo.begin(SDA_2, SCL_2); ...
But the M5Dial class uses already the I2C_Class instead of the TwoWire class.
// for external I2C device (Port.A) I2C_Class &Ex_I2C = m5::Ex_I2C;
I modified the I2C_CAN lib to be able to pass a TwoWire * pointer.
I2C_CAN::I2C_CAN(unsigned char __addr, TwoWire *__i2c = &Wire) { IIC_ADDR = __addr; i2C = __i2c; } void I2C_CAN::begin() { i2C->begin(); } void I2C_CAN::IIC_CAN_SetReg(unsigned char __reg, unsigned char __len, unsigned char *__dta) { i2C->beginTransmission(IIC_ADDR); i2C->write(__reg); for(int i=0; i<__len; i++) { i2C->write(__dta[i]); } i2C->endTransmission(); } ...
Has anyone tried to use a I2C extension on port A with a standard Arduino lib? Any help would be appreciated.