← index #15421Issue #13280
Related · high · value 0.435
QUERY · ISSUE

Enable Hardware I2C2 to Portenta C33 Port

openby weshultzopened 2024-07-07updated 2024-07-07
enhancement

Description

Currently, the Arduino Portenta C33 port only supports hardware I2C0 of the RA6M5. Access to I2C0 is via a connector on the board. If the board is used with the Arduino Protenta Hat Carrier I2C0 is brought out on the RPi 40 pin header to what is usually used by RPi hats for their onboard ID EEPROMs. The other I2C pins typically used for general user access are GPIO2 and GPIO3, 40-pin header pins 3 and 5 respectively. Arduino brings out hardware I2C2 of the C33 on the Ardunio Hat Carrier header pins 3 and 5, mirroring the standard RPi configuration.

Since the I2C configuration for the Portenta C33 port only defines I2C0, and since all the configuration files are generated files from the RA tools, adding support for I2C2 via a hack would be challenging at best.

Code Size

Adding the support fro I2C2 I would suppose, would increase code size only slightly. Barely noticeable on the RA6M5 with its relatively generous resources.

Implementation

I hope the MicroPython maintainers or community will implement this feature

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

I2C readfrom_mem throws EPERM on Portenta C33

closedby sebromeroopened 2023-12-27updated 2024-01-31
bugport-renesas-ra

I'm on MicroPython v1.22.0 on 2023-12-27; Arduino Portenta C33 with RA6M5 and I just ran
a simple I2C read ~that worked fine under 1.21 (after merging https://github.com/micropython/micropython/pull/12978)~. It now throws an exception EPERM. It does however still work with SoftI2C.
~I wonder what changed in the mean time in the Renesas port~ 🤔
To reproduce it, run the following with the values adjusted for you I2C peripheral:

from machine import I2C, Pin, SoftI2C

buses = [I2C(0), SoftI2C(scl=Pin('P408') , sda=Pin('P407'))]

for bus in buses:
    print("Trying bus", bus)
    try:
        data = bus.readfrom_mem(0x21, 0x1c, 0x1) 
        print(data)
        print("Success on bus", bus)
    except Exception as e:
        print(f"Read failed on bus {bus}: {e}")

With my setup it prints the following:

Trying bus I2C(0, freq=400000, scl=P408, sda=P407)
Read failed on bus I2C(0, freq=400000, scl=P408, sda=P407): [Errno 1] EPERM
Trying bus SoftI2C(scl=P408, sda=P407, freq=500000)
b'\xb8'
Success on bus SoftI2C(scl=P408, sda=P407, freq=500000)

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied