eren-terzioglu opened a new pull request, #16694:
URL: https://github.com/apache/nuttx/pull/16694

   ## Summary
   
   Add LP_I2C support for ESP32-C6 to ahve multiple option on I2C peripheral 
and increase coverage of ESP32-C6's peripherals
   Fix I2C Slave build error that happened after Espressif's common layer 
update.
   
   * arch/xtensa: Bugfix I2C Slave build error for esp32[-|-s2|-s3]
   
   Fix build error for Xtensa based Espressif devices
   
   * arch/risc-v: Bugfix I2C Slave build error for esp32[-c3|-c6|-h2]
   
   Fix build error for risc-v based Espressif devices
   
   * arch/risc-v: Add LP I2C for esp32c6
   
   Add LP I2C peripheral support for esp32c6
   
   ## Impact
   <!-- Please fill the following sections with YES/NO and provide a brief 
explanation -->
   
   Impact on user: No, just new peripheral support added
   <!-- Does it impact user's applications? How? -->
   
   Impact on build: No
   <!-- Does it impact on building NuttX? How? (please describe the required 
changes on the build system) -->
   
   Impact on hardware: Yes, new hardware support added into NuttX
   <!-- Does it impact a specific hardware supported by NuttX? -->
   
   Impact on documentation: Yes, related peripheral docs added
   <!-- Does it impact the existing documentation? Please provide additional 
documentation to reflect that -->
   
   Impact on security: No
   <!-- Does it impact NuttX's security? -->
   
   Impact on compatibility: No
   <!-- Does it impact compatibility between previous and current versions? Is 
this a breaking change? -->
   
   ## Testing
   <!-- Please provide all the testing procedure. Consider that upstream 
reviewers should be able to reproduce the same testing performed internally -->
   
   ### Building
   <!-- Provide how to build the test for each SoC being tested -->
   
   Command used to build and flash:
   
   ```
   make distclean && ./tools/configure.sh esp32c6-devkitc:i2c && kconfig-tweak 
-e CONFIG_ESPRESSIF_LP_I2C0 && kconfig-tweak --help --set-val 
CONFIG_I2CTOOL_MAXBUS 3 &&  make olddefconfig && make -j && make download 
ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BAUD=921600 ESPTOOL_BINDIR=../esp-bin
   ```
   
   To run another device as slave I used this command:
   ```
   make -j distclean && ./tools/configure.sh esp32c6-devkit:i2c && 
kconfig-tweak -d CONFIG_ESPRESSIF_I2C0_MASTER_MODE && kconfig-tweak -e 
CONFIG_ESPRESSIF_I2C0_SLAVE_MODE && make olddefconfig && make flash 
EXTRAFLAGS="-Wno-cpp -Werror" ESPTOOL_BINDIR=./ ESPTOOL_PORT=/dev/ttyUSB0 -s 
-j$(nproc) && minicom
   ```
   
   ### Running
   <!-- Provide how to run the test for each SoC being tested -->
   
   Here is the connection list
   
   |     | ESP32-C6 LPI2C | I2C Slave Device |
   |-----|----------------|------------------|
   | SCL | 7              | 6                |
   | SDA | 6              | 5                |
   
   After connection done, `i2c dev 0x28 0x28` command used to test LPI2C is 
working fine.
   
   Alternatively, this connection can be connect to a logic analyzer too and 
check the result also with `i2c get -b 2 -a 0x28` and `i2c set -b 2 -a 0x28 
0x10`
   
   ### Results
   <!-- Provide tests' results and runtime logs -->
   
   
   Outputs should look like this:
   
   ```
   nsh> i2c dev -b 2 0x28 0x28
   NOTE: Some devices may not appear with this scan.
   You may also try a scan with the -z flag to discover more devices using a 
zero-byte write request.
        0  1  2  3  4 Elapsed time: 0
    1. STATUS: 6600c000 COUNT:   1 EVENT: SENDADDR  ( 1) PARM: 00000028 TIME: 0
    2. STATUS: 3700c001 COUNT:   1 EVENT: RCVMODEEN ( 3) PARM: 00000000 TIME: 0
    3. STATUS: 3700c101 COUNT:   1 EVENT: RCVBYTE   ( 4) PARM: 00000000 TIME: 0
    4. STATUS: 3700c101 COUNT:   1 EVENT: STOP      ( 5) PARM: 00000001 TIME: 0
    5  6  7  8  9  a  b  c  d  e  f
   00:                                                 
   10:                                                 
   20:                         28                      
   30:                                                 
   40:                                                 
   50:                                                 
   60:                                                 
   70:  
   
   nsh> i2c set -b 2 -a 0x28 0x10
   Elapsed time: 0
    1. STATUS: 67000001 COUNT:   1 EVENT: SENDADDR  ( 1) PARM: 00000028 TIME: 0
    2. STATUS: 37000001 COUNT:   1 EVENT: SENDBYTE  ( 2) PARM: 00000000 TIME: 0
    3. STATUS: 37000001 COUNT:   1 EVENT: STOP      ( 5) PARM: 00000001 TIME: 0
   WROTE Bus: 2 Addr: 28 Subaddr: 00 Value: 10
   
   nsh> i2c get -b 2 -a 0x28
   Elapsed time: 0
    1. STATUS: 66000000 COUNT:   1 EVENT: SENDADDR  ( 1) PARM: 00000028 TIME: 0
    2. STATUS: 37000001 COUNT:   1 EVENT: RCVMODEEN ( 3) PARM: 00000000 TIME: 0
    3. STATUS: 37000101 COUNT:   1 EVENT: RCVBYTE   ( 4) PARM: 00000000 TIME: 0
    4. STATUS: 37000101 COUNT:   1 EVENT: STOP      ( 5) PARM: 00000001 TIME: 0
   READ Bus: 2 Addr: 28 Subaddr: 00 Value: aa
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to