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

   ## Summary
   
   - boards/risc-v/esp32c6: add capture example to capture defconfig
   Add missing PWM capture example from the capture defconfig of 
esp32c3-devkitc.
   
   - arch/risc-v/espressif: add PWM capture getedges function
   Create esp_capture_getedges function which was missing from the capture API.
   
   - arch/xtensa/espressif: add PWM capture getedges function
   Create esp_capture_getedges function which was missing from the capture API.
   
   ## Impact
   
   - Impact on user: Yes, fixes a failure scenario when using the capture 
example.
   - Impact on build: No.
   - Impact on hardware: ESP32|S2|S3|C3|C6|H2.
   - Impact on documentation: No.
   - Impact on security: No.
   - Impact on compatibility: No.
   
   ## Testing
   ### Building
   
   Build any capture defconfig from Espressif devices and execute the capture 
example.
   
   - ./tools/configure.sh esp32c6-devkitc:capture
   - Make and flash
   
   ### Running
   
   Run the cap example:
   
   ```
   nsh> cap
   ```
   
   ### Results
   
   PWM signal 50% duty cycle at 10 kHz for 5 seconds in connected to the 
capture pin.
   
   ```
   Before:
   
       nsh> cap
       cap_main: Hardware initialized. Opening the capture device: /dev/capture0
       cap_main: Number of samples: 0
       pwm duty cycle: 0 % 
       pwm frequence: 0 Hz 
       dump_assert_info: Current Version: NuttX  10.4.0 9e573371bb Nov 18 2025 
08:54:38 xtensa
       dump_assert_info: Assertion failed lower[i]->ops->getedges != 
((void*)0): at file: timers/capture.c:344 task: cap process: cap 0x420244f8
   ```
   
   Now:
   ```
       nsh> cap
       cap_main: Hardware initialized. Opening the capture device: /dev/capture0
       cap_main: Number of samples: 0
       pwm duty cycle: 0 % 
       pwm frequence: 0 Hz 
       pwm edges counting: 0 
       pwm duty cycle: 50 % 
       pwm frequence: 10000 Hz 
       pwm edges counting: 553 
       pwm duty cycle: 50 % 
       pwm frequence: 10000 Hz 
       pwm edges counting: 1653 
       pwm duty cycle: 50 % 
       pwm frequence: 10000 Hz 
       pwm edges counting: 2753 
       pwm duty cycle: 50 % 
       ...
       pwm edges counting: 45527 
       pwm duty cycle: 50 % 
       pwm frequence: 9999 Hz 
       pwm edges counting: 46626 
       pwm duty cycle: 50 % 
       pwm frequence: 10000 Hz 
       pwm edges counting: 47725 
       pwm duty cycle: 50 % 
   ```


-- 
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