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.

AM6442: PWM sync between ARM and PRU

Expert 2851 points
Part Number: AM6442

Hi

May I have questions about AM64x PWM synchronization?

My customer is using ePWM perpheral from R5F and PWM(IEP compare) output from PRU.

And want to sync each PWM.

The CPTS(Time sync module) could sync ePWM and IEP?

If could, Is there any example, CPTS driver, information...?

If could not, Is there any way to sync PWM?

Thanks,

GR

  • Hello GR,

    Are these engineers your customers?
    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1263772/am6442-pru-icss-pwm-for-am64xx

    A sync signal from the CPTS (or any other input to the time sync router) could absolutely be used to synchronize counters on the R5F and PRU. We provide an example of syncing Linux and the PRU IEP timer in this FAQ: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1252399/faq-how-to-synchronize-the-pru-iep-timer-with-linux-system-time

    The challenge there is that I do not currently have a good example of syncing the R5F through the time sync router. I can think of two ways that an R5F counter could be synchronized with a CPTS counter:

    1) the R5F could use a timer that is an input to the time sync router. The timer could generate an edge at R5F local time T1. The edge would travel through the time sync router, and the CPTS could timestamp when it received the edge at CPTS time T2. Based on the Time Sync Router FAQ you linked above, we would expect that it would take between 0ns and 14 ns less for the signal to travel from the output of the timer, to the input of the CPTS.

    Linux (or whichever software was controlling the CPTS) could then send that time T2 back to the R5F (e.g., in an RPMsg). R5F could then adjust its local timer to match the CPTS time.

    2) The CPTS could send out a pulse at an agreed upon time (e.g., one pulse per second, or 1 PPS). Then the R5F could grab the local timestamp of when it receives the PPS, and then update its local time to match the CPTS, similar to the process described for the PRU IEP timer above. However, the challenge there is that you would need to configure the interrupt to go through the L2G logic and the interrupt aggregator (IA), through to the R5F:

    There are probably other ways to sync the R5F and a PRU that do not use the time sync router. If you would like to discuss those options, let me know and I will reassign your thread to a team member more familiar with the MCU+ SDK.

    Regards,

    Nick

  • Hello Nick,

    Thanks for your information.

    I think may be these engneers have same theme.

    The challenge there is that I do not currently have a good example of syncing the R5F through the time sync router. I can think of two ways that an R5F counter could be synchronized with a CPTS counter:

    I understand.

    I think there are very high wall for use time sync module for customers.

    Is there any plan for more documents, example, and tool?

    There are probably other ways to sync the R5F and a PRU that do not use the time sync router. If you would like to discuss those options, let me know and I will reassign your thread to a team member more familiar with the MCU+ SDK.

    If there is more easy way to sync R5F and PRU,

    I am glad if you let me know.

    Best regards,

    GR

  • Hello GR,

    Help us understand your usecase

    How closely are you wanting to synchronize the PRU and R5F counters? e.g, within a millisecond? Within tens of microseconds? etc

    Followup

    Yes, we are working on additional time sync examples and code (e.g., I published that PRU IEP timer FAQ two months ago). I do not currently have a timeframe for when the first "R5F syncing" example will be available. If you want, I can check with the developers on if they have a tentative timeframe.

    In the meantime, I am reassigning your thread to another team member more familiar with the MCU+ SDK to see if they have any additional suggestions for syncing the R5F and PRU.

    Regards,

    Nick

  • Hello GR,

    Can you let me know how you're planning to use the PWM in your implementation.

    Regards,

    Nitika

  • Hello Nick, Nitika,

    Thanks for supporting, And sorry to late reply.

    Help us understand your usecase

    How closely are you wanting to synchronize the PRU and R5F counters? e.g, within a millisecond? Within tens of microseconds? etc

    My customer want to sync PRU and R5F counter in few micro second range.

    PRU is interrupt  by 40kHz, and R5F is interrupt by 20kHz. we want to sync the interrupt timing.

    This interrupt is reflesh PWM duty value and start conversion of ADC. 

    Followup

    Yes, we are working on additional time sync examples and code (e.g., I published that PRU IEP timer FAQ two months ago). I do not currently have a timeframe for when the first "R5F syncing" example will be available. If you want, I can check with the developers on if they have a tentative timeframe.

    It is good news for us that now is developing additional time sync example.

    If there are information, I am glad if you let me.

    Best regards,

    GR

  • Hi GR,

    I understand your usecase, allow me some time to look into the possible solutions and I'll get back to you.

    Regards,

    Nitika

  • Hi Nitika,

    Thanks for your supporting.

    Is there any update?

    If there are, I am glad if you let me know.

    Best regards,

    GR

  • Hi GR,

    Apologies for the delay.

    One way could be that the SoC ePWM be used to reset the IEP based on PWM SYNC OUT signal. Currently there is no example with this implementation, but this can be one option for synchronizing.

    Regards,

    Nitika

  • Hi Nitika,
    Thanks for your information.

    I understand.

    Is there any plan that SDK will support ePWM SYNC out for IEP or anything countor?

    Thanks,

    GR

  • Hi GR,

    Allow me some time, I will check with the developers on this and get back to you.

    Regards,

    Nitika

  • Hi GR,

    For reference, in the SDK SDFM example under motor control, ePWM SYNC out is used to align ICSSG IEP timer to PWM cycle. IEP timer comparators (CMP1..CMP15) are used to schedule events like current sense via SDFM.

    To sync R5F ePWM and PWM(IEP compare) output -> you can enable ePWM SYNC out reset bit for IEP reset & configure any one compare event of IEP for output.

    You can refer to SDFM motor control SDK documents for more information about sync implementation: AM243x Motor Control SDK: Current Sense (ti.com)

    Regards,

    Nitika

  • Hi Nitika,

    Thanks for your information.

    I will check the SDK.

    Best regards,

    GR