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.
| Buffer name | From | To | Notes |
|---|---|---|---|
| DSP_CTRL_TYPE | Application | Metrology library | Controls to metrology DSP |
| DSP_ST_TYPE | Metrology library | Application | Status from metrology DSP |
| DSP_ACC_TYPE | Metrology library | Application | Measurements from metrology DSP |
| DSP_HAR_TYPE | Metrology library | Application | Harmonic 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”.
