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.

Sync INTCNT of two different concertos



I have two separate concertos with one being a master and one being a slave. I’m using a PWM interrupt to do controls periodically (every 5th time a PWM counter is zero). The interrupts of the master and slave need to be synced. The master gives the slave a PWM sync signal so the PWM clocks are synced up between the master and slave. The SYNCOUT of the master is defined to be when the PWM1 counter is zero. The SYNCI of the slave is the SYNCOUT of the master.

When debugging, the interrupts of the master and slave are offset from each other if the master and slave don’t start at exactly the same time. Their INTCNT counters are offset. The tech reference says “The counter is only cleared when an interrupt is sent to the PIE” so how can I get the INTCNT of each concerto synced up?

Ideally I would make the period of the sync signal longer and interrupt every time the sync event occurs so that there cannot be an offset, but I’m not sure if I have the ability to do that. I have limited gpio resources to make a different SYNCOUT signal and am not able to change the period of PWM1 which is currently serving as SYNCOUT.

  • Hi rs,

    One way to get around this could be,
    Initially - disable the Interrupt pre-scale option in the slave module. Which means, in the beginning you will have interrupts every PWM cycle.
    Upon the first sync from master (this can be ascertained by reading TBSTS[SYNCI]) enable pre-scale for the interrupts in the slave module.
    If you do so, from that point of time i.e. the first sync from master to slave, INTCNT will remain in sync.
    Let me know if this is acceptable in your system.

    -Bharathi.
  • I think that could work. Thanks for your reply!

    My only concern is if they become un-synced at some point, I'll have to be able to detect it and re-sync them.
  • So long as the time bases are being synchronized via sync and Interrupts are synchronized at the start, they should remain so. I believe the PWMs are configured to run at the same frequency.
    As for run time check, I do not see a way of checking it and synchronizing the interrupt directly across 2 devices - unless you use some additional mechanism like signalling via GPIO or so across chips.

    -Bharathi.