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.

TIDA-010054: How is HRPWM Period calculated and implemeted?

Part Number: TIDA-010054

Tool/software:

Hi team, 

In the following code snippet (dab.h), why are the lower 8 bits of 'temp' masked?

static inline void DAB_calculatePWMDutyPeriodPhaseShiftTicks(void)
{
    uint32_t temp;
    //
    // Calculation for the period is done in high resolution
    // as it is used by the phase shift variable in high resolution
    //
    temp = ((uint32_t)(((float32_t)(DAB_pwmPeriod_pu *
            DAB_pwmPeriodMax_ticks) *
            (float32_t)65536.0)))>> 1;

    DAB_pwmPeriod_ticks = temp & 0xFFFFFF00;

'DAB_pwmPeriod_ticks' is then only written to 'TBPRDHR' (I cannot find anywhere 'TBPRD' register is updated), could you please explain why is the period tick number not split to "TBPRD" and 'TBPRDHR' as described in the technical manual? 

More details on how the HR tick is calculated are appreciated! 

  • Hi,

    Thanks for reaching out/
    The 8 lower bits are masked, since they are not used and should be be 0 according to the technical reference manual of TMSF280039C (page 2401 and 2402)
    "The lower 8 bits in this register are ignored - writes are ignored and reads return zero"

    DAB_pwmPeriod_ticks is a 32 bit integer. Since the register are 16 bit and TBPRD is the next higher register to TBPRDHR, this command actually writes both registers.

    Please refer to the technical reference manual of TMS329F280039C: https://www.ti.com/lit/ug/spruiw9c/spruiw9c.pdf
    In chapter 20.15 on page 2311 there is very detailed eplaination of HRPWM Module.

    Best regards,

    Andreas