SPRACO5 September   2019 TMS320F280021 , TMS320F280021-Q1 , TMS320F280023 , TMS320F280023-Q1 , TMS320F280023C , TMS320F280025 , TMS320F280025-Q1 , TMS320F280025C , TMS320F280025C-Q1 , TMS320F280040-Q1 , TMS320F280040C-Q1 , TMS320F280041 , TMS320F280041-Q1 , TMS320F280041C , TMS320F280041C-Q1 , TMS320F280045 , TMS320F280048-Q1 , TMS320F280048C-Q1 , TMS320F280049 , TMS320F280049-Q1 , TMS320F280049C , TMS320F280049C-Q1 , TMS320F28384D , TMS320F28384D-Q1 , TMS320F28384S , TMS320F28384S-Q1 , TMS320F28386D , TMS320F28386D-Q1 , TMS320F28386S , TMS320F28386S-Q1 , TMS320F28388D , TMS320F28388S , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DK-Q1

 

  1.   Leveraging High Resolution Capture (HRCAP) for Single Wire Data Transfer
    1.     Trademarks
    2. 1 Introduction
    3. 2 System Showcase
      1. 2.1 HRPWM: Encoding Unit
      2. 2.2 HRCAP: Decoding Unit
    4. 3 Software Flow
      1. 3.1 User Configurable Parameters
      2. 3.2 SFO Background Loop
      3. 3.3 Interrupt Based Encoding and Decoding
      4. 3.4 Offset Calibration
    5. 4 Experimental Setup and Results
    6. 5 Summary
    7. 6 References

HRPWM: Encoding Unit

HRPWM extends the time resolution capabilities of the conventionally derived digital PWM by using micro-edge positioner (MEP) technology. MEP logic is capable of positioning an edge very finely by subdividing one system clock of conventional PWM generator and provides accuracy on order of picoseconds. The conventional ePWM module does not offer sufficient resolution at high frequencies and that’s where HRPWM can really differentiate if used as an encoding unit as the following system aims to establish low latency and high resolution data transfer. For more details on HRPWM, see the TMS320F2838x Microcontrollers With Connectivity Manager Data Sheet and the TMS320F2838x Microcontrollers Technical Reference Manual.

The function of the encoding unit is to vary the PWM pulse width proportionally to the analog input. This is realized by configuring ePWM to provide conventional PWM of desired frequency and then programming HRPWM MEP to provide precision control on the falling edge (FE), while keeping the rising edge (RE) constant. Also, the MEP is programmed to use the control mode as duty control instead of phase control as the duty parameter of the signal is used for decoding at the receiver. In order to speed-up the encoding routine, auto-conversion mode is enabled in conjunction with scale factor optimization (SFO) library which will automatically calculate the appropriate number of MEP steps represented by the fractional duty cycle and move the falling edge of signal accordingly. The HRPWM programming sequence for the discussed configuration using driverlib APIs is also shown in the code below. For more details, see the Driverlib API User's Guide inside C2000ware. Shadowing (double buffering) is enabled for the registers to prevent any signal distortion by making sure any register update does not affect the current cycle.

// // Configure MEP edge & control mode for channel A & B, MEP Edge control is // on falling edge. Control mode is duty control. // HRPWM_setMEPEdgeSelect (base, HRPWM_CHANNEL_A, HRPWM_MEP_CTRL_FALLING_EDGE); HRPWM_setMEPControlMode (base, HRPWM_CHANNEL_A, HRPWM_MEP_DUTY_PERIOD_CTRL); HRPWM_setMEPEdgeSelect (base, HRPWM_CHANNEL_B, HRPWM_MEP_CTRL_FALLING_EDGE); HRPWM_setMEPControlMode (base, HRPWM_CHANNEL_B, HRPWM_MEP_DUTY_PERIOD_CTRL); // // Enable Automatic Conversion mode // HRPWM_enableAutoConversion (base);