I2C wire Library not working on Portenta C33 act as Slave

Hello All,

I am using Portenta C33 it act as I2C slave using Arduino wire library. But when we connect I2C Master and sending data to Portenta but it seems SCL pin always high not getting clock on logic analyzer. But when I disconnected or remove SCL pin from Portenta then I2C clock available.

Can any one please confirm is Arduino wire library will work if configured as slave? Any use it with Portenta C33?

Thanks in advance...

In case the SCL pin is located somewhere else: start the I2C scanner and try to find SCL pulses on a different pin.

Try this piece of code, it may tell you. Run it at the end of setup().`Use code tags to format code for the forum.


/************************[ Show the predefined pins ]**************************
*                                                                             *
*  Many pins are defined by the pre_Compiler, this displays some pertent      *
*  to this program. They are determined at compile time.                      *
*                                                              198 bytes      *
*******************************************************************************/
void show_pre_def_pins()
{
  Serial.print(F("\n\tSS: "));                // This shows they the value of the predefined pins
  Serial.print(SS); Serial.print(F(", "));    // Not needed for program
  Serial.print(F(" MOSI: "));                 // Print the pin being displayed
  Serial.print(MOSI); Serial.print(F(", "));  // But handy for debuging
  Serial.print(F("MISO: "));                  // Print the pin being displayed
  Serial.print(MISO);                         // Info from compiler
  Serial.print(F(", SCK: "));                 // Print the pin being displayed
  Serial.print(SCK);                          // Info from compiler
  Serial.print(F("\n\tSCL: "));               // Print the pin being displayed
  Serial.print(SCL);                          // Info from compiler
  Serial.print(F(", SDA: "));                 // Print the pin being displayed
  Serial.print(SDA);                          // End of predefined pin list.
  Serial.print(F(",  Led Pin: "));            // Print the pin being displayed
  Serial.print(LED_BUILTIN);                  // Info from compiler
}    // End of show_pre_def_pins
I use this as part of my setup when doing a new systgem.

I use this on a Nano and UNO.

Thanks for prompt response..
I checked this piece of code but it work for board selected Portenta C33, but anyway I found default pins for Arduino library

/****** WIRE CORE DEFINES ******/

#define WIRE_HOWMANY      4
#define WIRE_SDA_PIN      11
#define WIRE_SCL_PIN      12
#define WIRE1_SDA_PIN     37
#define WIRE1_SCL_PIN     38
#define WIRE2_SDA_PIN     39
#define WIRE2_SCL_PIN     40
#define WIRE3_SDA_PIN     96
#define WIRE3_SCL_PIN     97

On Portenta C33 connector only I2C0 port available I can't not try with another I2C port.

Any other suggestion/recommendation? I am stuck here.
Thanks.

Hi All, Any suggestion? Any one used I2C slave wire library for Portenta C33? Any medication needs to be do?

Please let me know any help most appreciate......
Thanks

Check the firmware documentation for alternative I2C objects (Wire2, Wire3?) on different pins.

I know by using I2C object I can try with Wire2 or Wire3 but I want to get working with I2C0 port only because our another hardware PCB is connected to this pins only.

Can anyone confirm is I2C0 port with Wire0 library use on Portenta C33?

Hi, I checked SCL pin D12 define as output in Arduino and making HIGH and LOW every 1second. but this pin not gong low it always HIGH. Is this any hardware issue on Portenta C33? You can see waveform Portenta C33 I2C Slave simple Code Not working - #5 by vsborle92

Here is below simple code to toggle I2C Pins:

#include "Wire.h"

#define I2C_DEV_ADDR 0x01
#define SDA_PIN 11
#define SCL_PIN 12

void onRequest(){
  Wire.print(i++);
  Wire.print(" Packets.");
  Serial.println("onRequest");
}

void onReceive(int len) {
  uint8_t cmdReq[6];
  uint8_t counter = 0;
  // Serial.printf("onReceive[%d]: ", len);
  while (Wire.available()) {
    // Serial.write(Wire.read());
    cmdReq[counter] = Wire.read();
    Serial.print(cmdReq[counter], HEX);
    Serial.print(",");
    counter++;
  }
}

void setup() {
  Serial.begin(115200);
  // Serial.setDebugOutput(true);
  Wire.begin((uint8_t)I2C_DEV_ADDR);
  Wire.onReceive(onReceive);
  Wire.onRequest(onRequest);
  pinMode(SDA_PIN, OUTPUT);
  pinMode(SCL_PIN, OUTPUT);

#if CONFIG_IDF_TARGET_ESP32
  char message[64];
  snprintf(message, 64, "%u Packets.", i++);
  Wire.slaveWrite((uint8_t *)message, strlen(message));
#endif
}

void loop() {
  digitalWrite(SDA_PIN, HIGH); // set to HIGH Q0.0 and Q0.1
  digitalWrite(SCL_PIN, HIGH);
  delay(1000);             // delay 1s
  digitalWrite(SDA_PIN, LOW); // set to LOW Q0.0 and Q0.1
  digitalWrite(SCL_PIN, LOW);
  delay(1000);
}

The most simple code is an I2C sniffer. It will toggle all related pins so that you only have to find those toggling pins.

Hi, I checked SCL pin with another Portenta this working now. But still weird behavior as below sequence when I test:

  1. This new Portenta C33 acts as slave and it working with ESP32 board Master even vice versa also work.
  2. Portenta C33 acts as slave and it working with our another Master module.
  3. We have working Master board with different slaves tested and want to communicate with portenta C33 also, But when we connect with Portenta C33 as slave configured using I2C port 0 it not work. I also checked signal on Logic Analyzer but no single. I confused why this happening, Can please anyone suggest what should I do to debug this issue?

Thanks,,,

If no pins become active with that port then something is wrong with your hardware or library.

We used another Portenta C33 board and this board pins become active.
As I see schematic of Portenta C33 there is no external pull resistor available on board.

I used 2.2K external pullup but it not work, so What will be the resistor value recommendation for SDA and SCL line pullup?

Thanks