Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32-S2: Add driver for I2C peripheral in Master mode #6539

Merged
merged 3 commits into from
Jun 29, 2022

Conversation

gustavonihei
Copy link
Contributor

Summary

This PR intends to add driver support for the I2C peripheral for the ESP32-S2 chip.

Features:

  • Operation currently restricted to Master mode only
  • Support for both I2C0 and I2C1
  • Support for Interrupts and Polled mode (CONFIG_I2C_POLLED=y)
  • Support for I2C Character device driver (CONFIG_I2C_DRIVER=y)

Impact

New feature for ESP32-S2 chip.

Testing

esp32s2-saola-1:i2c
Using I2C tool (CONFIG_SYSTEM_I2CTOOL), the driver was validated via integration with an external BMP180 pressure sensor module, on both I2C0 and I2C1 interfaces.

NuttShell (NSH) NuttX-10.3.0
nsh> ls /dev
/dev:
 console
 i2c0
 i2c1
 null
 ttyS0
nsh> i2c get -a 77 -r d0
i2cdrvr_ioctl: cmd=2101 arg=3ffb6370
i2c_transfer: Message 0 transfer complete.
i2c_transfer: Message 1 transfer complete.
Elapsed time: 0
 1. STATUS: 37008001 COUNT:   1 EVENT: SENDADDR  ( 1) PARM: 00000077 TIME: 0
 2. STATUS: 37008001 COUNT:   1 EVENT: RCVMODEEN ( 3) PARM: 00000000 TIME: 0
 3. STATUS: 37008101 COUNT:   1 EVENT: RCVBYTE   ( 4) PARM: 00000000 TIME: 0
 4. STATUS: 37008001 COUNT:   1 EVENT: STOP      ( 5) PARM: 00000001 TIME: 0
READ Bus: 0 Addr: 77 Subaddr: d0 Value: 55
nsh> 

arch/xtensa/src/esp32s2/esp32s2_i2c.c Outdated Show resolved Hide resolved
arch/xtensa/src/esp32s2/esp32s2_i2c.c Outdated Show resolved Hide resolved
arch/xtensa/src/esp32s2/esp32s2_i2c.c Outdated Show resolved Hide resolved
arch/xtensa/src/esp32s2/esp32s2_i2c.c Outdated Show resolved Hide resolved
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
@pkarashchenko pkarashchenko merged commit 43685ae into apache:master Jun 29, 2022
@gustavonihei gustavonihei deleted the feature/esp32s2_i2c branch June 29, 2022 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants