tmedicci opened a new pull request, #17137:
URL: https://github.com/apache/nuttx/pull/17137

   ## Summary
   
   * risc-v/espressif/pcnt: Update common source code functions
     - Updates the common source code for the PCNT peripheral used by 
Espressif's RISC-Vs SoCs. This enables newer SoCs to be supported in the future 
while maintaining backwards compatibility.
   
   ## Impact
   
   Impact on user: No.
   
   Impact on build: No.
   
   Impact on hardware: Not yet: newer Espressif SoCs can be supported on NuttX 
following this change.
   
   Impact on documentation: No.
   
   Impact on security: No.
   
   Impact on compatibility: No. It's totally backwards compatible.
   
   ## Testing
   
   Testing can be performed using any of the `qencoder` defconfigs available 
for any of Espressif's RISC-V-based devices (ESP32-C6, or ESP32-H2). The 
behavior of the PCNT peripheral didn't change, and this PR's results are the 
same of the results before it. This can be verified:
   
   ### Building
   
   #### ESP32-C6
   
   ```
   make -j distclean && ./tools/configure.sh esp32c6-devkitc:qencoder && make 
flash ESPTOOL_PORT=/dev/ttyUSB0 && picocom -b 115200 /dev/ttyUSB0
   ```
   
   #### ESP32-H2
   
   ```
   make -j distclean && ./tools/configure.sh esp32h2-devkit:qencoder && make 
flash ESPTOOL_PORT=/dev/ttyUSB0 && picocom -b 115200 /dev/ttyUSB0
   ```
   
   ### Running
   
   This can be tested by the `qe` application (please note that this 
application would only show any non-zero result if an external quadrature 
encoder is attached). Type `qe` on NSH.
   
   ### Results
   
   Using the `qe` application, it can be verified that no pulses are being 
counted (no external device):
   
   ```
   nsh> ls /dev/
   /dev:
    console
    null
    pcnt0
    qe0
    random
    ttyS0
    zero
   nsh> qe
   qe_main: Hardware initialized. Opening the encoder device: /dev/qe0
   qe_main: Number of samples: 20
   qe_main:   1. 0
   qe_main:   2. 0
   ```
   
   Espressif's internal CI provides an application that tests internally 
generates a signal similar to a quadrature encoder and, then, attaches it to 
the respective pings of the peripheral. All tests passed successfully. An 
example of such testing:
   ```
   nsh> qe_test -f 100
   Pulse Counter Test
   PWM Out 0 GPIO: 2
   PWM Out 1 GPIO: 3
   PCNT CH0 Pulse GPIO: 10
   PCNT CH1 Ctrl  GPIO: 11
   PWM Duty:  32767 
   qe_open: crefs: 0
   qe_open: calling setup
   qe_ioctl: cmd: 3842 arg: 0
   esp_reset: Resetting position to zero
   PWM Freq:  100 Hz
   Direction: 1
   PWM Offset (CW): 2500 us
   pcnt: config GPIO matrix
   pcnt: setup PWM
   pcnt: setup QE
   qe_ioctl: cmd: 3841 arg: 1082175964
   qe_close: crefs: 1
   qe_close: calling shutdown
   Result:
   pcnt: 401
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to