Tool/software: Code Composer Studio
Hello.
I use:
UCD3138128A;
Saurus SAU510-USB Iso Plus Emulator;
CCS v.7.4.
I configure the Front End module in SAR mode, or in any other. The RAW_ERROR_VALUE is equal to the maximum possible at any AFE_GAIN, and does not depend on the DAC value or the output voltage.
If I do not address to registers of the module in program, then in debug mode I see the default settings. If I manually configure the module in this mode, it works in all FE modes.
But if I configure the module with the help of the program code, all registers of the FE module are filled with 0x0, after that all the necessary bits are set.
The module does not work correctly. RAW_ERROR_VALUE = 0xF8, and does not depend on the DAC value or the output voltage.
#define MAIN (1)
#include "include.h"
Uint32 PRD = 0x3FFFF;
void DPWM0(void)
{
Dpwm0Regs.DPWMCTRL0.bit.PWM_EN = 0;
Dpwm0Regs.DPWMCTRL0.bit.CLA_EN = 0;
Dpwm0Regs.DPWMPRD.all = PRD;
Dpwm0Regs.DPWMEV1.all = 0;
Dpwm0Regs.DPWMEV2.all = PRD/2;
Dpwm0Regs.DPWMEV3.all = PRD/2;
Dpwm0Regs.DPWMEV4.all = PRD;
Dpwm0Regs.DPWMSAMPTRIG1.all = PRD/2;
Dpwm0Regs.DPWMCTRL2.bit.SAMPLE_TRIG_1_EN = 1;
Dpwm0Regs.DPWMCTRL0.bit.PWM_EN = 1;
}
void EADC(void)
{
union EADCCTRL_REG eadc_ctrl;
// eadc_ctrl.all = 0;
eadc_ctrl.bit.EADC_MODE = 2;
eadc_ctrl.bit.AFE_GAIN = 0;
eadc_ctrl.bit.SCFE_GAIN_FILTER_SEL = 1;
eadc_ctrl.bit.SCFE_CLK_DIV_2 = 1;
eadc_ctrl.bit.SCFE_ENA = 1;
eadc_ctrl.bit.EADC_ENA = 1;
FeCtrl1Regs.EADCCTRL = eadc_ctrl;
}
void LoopMux(void)
{
LoopMuxRegs.SAMPTRIGCTRL.bit.FE1_TRIG_DPWM0_EN = 1;
LoopMuxRegs.FECTRL1MUX.bit.DPWM0_FRAME_SYNC_EN = 1;
union GLBEN_REG glben_store;
glben_store.all = 0;
glben_store.bit.DPWM0_EN = 1;
glben_store.bit.DPWM1_EN = 1;
glben_store.bit.FE_CTRL1_EN = 1;
LoopMuxRegs.GLBEN = glben_store;
}
void main()
{
// ###################### WARNING!!!! LOOK AT THIS #######################
MiscAnalogRegs.IOMUX.all = 0;
// #######################################################################
EADC();
DPWM0();
LoopMux();
while(1)
{
}
}
void c_int00(void)
{
main();
}
I tried to start the module in Continuous SAR mode, which does not require the participation of the Sample Trigger. But the result is the same as in the previous case.
Thank you.