Possible to add interrupt to scl pin i2c?
Posted: Wed Jan 08, 2025 11:36 am
hallo
is it possible to add an interrupt function to the scl pin. i have tried different things that won´t work.
the first thing i have tried
- setup gpio and interrupt after read out basic things from i2c slave
- after i get an interrupt i disable the gpio and interrupt and reactivate the i2c master.
- try to read out date from slave.
- reactivate gpio and interrupt.
it seems not working, because the slave get back to factory settings after reactivation.
the second thing i have tried is to activate the interrupt on scl pin without gpio.
- setup interrupt on scl pin
- after i get an interrupt i disable interrupt.
- try to read out date from slave.
- reactivate interrupt.
no interrupt was handled.
at the moment i used idf 5.1/5.2 and the legacy driver on esp32-s3.
i had also a look into the gpio matrix function but i don´t get this work. maybe someone could help me with this.
thanks
rene
is it possible to add an interrupt function to the scl pin. i have tried different things that won´t work.
the first thing i have tried
- setup gpio and interrupt after read out basic things from i2c slave
- after i get an interrupt i disable the gpio and interrupt and reactivate the i2c master.
- try to read out date from slave.
- reactivate gpio and interrupt.
it seems not working, because the slave get back to factory settings after reactivation.
the second thing i have tried is to activate the interrupt on scl pin without gpio.
- setup interrupt on scl pin
- after i get an interrupt i disable interrupt.
- try to read out date from slave.
- reactivate interrupt.
Code: Select all
gpio_set_intr_type((gpio_num_t)SDA_PIN, GPIO_INTR_ANYEDGE);
gpio_intr_enable((gpio_num_t)SDA_PIN);
....
at the moment i used idf 5.1/5.2 and the legacy driver on esp32-s3.
Code: Select all
i2c_conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = SDA_PIN,
.scl_io_num = SLC_PIN,
.sda_pullup_en = GPIO_PULLUP_ENABLE,
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.master = {
.clk_speed = I2C_MASTER_FREQ_HZ,
},
//.clk_flags = 0,
};
i2c_param_config(I2C_NUM_0, &i2c_conf);
err = i2c_driver_install(I2C_NUM_0, i2c_conf.mode, 0, 0, 0);
thanks
rene