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.

AM3358: Timer4 IRQ in capture mode

Part Number: AM3358

Dear Ti: 

Timer4 can't generate IRQ at rising edge,when I set these registers bellow:

CM_PER_TIMER4_CLKCTRL = 0x2;

CLKSEL_TIMER4_CLK = 0x1;

 IRQENABLE_SET = 0x4;

TCLR = 0x4101;

when I connected the high level to the related pin, the TCRR's value could be captured at TCAR1

but the 2 bit in IRQSTATUS register wasn't be set to "1" and the irq_handler of 92 dosen't run.

the irq_handler is valid by excuting the follow command, I found the irq of 92

>>>>>>>>>>>>> 

cat /proc/interrupts

>>>>>>>>>>>>>>

Is there any register not set,or still need other operations?

BRs

Jiawei

  • Jiwai,

    how are you using the timer in capture mode from Linux? Have you developed a custom driver?

    user6316547 said:
    when I connected the high level to the related pin, the TCRR's value could be captured at TCAR1

    Sounds like you are able to successfully generate capture events using an external signal, you just don't see the TCAR_IT_FLAG interrupt flag getting set, right?

    user6316547 said:
    Is there any register not set,or still need other operations?

    Can you also try to enable the TCAR_WUP_ENA bit in IRQWAKEEN?

    Then, there is the IRQSTATUS_RAW register. See if you can see the TCAR_IT_FLAG flag getting set during your capture event.

    Also try setting TCAR_IT_FLAG manually to see if you can trigger your IRQ this way.

    Regards, Andreas

  • Andreas

    Thanks  for your suggests, I have resolved this problem.

  • hi, Andreas

    I have another question about timer's duty of PWM.

    1. why is not generate PWM at "TCRR == TMAR"?

    2.what is the condition to generate PWM?

    3 how to tune the duty of PWM?

    BRs

    Jiawei

  • Jiawei,

    our current Kernel/SDK  comes with PWM drivers that are used on certain AM335x boards for example to drive and adjust the backlight brightness of LCDs, see here for more info on the drivers:

    http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components/Kernel/Kernel_Drivers/Display/PWM.html

    You can find the respective driver sources by searching the Kernel tree for the device tree compatible strings used in the associated DT bindings:

    a0797059@jiji:~/git/linux (ti-linux-4.19.y-dev)
    $ git grep 'ti,am33xx-.*pwm' drivers/
    drivers/pwm/pwm-tiehrpwm.c:     { .compatible = "ti,am33xx-ehrpwm" },
    drivers/pwm/pwm-tipwmss.c:      { .compatible   = "ti,am33xx-pwmss" },

    Between the high-level driver documentation and the driver code that can serve as an example (or you can use as-is?) you should be able to make it work.

    Regards, Andreas

  • Andreas

    Ok, Got it, thanks!

    There is a problem  that is the  output pin has been pull

    high level when I connected the timer’s pwm output pin

    to the timer’s input pin of capture mode.

    Could you help me to resolve it?

    Brs

    Jiawei