schveiguy / espi2cslave

Working i2c slave driver for ESP32-S2 chips
Apache License 2.0
3 stars 1 forks source link

ESP32-S3 #1

Open bernd-herzog opened 1 month ago

bernd-herzog commented 1 month ago

I invested some time to get this running on an ESP32-S3 and wanted to share the work.

esp32-s3.patch

I didn't test every aspect, but I can send data back and forth.

schveiguy commented 1 month ago

OK, thanks.

So one of the reasons I'm accessing the register for stretch_cause directly is that IDF says (incorrectly) that the S2 does not support clock stretching, and that function is a no-op.

But I think the correct change in that case is to call the function i2c_ll_slave_get_stretch_cause if it's not the S2.

Probably the hal should be fixed for S2 anyway, regardless of the status of the driver.

The other additions: i2c_ll_slave_tx_auto_start_en and i2c_ll_update I'm unfamiliar with. Looks like they are no-ops in the S2 hal as well.

I must admit, I mostly just copy-pasted what the low level code was doing for the initialize function. It's unfortunate the initialization is very tied to the existing driver.

I'll see if I can add this with a #ifdef for S2 for getting the clock stretch cause.