ESP32 Pico V3 I/O expander

Jinu Vijayan
Posts: 3
Joined: Mon Jun 20, 2022 5:08 am

ESP32 Pico V3 I/O expander

Postby Jinu Vijayan » Mon Jun 20, 2022 5:20 am

Hello, I am a student and I am trying to use tca6424a with a ESP32 PICO V3. When I upload the code for the interface and the code gets executed up to the test connection command after that it is not working the code I am using is attached below. I wrote the code in vscode using platformio.
  1. #include "TCA6424A.h"
  2. #include <Arduino.h>
  3.  
  4. #define SDA 5
  5. #define SCL 0
  6. #define RESET_PIN 2
  7.  
  8. TwoWire twi(1);
  9. // TCA6424A expander1(&twi);
  10. TCA6424A expander2(&twi);
  11.  
  12. void setup()
  13. {
  14.   Serial.begin(115200);
  15.   twi.setPins(SDA, SCL);
  16.   // expander1.begin(TCA6424A_ADDRESS_ADDR_LOW);
  17.   expander2.begin(TCA6424A_ADDRESS_ADDR_HIGH);
  18. }
  19.  
  20. void loop()
  21. {
  22.   // Serial.print("expander1: ");
  23.   // Serial.println(expander1.testConnection() ? "true" : "false");
  24.   Serial.print("expander2: ");
  25.   Serial.println(expander2.testConnection() ? "true" : "false");
  26.   delay(1000);
  27. }
The message it is showing in the serial monitor is as folows
" expander2: [ 15][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock "

rpiloverbd
Posts: 101
Joined: Tue Mar 22, 2022 5:23 am

Re: ESP32 Pico V3 I/O expander

Postby rpiloverbd » Tue Jun 21, 2022 7:47 am

Here are some info about this error message: https://github.com/espressif/arduino-esp32/issues/834

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32 Pico V3 I/O expander

Postby lbernstone » Tue Jun 21, 2022 8:20 am

If the WireScan example https://github.com/espressif/arduino-es ... s/WireScan doesn't show you an address, then you have an electrical problem. I don't have time to explain how I2C works, but I'll bet google does. You probably need some pullup resistors.

Jinu Vijayan
Posts: 3
Joined: Mon Jun 20, 2022 5:08 am

Re: ESP32 Pico V3 I/O expander

Postby Jinu Vijayan » Tue Jun 21, 2022 9:12 am

lbernstone wrote:
Tue Jun 21, 2022 8:20 am
If the WireScan example https://github.com/espressif/arduino-es ... s/WireScan doesn't show you an address, then you have an electrical problem. I don't have time to explain how I2C works, but I'll bet google does. You probably need some pullup resistors.
I used an I2C scanner program and it sows the address of the I/O expanders and the pull up for the SDA and SCL pins are done inside the library for I2C.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 Pico V3 I/O expander

Postby ESP_Sprite » Tue Jun 21, 2022 9:45 am

Those internal pull-ups are 50K or so, which is way too high for I2C. Suggest you add external pull-ups; something like 2K7 should work.

Jinu Vijayan
Posts: 3
Joined: Mon Jun 20, 2022 5:08 am

Re: ESP32 Pico V3 I/O expander

Postby Jinu Vijayan » Thu Jun 23, 2022 6:12 am

ESP_Sprite wrote:
Tue Jun 21, 2022 9:45 am
Those internal pull-ups are 50K or so, which is way too high for I2C. Suggest you add external pull-ups; something like 2K7 should work.
I did that but the problem still persists.

Who is online

Users browsing this forum: Baidu [Spider] and 29 guests