arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.97k stars 4.77k forks source link

I2C not working in customised tasmota32 build #13454

Closed dannutu closed 2 years ago

dannutu commented 2 years ago

PROBLEM DESCRIPTION

A clear and concise description of what the problem is. I have an I2C issue that's driving me nuts though, I've searched the web and read docs and issues for hours and I still can't figure what's wrong. In a nutshell: I customised and compiled tasmota32 (the new version 10) for esp32 and everything else works but not the I2C part!

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

00:09:39.875 CMD: template 00:09:39.897 MQT: stat/tasmota_624690/RESULT = {"NAME":"ESP32-DevKit-test-ic2","GPIO":[0,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,640,608,1,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1} 00:09:44.032 CMD: gpio 00:09:44.066 MQT: stat/tasmota_624690/RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"0":"None"},"GPIO5":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO12":{"0":"None"},"GPIO13":{"0":"None"},"GPIO14":{"0":"None"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"},"GPIO17":{"0":"None"},"GPIO18":{"0":"None"},"GPIO19":{"0":"None"},"GPIO21":{"0":"None"},"GPIO22":{"0":"None"},"GPIO23":{"0":"None"},"GPIO25":{"0":"None"},"GPIO26":{"0":"None"},"GPIO27":{"0":"None"},"GPIO32":{"0":"None"},"GPIO33":{"0":"None"},"GPIO34":{"0":"None"},"GPIO35":{"0":"None"},"GPIO36":{"0":"None"},"GPIO39":{"0":"None"}} 00:09:48.285 CMD: i2cdriver 00:09:48.304 MQT: stat/tasmota_624690/RESULT = {"I2CDriver":"3,4,5,7,10,26,47"} 00:09:54.839 CMD: i2cscan 00:09:54.855 MQT: stat/tasmota_624690/RESULT = {"Command":"Error"} 00:09:57.072 CMD: fgdggfdfgTESTsdfsdf 00:09:57.088 MQT: stat/tasmota_624690/RESULT = {"Command":"Unknown"} 00:11:44.625 CMD: gpio0 00:11:44.660 MQT: stat/tasmota_624690/RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"0":"None"},"GPIO5":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO12":{"0":"None"},"GPIO13":{"0":"None"},"GPIO14":{"0":"None"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"},"GPIO17":{"0":"None"},"GPIO18":{"0":"None"},"GPIO19":{"0":"None"},"GPIO21":{"0":"None"},"GPIO22":{"0":"None"},"GPIO23":{"0":"None"},"GPIO25":{"0":"None"},"GPIO26":{"0":"None"},"GPIO27":{"0":"None"},"GPIO32":{"0":"None"},"GPIO33":{"0":"None"},"GPIO34":{"0":"None"},"GPIO35":{"0":"None"},"GPIO36":{"0":"None"},"GPIO39":{"0":"None"}} 00:12:07.775 CMD: gpios 00:12:07.889 MQT: stat/tasmota_624690/RESULT = {"GPIOs1":{"0":"None","6208":"Option A","32":"Button","64":"Button_n","7680":"Button_d","96":"Button_i","128":"Button_in","7712":"Button_id","5408":"Button_tc","160":"Switch","192":"Switch_n","7744":"Switch_d","3264":"Rotary A","3296":"Rotary B","6752":"Rotary A_n","6784":"Rotary B_n","224":"Relay","256":"Relay_i","288":"Led","320":"Led_i","352":"Counter","384":"Counter_n","416":"PWM","448":"PWM_i","480":"Buzzer","512":"Buzzer_i","544":"LedLink","576":"LedLink_i","7648":"Input","7968":"Interrupt","3840":"Output Hi","3872":"Output Lo","608":"I2C SCL","640":"I2C SDA","832":"SSPI MISO","864":"SSPI MOSI","896":"SSPI SCLK","928":"SSPI CS","960":"SSPI DC","7104":"TM1637 CLK","7136":"TM1637 DIO","2048":"TM1638 CLK","2080":"TM1638 DIO","2112":"TM1638 STB","992":"Backlight","1024":"Display Rst","7616":"EPD Data","3200":"Serial Tx","3232":"Serial Rx","1184":"DHT11","1216":"AM2301","1248":"SI7021","1280":"DHT11_o","1312":"DS18x20","1344":"DS18x20_o","1376":"WS2812","3136":"ALux IrRcv","3168":"ALux IrSel","2912":"SM16716 CLK","2944":"SM16716 DAT","2976":"SM16716 PWR","4032":"SM2135 Clk","4064":"SM2135 Dat","4640":"MOODL Tx","1056":"IRsend","1088":"IRrecv","2592":"HLWBL SEL","2624":"HLWBL SEL_i","2656":"HLWBL CF1","2688":"HLW8012 CF","2720":"BL0937 CF","3456":"ADE7953 IRQ","7296":"CSE7761 Tx","7328":"CSE7761 Rx","3072":"CSE7766 Tx","3104":"CSE7766 Rx","2752":"MCP39F5 Tx","2784":"MCP39F5 Rx","2816":"MCP39F5 Rst","1472":"PZEM0XX Tx","1504":"PZEM004 Rx","1536":"PZEM016 Rx","1568":"PZEM017 Rx","8128":"BL0939 Rx","5440":"BL0940 Rx","8160":"BL0942 Rx","7552":"ZC Pulse","1792":"SerBr Tx","1824":"SerBr Rx","4096":"DeepSleep","7584":"HallEffect","4704":"ADC Input","4736":"ADC Temp","4768":"ADC Light","4800":"ADC Button","4832":"ADC Button_i","4864":"ADC Range","4896":"ADC CT Power","3328":"ADC Joystick","6816":"ADC pH"}} 00:27:06.986 CMD: weblog 00:27:06.998 MQT: stat/tasmota_624690/RESULT = {"WebLog":2} 00:27:11.526 CMD: weblog 3 00:27:11.542 MQT: stat/tasmota_624690/RESULT = {"WebLog":3} 00:27:11.791 CFG: Saved, Count 19, Bytes 4096 00:27:19.488 CMD: i2cscan 00:27:19.491 SRC: WebConsole from 192.168.15.17 00:27:19.493 CMD: Grp 0, Cmnd 'I2CSCAN', Idx 1, Len 0, Data '' 00:27:19.505 MQT: stat/tasmota_624690/RESULT = {"Command":"Error"} 00:27:41.001 CMD: weblog 4 00:27:41.003 SRC: WebConsole from 192.168.15.17 00:27:41.006 CMD: Grp 0, Cmnd 'WEBLOG', Idx 1, Len 1, Data '4' 00:27:41.016 MQT: stat/tasmota_624690/RESULT = {"WebLog":4} 00:27:41.755 CFG: Saved, Count 20, Bytes 4096 00:27:47.726 CMD: i2cscan 00:27:47.730 SRC: WebConsole from 192.168.15.17 00:27:47.732 CMD: Grp 0, Cmnd 'I2CSCAN', Idx 1, Len 0, Data '' 00:27:47.747 MQT: stat/tasmota_624690/RESULT = {"Command":"Error"} 00:27:54.832 WIF: Checking connection... 00:28:14.818 WIF: Checking connection...


