RED HAT
RED HAT
DIIDevHeads IoT Integration Server
Created by Enthernet Code on 7/30/2024 in #firmware-and-baremetal
How to Fix "OSError: [Errno 5] EIO" in STM32 Water Quality Monitoring System?
@Enthernet Code the OSError: [Errno 5] EIO is typically an input/output error, which can be caused by several factors. Let's go through some likely solutions: Firstly, make sure that the I2C bus initialization is correct. The i2c_bus parameter in the LCD initialization should match the I2C bus number used in your setup. For example, if you're using I2C1, it should be i2c_bus=1, Also, verify that the I2C address (0x27) is correct for your LCD screen. You can use an I2C scanner script to detect the connected I2C devices and confirm their addresses. Here’s an example of an I2C scanner script:
import machine

i2c = machine.I2C(1, scl=machine.Pin(22), sda=machine.Pin(21))
devices = i2c.scan()

if len(devices) == 0:
print("No I2C devices found")
else:
print("I2C devices found:", [hex(device) for device in devices])
import machine

i2c = machine.I2C(1, scl=machine.Pin(22), sda=machine.Pin(21))
devices = i2c.scan()

if len(devices) == 0:
print("No I2C devices found")
else:
print("I2C devices found:", [hex(device) for device in devices])
6 replies