[MA35D1] GPIO PWM and Capture Linux Module Driver

Post Reply
chhsieh3
Posts: 280
Joined: 13 Mar 2020, 09:08

17 Nov 2022, 14:46

  • Application: This sample code shows how to import GPIO PWM and GPIO Capture driver into the Linux kernel, realize PWM output and detect the change status of pins.
  • BSP Version: Linux-5.10.x
  • Hardware: NuMaker-IOT-MA35D1 V2.0
This sample code demonstrates how to simulate the PWM signal through the “GPIO PWM” module, and connect the signal to the GPIO which is set by the “GPIO Capture” module as an input pin. When the input pin state is changed, the “GPIO Capture” module will trigger an interrupt to count the number of interrupts and record time tick. User can read the interrupt information through the "Capture" test program and the /sys interface.

Considering practicability, the “GPIO Capture” module only supports up to 32 pins in the design. Since the high-precision time in the driver is used to realize the secondary detection function of the input pins, it is necessary to consider whether too many pins to be enabled will affect system performance.

The number of “GPIO PWM” signals is not limited; however, because the module uses high-precision time to calculate the duty cycle, if the number is too large, it will affect the efficiency of the system and will decrease the accuracy of the duty cycle.

You can download the sample code at https://www.nuvoton.com/resource-downlo ... 0709264312
Nuvoton

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests