This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-AM243: Forcing an ECAP Capture event

Part Number: LP-AM243

Hello TI team,

i'am trying to force the ecap module to capture the current timer value and start the cap1 ISR by software.

According to the "AM64x/AM243x Technical Reference Manual Revision 2.0"  i thought it would be possible to just set the "CEVT1_FRC" bit in the appropriate ECAP_ECINT_CLR_FRC Register.

So instead of using a timer based GPIO toggling to trigger the capture event I took the values listed there into fixed variables and tried to set the bits similar to the function ECAP_oneShotReArm() i the Timer_ISR.

I tried to break it down here:

uint32_t ecap1ForceAndClearEventReg = 0x23110030;
uint32_t forceCapEvent1 = (1<<17);

void setBit(uint32_t reg, uint32_t bit)
{
     uint32_t regContent = HW_RD_REG32(reg);
     regContent |= ((uint32_t)bit);
     HW_WR_REG32(reg, regContent);
}

//in the main
setBit(ecap1ForceAndClearEventReg, forceCapEvent1);

Have I missed something here? For a tip or clarification at this point I would be very grateful.

Kind Regards,

Ronny

  • Hi Ronny,

    I don't see anything incorrect here with your setup or your understanding. Would it be possible for you to share your project so I can test it out on my end and see if there is anything I can spot configuration wise or via debug?

    Best Regards,

    Ralph Jacobi

  • Hi Ralph,

    i tried again to switch from my first running version with gpio-triggered capture to the forced version (just the few lines in the Timer_ISR) and it worked once. Today it - again - only print out zeros. So I attached you the whole project. Maybe you can find the error.

    ECAP_Loopback_am243x-lp_r5fss0-0_nortos_ti-arm-clang.rar

    Thanks in advance

    Ronny

  • Hi Ronny,

    Thanks. I don't have an immediate answer for you but this was really helpful. I didn't see any errors with your full program so I went ahead and put my LaunchPad into debug mode so I could step through the code. I see it executing as you've designed and the forcing register is tripping both the interrupt and Capture Event 1 bits in the CTL_STS_ECINT_EN_FLAG register and that it jumps to the ISR, but I don't see the actual capture event time step being saved into the CTL_STS_CAP1 register.

    I will need to reach out to other team members regarding this, I will plan to post an update before the end of the week even if its just to inform where we are in terms of looking into this further.

    Best Regards,

    Ralph Jacobi

  • Hi Ronny,

    Sorry for the lack of update here, but I haven't received any further information yet regarding this. I am continuing to work this offline to get more conclusive information on why this is not working as described in documentation.

    Best Regards,

    Ralph Jacobi

  • Hi Ronny,

    Still working to get a clear answer on this, I'll update again on Tuesday next week.

    Best Regards,

    Ralph Jacobi

  • Hi Ronny.

    I apologize that we haven't made any progress here. Because of the very specific nature of this issue it's taking longer than usual to work this. It's been escalated accordingly and I will try and update by end of the week again if not ideally sooner with some proper feedback.

    Best Regards,

    Ralph Jacobi

  • Hi Ronny,

    Sorry it took so long to get a simple answer on this...

    What I've learned is we have both misinterpreted the feature that is mentioned. It is only meant to trigger an interrupt and not force a capture of the counter value.

    In the description in the ECAP Interrupt Control section it states "The interrupt force register (ECAP_ECINT_CLR_FRC) can force an interrupt event."

    And Table 12-4303 is the ECAP Interrupt Clear and Forcing register and under this description the "Force Capture Event" means its an interrupt forced but it doesn't imply that the counter value is being captured.

    I believe one improvement here would be to explicitly outline that only the interrupt is forced and no capture value is being stored when using this but otherwise it was documented and I also misinterpreted it and in hindsight I should have noticed that outright myself.

    Best Regards,

    Ralph Jacobi

  • Hi Ralph,

    that's a pity, because that would have been the emergency solution to trigger the ECAP module without needing the corresponding pin. Unfortunately, these are not available on the AM64x Evalboards. Even after searching with the TI sales department, we couldn't find anything. I'll have to wait for a self-built custom board, as I have all the relevant pins here and can then trigger the ECAP module normally.

    But thanks for the help

    Best Regards

    Ronny