SPRACO5 September 2019 F29H850TU , F29H859TU-Q1 , 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 , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1
HRCAP enhances the capture resolution capabilities of the conventional capture unit eCAP by utilizing the high-speed asynchronous clock source called HRCLK to measure the ticks between any two edges with a resolution in order of nanoseconds as discussed in the TMS320F28004x Piccolo™ Microcontrollers Data Sheet. In order to convert the captured tick counts to time-converted measurements, it is required to make continuous period calibrations as HRCLK is sensitive to changes in both temperature and voltage. Also it is important to note that HRCAP raw measured output is constant or fixed offset-shifted and has some variations that result in a probability distribution, as indicated in the TMS320F28004x Piccolo™ Microcontrollers Data Sheet as well.
The function of the decoding unit is to measure signal pulse width and map it to the corresponding encoded data. In order to minimize the variations in HRCAP decoded output, duty based decoding approach is used in this system. In duty based decoding, HRCAP is configured in a continuous mode to latch absolute counter values at 3 edges: rising edge, falling edge followed by another rising edge. The programming sequence for this configuration using driverlib APIs (see the Driverlib API User's Guide inside C2000ware) is shown in the code below. These absolute values are then converted to relative measurements in order to find the ON time and period and then duty is calculated by computing the ratio of ON time count and period count. This duty value is finally used to map to the encoded data rather than the ON time. This approach smartly suppresses the variations in the absolute raw output and ultimately leads to better system performance by achieving higher ENOB value. Another major advantage of using duty based decoding is that there is no need of converting ON time and period raw counts into time-converted measurements as ultimately duty is just a ratio of these two. This makes the decoded output immune to any temperature/pressure variations and also eliminates the need of continuous periodic HRCAP calibration ultimately freeing the CPU bandwidth.
//
// Continous mode, stop at 3 events
//
ECAP_setCaptureMode (ECAP6_BASE,
ECAP_CONTINOUS_CAPTURE_MODE,
ECAP_EVENT_3);
//
// Event 1, Event 3 rising edge. Event 2 falling edge
//
ECAP_setEventPolarity (ECAP6_BASE,
ECAP_EVENT_1,
ECAP_EVENT_RISING_EDGE);
ECAP_setEventPolarity (ECAP6_BASE,
ECAP_EVENT_2,
ECAP_EVENT_RISING_EDGE);
ECAP_setEventPolarity (ECAP6_BASE,
ECAP_EVENT_3,
ECAP_EVENT_RISING_EDGE);