Skip to content

I2C slave does not work and [ 1327][E][esp32-hal-periman.c:122] perimanSetPinBus(): Invalid pin: 66 #11546

Closed
@V1ncentla

Description

@V1ncentla

Board

ESP32 WROOM32 V4 devkit c

Device Description

I have a ESP32 S3 WROOM 2 devkit 1C acting as Master and want to have the ESP32 WROOM32 to act as Slave. I have them connected with jumpers and attached the necessarry pull up resistors.

Hardware Configuration

Got I2C on the ESP32 S3 WROOM 2 on pin 4 and 5 and on the ESP32 WROOM32 on pin 21 and 22. There ist also a pin used for initialization. Pin 18 on the WROOM32 and pin connected to pin 17 of the Master.

Version

latest stable Release (if not listed below)

IDE Name

Arduine IDE version 2.3.6

Operating System

Windows 10

Flash frequency

80 MHz

PSRAM enabled

no

Upload speed

921600

Description

Hello,
I just wanted to test talking between two ESPs via I2C for a upcoming project (Later both ESPs will be the S3 WROOM 2). But as you can see it didnt work out. I saw the unusual message mentioning pin66 and couldnt figure out why it showed up. Maybe this isnt even the source of the problem why I2C douesnt work (I heard that there are issues with ESPs behaving as Slaves) but I want to fix that before I look for other reasons. If you need any extra information please ask, its my first issue report. Thanks in advance.

Sketch

Slave (On ESP32 WROOM32):

#include <Wire.h>

#define SDA_PIN 21
#define SCL_PIN 22
#define SLAVE_ADDR 0x42
#define INIT_PIN 18  

void receiveEvent(int numBytes) {
  Serial.print("Empfangen: ");
  while (Wire.available()) {
    char c = Wire.read();
    Serial.print(c);
  }
  Serial.println();
}

void setup() {
  Serial.begin(115200);
  pinMode(INIT_PIN, OUTPUT);
  digitalWrite(INIT_PIN, LOW);  

  delay(500);  // Kurze Initialisierungspause
  Wire.begin(SLAVE_ADDR, SDA_PIN, SCL_PIN);  
  Wire.setClock(400000);         
  Wire.onReceive(receiveEvent);


  Serial.println("I2C Slave gestartet");

  delay(200);  
  digitalWrite(INIT_PIN, HIGH);  
}

void loop() {
  
}

Master (On ESP32 S3 WROOM 2):

#include <Wire.h>

#define SDA_PIN 4
#define SCL_PIN 5
#define SLAVE_ADDR 0x42
#define SLAVE_READY_PIN 17  

void setup() {
  Serial.begin(115200);
  pinMode(SLAVE_READY_PIN, INPUT);

  Serial.println("Warte auf I2C-Slave (Init-Pin HIGH)...");
  while (digitalRead(SLAVE_READY_PIN) == LOW) {
    delay(100);
  }
  Serial.println("Slave ist bereit!");

  Wire.begin(SDA_PIN, SCL_PIN, 400000);
  Wire.setClock(400000);
  Serial.println("I2C Master gestartet");
}

void loop() {
  Serial.println("Sende Anfrage an Slave...");
  Wire.beginTransmission(SLAVE_ADDR);
  Wire.write((const uint8_t *)"Ping", 4);  
  byte result = Wire.endTransmission();

  if (result == 0) {
    Serial.println(" Verbindung erfolgreich!");
  } else {
    Serial.print(" Fehlercode: ");
    Serial.println(result);
  }

  delay(2000);
}

