Other Parts Discussed in Thread: SYSCONFIG, AM3359
After a few days of work, I'm having no luck getting the ECAP module working on my BeagleBone Black running Linux. I've disabled ECAP PWM support in the kernel, and written a brute-force style kernel module to set register values, but I never see the interrupt come down the line. My module performs the following steps (see below for the resulting register values):
- Requests an IRQ using request_irq() with line number 31 (from section 6.3)
- Muxes the pin by setting the RXACTIVE bit and mode 0 in register conf_ecap0_in_pwm0_out (9.3.1.51)
- Clearing ECEINT
- Setting ECCTL1, and ECCTL2 appropriately
- Setting the CLR bits in ECCLR
- Setting all CEVTx bits in ECEINT
- Enabling the module in CM_PER_EPWMSS0_CLKCTRL (8.1.12.1.36)
- Enabling the clock in pwmss_ctrl (9.3.1.32)
- Setting the "smart" idle mode in register SYSCONFIG (15.1.3.2)
- Enabling the ECAP clock in CLKCONFIG (15.1.3.3)
- Checking the eCAP_CLK_EN_ACK value in CLKSTATUS
I've built some debugging output into the __init, and here's its output:
[ 8692.061879] The ecap hello-worldish module is loading.
[ 8692.068204] CM_PER_EPWMSS0_CLKCTRL: 0x00000002
[ 8692.068224] pwmss_ctrl: 0x00000007
[ 8692.068236] CM_PER_L4LS_CKLSTCTRL: 0x00004102
[ 8692.068248] CM_PER_L4LS_CLKCTRL: 0x00000002
[ 8692.068259] ecap_evt_cap: 0x00000000
[ 8692.068277] PWMSS register values = {
[ 8692.068277] IDVER: 0x47400001
[ 8692.068277] SYSCONFIG: 0x00000008
[ 8692.068277] CLKCONFIG: 0x00000111
[ 8692.068277] CLKSTATUS: 0x00000111
[ 8692.068277] }
[ 8692.068327] ECAP0 register values ={
[ 8692.068327] TSCTR: 0x846610ed
[ 8692.068327] CTRPHS: 0x00000000
[ 8692.068327] CAP1: 0x00000000
[ 8692.068327] CAP2: 0x00000000
[ 8692.068327] CAP3: 0x00000000
[ 8692.068327] CAP4: 0x00000000
[ 8692.068327] ECCTL1: 0x00000100
[ 8692.068327] ECCTL2: 0x00000090
[ 8692.068327] ECEINT: 0x0000001e
[ 8692.068327] ECFLG: 0x00000000
[ 8692.068327] ECCLR: 0x00000000
[ 8692.068327] ECFRC: 0x00000000
[ 8692.068327] REVID: 0x44d22100 }
[ 8692.068388] Everything, it seems, would be all right with ecap
I can see in /proc/interrupts that the kernel is looking for interrupts with ID 31, but writing to the ECFRC registers (mmap /dev/mem to the appropriate address), and strobing the pin externally isn't causing my interrupt handler to write anything to dmesg, nor incrementing the count in /proc/interrupts or even the spurious interrupt count. TSCTR is incrementing (I can see it by re-loading my module and watching the output above), but the capture just isn't happening.
I am totally lost here. Does anyone have any avenues I can pursue?