Other Parts Discussed in Thread: TMS320F28379D, AMC1204
I am using the AMC1204 and the TMS320F28379D to measure an isolated voltage from +/- 250mV. Everything is working fine and I read the TMS320F28379D's SDFM SDDATA2 register as an int32. As expected, when the input voltage is below 0V, I get a negative number, and when the input voltage is at a voltage above 0V, I get a positive number.
Theoretically if I were to have a 12 bit ADC with a 3 volt voltage reference, I would scale the 0 to 4095 bit register I read by a factor of 3V/4095 bits to get the original voltage. My question is how to scale the voltage "theoretically" from the int32 value I read out of the SDDATA2 register to the input voltage in the +/-250mV range.
I read a 25mV signal and got a corresponding output of 5000 bits (5e-6 V/bit). This is close to +320mV -- full scale range of the AMC1204 -- and 2^16-1 or 65535 bits (4.88e-6 V/bit). These gain values are close, but it doesn't make any sense because I am reading a int32, not a 16 bit value.
If it helps, here is my code to initialize the SDFM below:
//Allocate SDFMs to CPU1 EALLOW; DevCfgRegs.CPUSEL4.bit.SD1 = 0; DevCfgRegs.CPUSEL4.bit.SD2 = 0; EDIS; //Initialize GPIOs for Sigma Delta Inputs EALLOW; GpioCtrlRegs.GPBGMUX2.bit.GPIO59 = 1U; GpioCtrlRegs.GPBMUX2.bit.GPIO59 = 3U; EDIS; EALLOW; GpioCtrlRegs.GPBGMUX2.bit.GPIO58 = 1U; GpioCtrlRegs.GPBMUX2.bit.GPIO58 = 3U; EDIS; //Enable SDFM Module Clocks EALLOW; CpuSysRegs.PCLKCR6.bit.SD1 = 1U; CpuSysRegs.PCLKCR6.bit.SD2 = 1U; EDIS; //Initialize SDFM 2 EALLOW; //SET SDCTLPARM2 //Set Mode of Sigma Delta Filter Module Sdfm2Regs.SDCTLPARM2.bit.MOD = 0U; //SET SDDFPARM2 //Set Data Filter Structure Sdfm2Regs.SDDFPARM2.bit.SST = 2U; //Enable Filter for this Sdfm2Regs.SDDFPARM2.bit.FEN = 1U; //Set Oversampling Ratio to (255 + 1) Sdfm2Regs.SDDFPARM2.bit.DOSR = 255U; //SET SDIPARM2 //Set Width of data field to 32 bit Two's complement Sdfm2Regs.SDIPARM2.bit.DR = 1U; //Disable external filter reset from PWM //Sdfm2Regs.SDDFPARM2.bit.FILRESEN = 0; //SET SDCPARM2 //Enable the modulator clock Sdfm2Regs.SDCPARM2.bit.MFIE = 1; //Enable the Master Interrupt Enable Sdfm2Regs.SDCTL.bit.MIE = 1; //SET SDMFILEN //Set Master Filter Enable Sdfm2Regs.SDMFILEN.bit.MFE = 1U; EDIS;