EdgePi-Cloud / edgepi-python-sdk

Python SDK to control EdgePi, an industrial PC/PLC/IoT device powered by Raspberry Pi CM4
MIT License
6 stars 3 forks source link

EEPROM failing to write on strings with length ≥ 28 #348

Open jarell-santella opened 1 year ago

jarell-santella commented 1 year ago
from edgepi.calibration.eeprom_constants import MessageFieldNumber
from edgepi.calibration.edgepi_eeprom import EdgePiEEPROM
from edgepi.calibration.protobuf_mapping import EdgePiEEPROMData

edgepi_eeprom = EdgePiEEPROM()

eeprom_data = EdgePiEEPROMData(edgepi_eeprom.eeprom_layout)

string_to_write = ""

try:
    while True:
        print(f"Writing \"{string_to_write}\"")

        eeprom_data.config_key.certificate = string_to_write
        eeprom_data.config_key.private = string_to_write

        edgepi_eeprom.set_edgepi_reserved_data(eeprom_data, MessageFieldNumber.CONFIGS_KEY)

        print("Done writing!")

        eeprom_data = EdgePiEEPROMData(edgepi_eeprom.eeprom_layout)

        print(eeprom_data.config_key.certificate)

        print("Done reading!")
        string_to_write += "0"
except Exception as exc:
    print(exc)
    print(len(string_to_write))

Fails at string of length 28, but works on string of length 27.

Output:

...
Writing "0000000000000000000000000000"
[Errno 121] I2C transfer: Remote I/O error
28
sjpark608 commented 1 year ago

I will re-test this with debug logging option on. It will show at which point it fails.