Hardware requirements
Mini/micro USB cable
MIMXRT1160-EVK board
Personal Computer
Oscilloscope
Board settings
No special is needed. Use oscilloscope to measure the output 48KHz PWM signal pin at J26-2 pin.
Prepare the Demo
Connect a USB cable between the PC host and the OpenSDA USB port on the board.
Open a serial terminal with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the example.
Running the demo
When the example runs successfully, if the input duty cycle range is 0~100, You can see similar information from the terminal as follows:
FLEXIO_PWM demo start.
Please input a value (0 - 100) to set duty cycle: 10
Input value is 10
PWM duty cycle is: 10
PWM leave is: 0
Please input a value (0 - 100) to set duty cycle: 150
Input value is 150
Your value is output of range.
Set pwm output to IDLE.
Please input pwm idle status (0 or 1): 1
Input IDLE state value is 1
PWM leave is: 1
Please input a value (0 - 100) to set duty cycle:
......
Note:
The duty cycle of the PWM is variable, except for the idle state, 0 and 100.
If the input duty cycle range exceeds 100, the pwm will be set to idle state
If the set pwm idle value is out of range, it will output “Your value is output of range.” and then return to set the duty cycle.