Debug Message

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4888
load:0x40078000,len:16516
load:0x40080400,len:4
load:0x40080404,len:3476
entry 0x400805b4
E (144) quad_psram: PSRAM ID read error: 0xffffffff, PSRAM chip not found or not supported
[     0][W][esp32-hal-psram.c:69] psramInit(): [arduino-psram] PSRAM init failed!
[     1][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x400d69b8
[    22][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x400d699c
[    35][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x400d6980
[    48][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x400d6960
[    62][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x400d69b8
[    75][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x400d699c
[    89][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x400d6980
[   102][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x400d6960
[   116][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x400d69b8
[   129][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x400d699c
[   143][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x400d6980
[   156][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x400d6960
[   172][D][esp32-hal-cpu.c:263] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[   181][E][esp32-hal-psram.c:92] psramAddToHeap(): PSRAM not initialized!
[   195][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 3 successfully set to type UART_RX (2) with bus 0x3ffbdbc0
[   205][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 1 successfully set to type UART_TX (3) with bus 0x3ffbdbc0
=========== Before Setup Start ===========
Chip Info:
------------------------------------------
  Model             : ESP32
  Package           : D0WD-Q6
  Revision          : 1.00
  Cores             : 2
  CPU Frequency     : 240 MHz
  XTAL Frequency    : 40 MHz
  Features Bitfield : 0x00000032
  Embedded Flash    : No
  Embedded PSRAM    : No
  2.4GHz WiFi       : Yes
  Classic BT        : Yes
  BT Low Energy     : Yes
  IEEE 802.15.4     : No
------------------------------------------
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   372476 B ( 363.7 KB)
  Free Bytes        :   331812 B ( 324.0 KB)
  Allocated Bytes   :    33560 B (  32.8 KB)
  Minimum Free Bytes:   326028 B ( 318.4 KB)
  Largest Free Block:   110580 B ( 108.0 KB)
------------------------------------------
Flash Info:
------------------------------------------
  Chip Size         :  4194304 B (4 MB)
  Block Size        :    65536 B (  64.0 KB)
  Sector Size       :     4096 B (   4.0 KB)
  Page Size         :      256 B (   0.2 KB)
  Bus Speed         : 80 MHz
  Bus Mode          : QIO
------------------------------------------
Partitions Info:
------------------------------------------
                nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
            otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
               app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
             spiffs : addr: 0x00290000, size:  1408.0 KB, type: DATA, subtype: SPIFFS
           coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
------------------------------------------
Software Info:
------------------------------------------
  Compile Date/Time : Jul  2 2025 16:29:33
  Compile Host OS   : windows
  ESP-IDF Version   : v5.4.1-1-g2f7dcd862a-dirty
  Arduino Version   : 3.2.0
------------------------------------------
Board Info:
------------------------------------------
  Arduino Board     : ESP32_DEV
  Arduino Variant   : esp32
  Arduino FQBN      : esp32:esp32:esp32:UploadSpeed=921600,CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=verbose,PSRAM=enabled,LoopCore=1,EventsCore=1,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default
============ Before Setup End ============
[   715][V][esp32-hal-uart.c:552] uartBegin(): UART0 baud(115200) Mode(800001c) rxPin(3) txPin(1)
[   724][V][esp32-hal-uart.c:650] uartBegin(): UART0 not installed. Starting installation
[   734][V][esp32-hal-uart.c:660] uartBegin(): UART0 RX FIFO full threshold set to 120 (value requested: 120 || FIFO Max = 128)
[   748][V][esp32-hal-uart.c:681] uartBegin(): Setting UART0 to use REF_TICK clock
[   758][V][esp32-hal-uart.c:732] uartBegin(): UART0 initialization done.
[   772][V][esp32-hal-uart.c:783] uartSetRxFIFOFull(): UART0 RX FIFO Full value set to 120 from a requested value of 120
[   783][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x400f9488
[   794][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 18 successfully set to type GPIO (1) with bus 0x13
[  1303][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type I2C_MASTER_SDA (33) successfully set to 0x400d38bc
[  1315][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type I2C_MASTER_SCL (34) successfully set to 0x400d38bc


[  1327][E][esp32-hal-periman.c:122] perimanSetPinBus(): Invalid pin: 66     <-- WHAT I MEAN


[  1334][E][esp32-hal-i2c-ng.c:392] i2cSetClock(): bus is not initialized
I2C Slave gestartet
=========== After Setup Start ============
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   372476 B ( 363.7 KB)
  Free Bytes        :   329124 B ( 321.4 KB)
  Allocated Bytes   :    35928 B (  35.1 KB)
  Minimum Free Bytes:   322880 B ( 315.3 KB)
  Largest Free Block:   110580 B ( 108.0 KB)
------------------------------------------
GPIO Info:
------------------------------------------
  GPIO : BUS_TYPE[bus/unit][chan]
  --------------------------------------  
     1 : UART_TX[0]
     3 : UART_RX[0]
    18 : GPIO
============ After Setup End =============

Other Steps to Reproduce

-Enabling PSRAM
-Double checked the wires
-Tried different pins on the S3

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions