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.

TMS320F28379D: Interaction between background SFO() and interrupts/CLA tasks

Part Number: TMS320F28379D

I'm running high fast control loop which relies on CLA1 tasks and CPU1 ISRs running every 2.5us to update my HRPWM CMPA and CMPB registers. Like many others here have mentioned, I want to rely on SFO() for calibration but am worried about its impact on the control loop. I've found several clues scattered among other threads here, but I'd like to try and put together a more complete picture. There are two ways I'm aware of that SFO() can impact ISRs and CLA tasks:

1. SFO() accesses some of the ePWM registers. If the CLA task tries to access the ePWM registers at same time, it will stall since the CPU has priority over the CLA. The user reports delays up to 25ns (5 sysclk). No suggestion of an upper bound on this delay from TI. In that thread, Sal suggests a couple workarounds:

"You can use message RAMs. You can also use the MIRUN. The C28x can view the MIRUN register. If the CLA task is running, then the C28x should wait to access the PWM registers until the CLA task is complete."

I'm unsure of how these workarounds would work. Once SFO() is executed, how could one possibly instruct the cpu to "wait to access the PWM registers," since we cannot see or modify SFO()??

2. SFO() contains non-interruptible RPT instructions, which can increase the latency of ISRs on CPU1. User reported delays up to 100ns (25 sysclks). TI has suggested a bound of "10-30 cycles on estimate" or "about 20 cycles" (I assume these are sysclk cycles). No workarounds suggested.

While I know TI can't share many details on SFO(), I'm looking for some clear upper bounds on these latency numbers, and also assurance that there are no other routes for interaction that are being overlooked. 

Regards,

Mike

Also PS: The "ask a related question" button does not function, otherwise I would have used it for this...

  • I will report the ASK RELATED button. Meanwhile I am looking at your question.

  • There is there a possibility for you to run the SFO library periodically in between the time you know you will not have an interrupt or PWM accesses? I am asking if instead of randomly running the SFO, you can actually schedule it at time T which you know wont affect your other interrupts or accesses.
  • Once the power supply starts operating, it can't just halt the feedback loop while SFO() runs. My CLA tasks and ISR calls will never have more than a 2.5us gap between them. Based on information volunteered in this previous thread, an SFO() call can take up to 735 clock cycles before returning, which is much longer.

  • Okay I see what you mean. Let me ask our systems team how you have to design the system for this.

    Nima

  • I have notified our systems team for a solution.
  • Hi Nima, any updates from the systems team?

    Regards,
    Mike
  • Mike,

    Both engineers who know the answer are still on vacation. I will ping them again to see if they can help sooner.

    Nima

  • Mike I am still researching a solution to this. I will get back to you as soon as I find an answer

  • Hi Nima, can I get an update on this? Are the expert engineers still unavailable?

  • My manager and I are still hunting this down. Seems like with the current version of the code, and the RPT instructions, there is not a workaround for you to reduce your interrupt latency. However after reviewing the SFO library internally I have an idea of how to change the code so that it is ALWAYS interrupt-able. But again it will be some time before we release it. What I can do is send you and updated version of the new UNTESTED SFO lib I am working on to see if it will work. Again It will take some time to put this together and I cannot in any way guarantee its performance.
  • My team and I are still hunting this down. It seems like as far as the current version of the SFO, there is not a work around the interrupt latency due to the RPT instructions. However after reviewing the internal source code, I have an idea on how to change it and make it be interruptable at all time. BUT again this is not official and is untested. What I can do is, once I complete my update, I can build the library and send it to you and you can test it to see if it works for you. Again no promise on the performance of the new code I am tinkering with.
  • Hi Nima,
    The prospect of trying a new SFO library is interesting, but whether it's worthwhile or not hinges on my original question: what range of latency is there with the current release of SFO()?
  • With the current version, the latency will be around the duration of 20 NOPs. The istruction causing the delay is:
    asm(" RPT #20 || NOP");

    Plus the standard latency of an interrupt, which is dependent on the location of the interrupt in the PIE table.