TMS320F28379D-Q1: Sector generation using sines

Part Number: TMS320F28379D-Q1

I am attempting to generate 18 sectors using the logic shown below. Some of these are transition sectors that are intended to have a duration of exactly one switching cycle.

However, during testing I observed an issue: instead of maintaining a consistent one-cycle duration, some transition sectors occasionally persist for two cycles. This behavior is intermittent and has been observed on the DSO measurements.

My expectation is that each transition sector should appear for only a single cycle before moving to the next sector. I would like assistance in understanding what could cause these occasional two-cycle durations and whether there may be an issue with the sector transition logic, comparison conditions, or timing/sampling synchronization.

The relevant code section is shown below:

if (sinevalueC > 0 && sinevalueA <= -EPD && sinevalueB <= -EPD)
{
    if (sinevalueA >= sinevalueB)
        next_sector2 = 1;
    else
        next_sector2 = 18;
}
else if (sinevalueA >= -EPD && sinevalueA <= EPD && sinevalueC > 0 && sinevalueB < 0)
{
    next_sector2 = 2;
}
else if (sinevalueA >= EPD && sinevalueC >= EPD && sinevalueB < 0)
{
    if (sinevalueC >= sinevalueA)
        next_sector2 = 3;
    else
        next_sector2 = 4;
}

 

Any guidance on debugging this issue would be appreciated.

  • Hi,

    Your issue likely stems from boundary condition ambiguity. When sine values are very close to threshold boundaries (±EPD), floating-point precision and sampling timing can cause the same physical position to be classified differently across consecutive cycles. A quick test is, temporarily increase EPD by 2-3x and see if the issue disappears. If it does, your threshold is too tight for your system's noise floor.

    Thanks,

    Jiaxin