4.7 DSP Registers

The Metrology library interfaces with the Meter Demo application through 4 kind of register types:

  • Control registers
  • Status registers
  • Accumulated quantities registers
  • Harmonic analysis registers

The Demo Meter Application includes 4 data structures corresponding to these registers: DSP_CTRL_TYPE, DSP_ST_TYPE, DSP_ACC_TYPE and DSP_HAR_TYPE. The data structures are defined in metrology/metrology.h. These registers are allocated in buffers in IRAM2 memory, which is shared between Core 0 (running the Demo Meter application firmware) and Core 1 (running the Metrology library firmware).

The DSP_CTRL_TYPE buffer is used to send control data to the Metrology library DSP code. The control data is sent to Core 1 at power on initialization stage and also when the user modifies the control data through the serial interface. The DSP_ST_TYPE and DSP_ACC_TYPE buffers are updated every integration period (one second by default) from Core 1. The buffer updating procedure uses the IPC_Handler() and API from the Inter Processor Communication device driver to handle the transfer and data sharing between Core 0 and Core 1. The DSP_HAR_TYPE is updated also every integration period if the harmonic analysis feature is enabled. The buffer data transfer direction is shown in the following table.

Table 4-1. Shared RAM Data Transfer
Buffer nameFromToNotes
DSP_CTRL_TYPEApplicationMetrology libraryControls to metrology DSP
DSP_ST_TYPEMetrology libraryApplicationStatus from metrology DSP
DSP_ACC_TYPEMetrology libraryApplicationMeasurements from metrology DSP
DSP_HAR_TYPEMetrology libraryApplicationHarmonic data from metrology DSP

For additional information regarding the metrology registers, read the Microchip “PIC32CXMTx Metrology User Guide” and the Microchip “PIC32CXMTx Metrology Data Sheet”.