I2C don't read error 503


If you are asking a question, please follow this template:

  1. My goal is: [describe your goal] Read sensor with i2c
  2. My actions are: [describe your actions - code, commands, etc] When I read with the command:

mos call I2C.Read ‘{“addr”: 64, “len”: 2}’

I use this in mos.yml

Enable I2C

  • [‘i2c.enable’, ‘b’, true, {title: ‘Enable I2C’}]
  • [‘i2c.freq’, ‘i’, 100000, {title: ‘I2C bus speed’}]
  • [‘i2c.unit_no’, ‘i’, 0, {title: ‘Which hardware unit ot use, 0 or 1’}]
  • [‘i2c.sda_gpio’, ‘i’, 21, {title: ‘GPIO to use for SDA’}]
  • [‘i2c.scl_gpio’, ‘i’, 22, {title: ‘GPIO to use for SCL’}]

And when I use:

mos call I2C.Scan

this is the response:


  1. The result I see is: [show the result - log, etc]

Error: /Users/mos/mos/go/src/github.com/mongoose-os/mos/mos/dev/dev_conn_impl.go:171: remote error 503: I2C read failed
/Users/mos/mos/go/src/github.com/mongoose-os/mos/mos/main.go:196: call failed

  1. My expectation & question is: [describe your expectation and your question] What´s is the problem? I try very hard but I don’t know what happens.

Any answer? I use the ESP32


What kind of sensor are you trying to read?
Maybe it doesn’t support a simple read, but needs I2C.ReadRegB.


Hi, thanks for your answer. I use sht20 from Sensirion. It´s weird because I use exactly the same sensor in esp8266 and it´s work. I read that esp32 have problems to read I2C.


According to the datasheets (sht20 and htu21) share the same API.
Did you try to use the htu21df-i2c library?

I do use some I2C devices with ESP32 and didn’t have issues with them. The only problem I’ve had is with BNO055 from Bosch which uses SCL stretching and this is a known issue for ESP32.


Triple check the sensor you are using.

I thought I had an sht21 at one point because that’s what it said in the breakout board I bought from eBay (GY-21). I even got it reading values somehow in Arduino as an sht21.

When I moved to mongoose os took me ages to work out that actually the sensor on the board was an Si7021. The only way I could tell was by looking at photos of the devices