### TO REPRODUCE
_Steps to reproduce the behavior:_
I have a DS3231 RTC module and a 1602 LCD display with an I2C module connected to GPIO 21 and 22. If I run a simple Arduino I2C "scanner" (i.e. the one from https://randomnerdtutorials.com/esp32-i2c-communication-arduino-ide/#2) I get:

18:04:39.913 -> I2C device found at address 0x27 --> this is the 1602 LCD display 18:04:39.913 -> I2C device found at address 0x57 --> this is the RTC EEPROM 32kb 18:04:40.066 -> I2C device found at address 0x68 --> this is the RTC DS3231


For tasmota I did define USE_I2C and the other constants for the display and the RTC like this in tasmota/user_config_override.h :

ifndef USE_I2C

define USE_I2C // I2C using library wire (+10k code, 0k2 mem, 124 iram)

endif

ifndef USE_DISPLAY

define USE_DISPLAY // Add I2C Display Support (+2k code)

endif

ifndef USE_DISPLAY_MODES1TO5

define USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0

endif

ifndef USE_DISPLAY_LCD

define USE_DISPLAY_LCD // [DisplayModel 1] [I2cDriver3] Enable Lcd display (I2C addresses 0x27 and 0x3F) (+6k code)

endif

ifndef USE_DISPLAY_TM1637

define USE_DISPLAY_TM1637 // [DisplayModel 15] Enable TM1637 module

endif

ifndef USE_UNIVERSAL_DISPLAY

define USE_UNIVERSAL_DISPLAY // New universal display driver for both I2C and SPI

endif

ifndef USE_DISPLAY_SEVENSEG

define USE_DISPLAY_SEVENSEG // [DisplayModel 11] [I2cDriver47] Enable sevenseg display (I2C 0x70-0x77) (<+11k code)

endif

// #define USE_DISPLAY_SEVENSEG_COMMON_ANODE // Enable support for common anode sevenseg displays // Multiple sevenseg displays are logically arranged vertically with MTX_ADDRESS1 at y=0, // MTX_ADDRESS2 at y=1, up to MTX_ADDRESS8 at y=7 // Command: DisplayText [yn]8888 // will display 8888 at sevenseg display at I2C address MTX_ADDRESS(n-1) // Each segment may be address Command: DisplayText [xn]m // where n is 0..4 (4 digits and middle :) and m is decimal for bitmap of which segment to turn on. // Reference: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-led-backpack.pdf // #define SEVENSEG_ADDRESS1 0x70 // No longer used. Use MTX_ADDRESS1 - MTX_ADDRESS8 instead to specify I2C address of sevenseg displays

ifndef USE_DS3231

define USE_DS3231 // [I2cDriver26] Enable DS3231 external RTC in case no Wi-Fi is avaliable. See docs in the source file (+1k2 code)

define USE_RTC_ADDR 0x68 // Default I2C address 0x68

endif

// Avoid conflicts with DS3231 RTC address 0x68:

ifdef USE_MPU6050

undef USE_MPU6050 // [I2cDriver25] Enable MPU6050 sensor (I2C address 0x68 AD0 low or 0x69 AD0 high) (+3K3 of code and 188 Bytes of RAM)

endif

ifdef USE_MPU_ACCEL

undef USE_MPU_ACCEL // [I2cDriver58] Enable MPU6886/MPU9250 - found in M5Stack - support both I2C buses on ESP32 (I2C address 0x68) (+2k code)

endif


I also updated the template to set SDA1 to GPIO21 and SCL1 to GPIO22

When tasmota starts there is absolutely no sign of I2C in the logs. From the web console I get:

00:09:39.875 CMD: template 00:09:39.897 MQT: stat/tasmota_624690/RESULT = {"NAME":"ESP32-DevKit-test-ic2","GPIO":[0,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,640,608,1,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1} 00:09:44.032 CMD: gpio 00:09:44.066 MQT: stat/tasmota_624690/RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"0":"None"},"GPIO5":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO12":{"0":"None"},"GPIO13":{"0":"None"},"GPIO14":{"0":"None"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"},"GPIO17":{"0":"None"},"GPIO18":{"0":"None"},"GPIO19":{"0":"None"},"GPIO21":{"0":"None"},"GPIO22":{"0":"None"},"GPIO23":{"0":"None"},"GPIO25":{"0":"None"},"GPIO26":{"0":"None"},"GPIO27":{"0":"None"},"GPIO32":{"0":"None"},"GPIO33":{"0":"None"},"GPIO34":{"0":"None"},"GPIO35":{"0":"None"},"GPIO36":{"0":"None"},"GPIO39":{"0":"None"}} 00:09:48.285 CMD: i2cdriver 00:09:48.304 MQT: stat/tasmota_624690/RESULT = {"I2CDriver":"3,4,5,7,10,26,47"} 00:09:54.839 CMD: i2cscan 00:09:54.855 MQT: stat/tasmota_624690/RESULT = {"Command":"Error"} 00:09:57.072 CMD: fgdggfdfgTESTsdfsdf 00:09:57.088 MQT: stat/tasmota_624690/RESULT = {"Command":"Unknown"} 00:11:44.625 CMD: gpio0 00:11:44.660 MQT: stat/tasmota_624690/RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"0":"None"},"GPIO5":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO12":{"0":"None"},"GPIO13":{"0":"None"},"GPIO14":{"0":"None"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"},"GPIO17":{"0":"None"},"GPIO18":{"0":"None"},"GPIO19":{"0":"None"},"GPIO21":{"0":"None"},"GPIO22":{"0":"None"},"GPIO23":{"0":"None"},"GPIO25":{"0":"None"},"GPIO26":{"0":"None"},"GPIO27":{"0":"None"},"GPIO32":{"0":"None"},"GPIO33":{"0":"None"},"GPIO34":{"0":"None"},"GPIO35":{"0":"None"},"GPIO36":{"0":"None"},"GPIO39":{"0":"None"}} 00:12:07.775 CMD: gpios 00:12:07.889 MQT: stat/tasmota_624690/RESULT = {"GPIOs1":{"0":"None","6208":"Option A","32":"Button","64":"Button_n","7680":"Button_d","96":"Button_i","128":"Button_in","7712":"Button_id","5408":"Button_tc","160":"Switch","192":"Switch_n","7744":"Switch_d","3264":"Rotary A","3296":"Rotary B","6752":"Rotary A_n","6784":"Rotary B_n","224":"Relay","256":"Relay_i","288":"Led","320":"Led_i","352":"Counter","384":"Counter_n","416":"PWM","448":"PWM_i","480":"Buzzer","512":"Buzzer_i","544":"LedLink","576":"LedLink_i","7648":"Input","7968":"Interrupt","3840":"Output Hi","3872":"Output Lo","608":"I2C SCL","640":"I2C SDA","832":"SSPI MISO","864":"SSPI MOSI","896":"SSPI SCLK","928":"SSPI CS","960":"SSPI DC","7104":"TM1637 CLK","7136":"TM1637 DIO","2048":"TM1638 CLK","2080":"TM1638 DIO","2112":"TM1638 STB","992":"Backlight","1024":"Display Rst","7616":"EPD Data","3200":"Serial Tx","3232":"Serial Rx","1184":"DHT11","1216":"AM2301","1248":"SI7021","1280":"DHT11_o","1312":"DS18x20","1344":"DS18x20_o","1376":"WS2812","3136":"ALux IrRcv","3168":"ALux IrSel","2912":"SM16716 CLK","2944":"SM16716 DAT","2976":"SM16716 PWR","4032":"SM2135 Clk","4064":"SM2135 Dat","4640":"MOODL Tx","1056":"IRsend","1088":"IRrecv","2592":"HLWBL SEL","2624":"HLWBL SEL_i","2656":"HLWBL CF1","2688":"HLW8012 CF","2720":"BL0937 CF","3456":"ADE7953 IRQ","7296":"CSE7761 Tx","7328":"CSE7761 Rx","3072":"CSE7766 Tx","3104":"CSE7766 Rx","2752":"MCP39F5 Tx","2784":"MCP39F5 Rx","2816":"MCP39F5 Rst","1472":"PZEM0XX Tx","1504":"PZEM004 Rx","1536":"PZEM016 Rx","1568":"PZEM017 Rx","8128":"BL0939 Rx","5440":"BL0940 Rx","8160":"BL0942 Rx","7552":"ZC Pulse","1792":"SerBr Tx","1824":"SerBr Rx","4096":"DeepSleep","7584":"HallEffect","4704":"ADC Input","4736":"ADC Temp","4768":"ADC Light","4800":"ADC Button","4832":"ADC Button_i","4864":"ADC Range","4896":"ADC CT Power","3328":"ADC Joystick","6816":"ADC pH"}} 00:27:06.986 CMD: weblog 00:27:06.998 MQT: stat/tasmota_624690/RESULT = {"WebLog":2} 00:27:11.526 CMD: weblog 3 00:27:11.542 MQT: stat/tasmota_624690/RESULT = {"WebLog":3} 00:27:11.791 CFG: Saved, Count 19, Bytes 4096 00:27:19.488 CMD: i2cscan 00:27:19.491 SRC: WebConsole from 192.168.15.17 00:27:19.493 CMD: Grp 0, Cmnd 'I2CSCAN', Idx 1, Len 0, Data '' 00:27:19.505 MQT: stat/tasmota_624690/RESULT = {"Command":"Error"} 00:27:41.001 CMD: weblog 4 00:27:41.003 SRC: WebConsole from 192.168.15.17 00:27:41.006 CMD: Grp 0, Cmnd 'WEBLOG', Idx 1, Len 1, Data '4' 00:27:41.016 MQT: stat/tasmota_624690/RESULT = {"WebLog":4} 00:27:41.755 CFG: Saved, Count 20, Bytes 4096 00:27:47.726 CMD: i2cscan 00:27:47.730 SRC: WebConsole from 192.168.15.17 00:27:47.732 CMD: Grp 0, Cmnd 'I2CSCAN', Idx 1, Len 0, Data '' 00:27:47.747 MQT: stat/tasmota_624690/RESULT = {"Command":"Error"} 00:27:54.832 WIF: Checking connection... 00:28:14.818 WIF: Checking connection...



### EXPECTED BEHAVIOUR
_A clear and concise description of what you expected to happen._
I expected the I2Cscan command to find the 3 I2C devices connected on the bus

### SCREENSHOTS
_If applicable, add screenshots to help explain your problem._

### ADDITIONAL CONTEXT
_Add any other context about the problem here._

Tasmota beginner here. I like it very much so far, kudos for all the effort that went into it!

[I initially posted this a few minutes ago under "HOWTO using the I2C bus: #13453" but it was automatically closed because it didn't contain the report template. Now that I am trying to follow this path the report template is suggesting "Please DO NOT OPEN AN ISSUE: ... - If your issue is compilation problem, please address it to the [Tasmota Support Chat](https://discord.gg/Ks2Kzd4)". Frankly it doesn't seem like a compilation issue to me, however if it is indeed due to a compilation issue please let me know and I'll go use discord).

Could anybody please point me in the right direction? Many thanks in advance

**(Please, remember to close the issue when the problem has been addressed)**
sfromis commented 2 years ago

You claim to have configured SCL/SDA pins, but your gpio and module command outputs shows that this is not in effect. You did not activate the template.

For such basic questions, opening an issue is not a good plan.