Interrupt Issues Based on NXP Core imx6ulx

Requirement Description For scenarios that require extremely high real-time response (such as power failure detection), interrupts must be used. However, for the imx6ulx, which is a Linux platform, there are no convenient interrupt operations like those in RTOS. To achieve the same smooth operation, both the kernel driver and the application layer program need to be modified.Example Explanation In the imx6ull, GPIO1_IO01 is used as a low-level signal for power failure detection. When this signal is detected, an immediate response is required.1. Solution Approach: In the device tree and kernel driver, set GPIO1_IO01 to trigger an interrupt on a low level. When the kernel detects the interrupt, it sends the interrupt signal to the application program’s bound thread via send_sig. The program should capture the signal sent by the kernel using the sigaction method and then call the interrupt handling function.2. Specific Steps:Device Tree ConfigurationIn the device tree, configure GPIO1_IO01 as input mode and enable falling edge interrupt.Interrupt Issues Based on NXP Core imx6ulx

Kernel Driver Program

The key two pieces of code are as follows, which send a signal to the user space thread when an interrupt signal occurs.

Interrupt Issues Based on NXP Core imx6ulxInterrupt Issues Based on NXP Core imx6ulx

User Space Program

Interrupt Issues Based on NXP Core imx6ulxInterrupt Issues Based on NXP Core imx6ulx

Compilation and Debugging

Instructions for writing and compiling the kernel and device tree (to be explained in another article when time permits).

After the application program is compiled, copy it to the hardware for execution.

However, after detecting the power failure interrupt, the following printout will occur.

Interrupt Issues Based on NXP Core imx6ulxProblem Solved, Requirement Completed

Leave a Comment