Site icon Renzo Mischianti

esp32-cam & pcf8574 library problem

Problem I2C @ ESP32-CAM (AI thinker board) ========================================== /************************************************/ /***** I2C library tbv PCF8574 (XREEF) *****/ /***** I2C used chip = PCA8574A - addr 0x38 *****/ /***** when.. A0=x, A1=x, A2=x (x= GND) *****/ /************************************************/ /***** The ESP32-CAM I2C bus uses pins: *****/ /***** GPIO15 = SCL (ESP32_Cam) *****/ /***** GPIO14 = SDA (ESP32_Cam) *****/ /************************************************/ #include #define SCL 15 // IO15 GPIO15 HSPI_WSO HS2_CMD SD-Conn #define SDA 14 // IO14 GPIO14 HSPI_CLK HS2_CLK SD-Conn #include "PCF8574.h" // PCF8574 library @ 2.3.7 #define PCF_INTERRUPT 0 // IO0 GPIO0 CAM_PIN_XCLK or CSI_MCLK (Interrupt pin for Encoder & Switch) // Pre formatted Header for the Interrupt (See Initialisation of updateEncoder Interrupt Below), // necessary here because of the Interrupt Initialisation in the next Line void IRAM_ATTR updateEncoder(); // ! *** IRAM_ATTR because this is the ISR !!! // Initialize PCF-library Interrupt PCF8574 pcf8574(0x38, PCF_INTERRUPT, updateEncoder); // for Used I2C Pins Result : Init pcf8574...begin(sda, scl) -> 21 22 Using interrupt pin (not all pin is interrupted) STATUS --> 4 NOT OK <== NOT OK, wrong SDA and SCL port ================================================== Now used after change : #include #define SCL 15 // IO15 GPIO15 HSPI_WSO HS2_CMD SD-Conn #define SDA 14 // IO14 GPIO14 HSPI_CLK HS2_CLK SD-Conn #include "PCF8574.h" // PCF8574 library @ 2.3.7 #define PCF_INTERRUPT 0 // IO0 GPIO0 CAM_PIN_XCLK or CSI_MCLK (Interrupt pin for Encoder & Switch) // Pre formatted Header for the Interrupt (See Initialisation of updateEncoder Interrupt Below), // necessary here because of the Interrupt Initialisation in the next Line void IRAM_ATTR updateEncoder(); // ! *** IRAM_ATTR because this is the ISR !!! // Initialize PCF-library SDA & SCL PCF8574 pcf8574(0x38, SDA, SCL); // Question : HOW to setup also the "PCF_INTERRUPT" Result: Init pcf8574...begin(sda, scl) -> 14 15 <== this is OK now...But also need the Interrupt (How to do this) STATUS --> 4 NOT OK <== Why still showing NOT OK ==================================================
Exit mobile version