From d357bfd43c3754ac105f3622288591450dd84abe Mon Sep 17 00:00:00 2001 From: Hakan Bastedt Date: Sun, 16 Feb 2025 16:40:06 +0100 Subject: [PATCH] Bummer, switched SDA and SCL position on THTIC vs E7000 I2C connector. Beware. --- .../Firmware/src/main.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Cards/EaserCAT-7000-DIO+THCAD+I2C/Firmware/src/main.cpp b/Cards/EaserCAT-7000-DIO+THCAD+I2C/Firmware/src/main.cpp index 605253a..e92f591 100755 --- a/Cards/EaserCAT-7000-DIO+THCAD+I2C/Firmware/src/main.cpp +++ b/Cards/EaserCAT-7000-DIO+THCAD+I2C/Firmware/src/main.cpp @@ -109,6 +109,14 @@ void setup(void) digitalWrite(PB5, LOW); digitalWrite(PB6, LOW); digitalWrite(PB7, LOW); + + Wire2.begin(); + Wire2.setClock(400000); + +#ifdef ECAT + ecat_slv_init(&config); +#endif + #if 0 // Uncomment for commissioning tests digitalWrite(outputPin[0], HIGH); // All four output leds should go high digitalWrite(outputPin[1], HIGH); @@ -116,19 +124,14 @@ void setup(void) digitalWrite(outputPin[3], HIGH); while (1) // Apply voltage over the inputs 0-11 and see response in terminal { + Serial1.printf("I2C status=%d rawdata=%d ", mcp3221_0.ping(), mcp3221_0.getData()); for (int i = 0; i < 12; i++) Serial1.printf("%u", digitalRead(inputPin[i])); Serial1.println(); delay(100); + } #endif - - Wire2.begin(); - Wire2.setClock(400000); - -#ifdef ECAT - ecat_slv_init(&config); -#endif } void loop(void)