I am attempting to use the touchscreen controller to both drive a touchscreen and detect imminent power loss via a voltage divider across our 24V supply. Since I only care about knowing whether power is on the way down or not, I discard the values themselves and just use the range interrupt, using FIFO0 only for touchpanel inputs. My question is whether I have to be in the IDLE state in order to detect the pen down event.
According to the manual, "If a HW event occurs while the sequencer is in the middle of scheduling the SW steps, the user can program the scheduler to allow preemption. If the HW preempt control bit is enabled, the sequenceer will allow the current SW step to finish and then schedule the HW steps". Since Figure 12-2 has the X+ input going directly into the PEN & IRQ control block, and as thread AM335x TSC PEN_UP interrupt describes the block as only looking for a threshold crossing, it would seem that I could be using the ADC itself for other purposes (such as monitoring the power line).
However, although I set the hardware preempt bit and map the hardware event to pen touch in the control register, the touchpanel quits working if I set the powerloss step for software continuous and enable it. I can run the touchpanel (and light an LED to indicate pen up/down status) or I can monitor powerloss, but so far I cannot do both. If I have to be in the IDLE state to detect pen-down then this would make perfect sense, but this would be a waste of the ADC.
I tried configuring a "soft idle" state to configure the TSC just as the idle state does but that was unsuccessful.
Th example in thread AM335x: 4-wire TSC with 4 general-purpose ADC channels uses a timer interrupt to enable the software step, which I want to avoid.
It also may be that the text quoted in the 2nd paragraph above refers to external HW events only, and that the line "If continuous mode is selected, it is the software’s responsibility to turn off the step enable bit." in section 12.3.4 is a too-subtle warning that the use of software continuous mode will preclude pen events.