Other Parts Discussed in Thread: MSPM0G3507, SEGGER
Hi,
I am implementing support for reading ADCs on a MSPM0G3507 MCU (silicon version PG1).
I am using DL_ADC12_initSeqSample() and configure a total of 10 ADC values to read using DL_ADC12_configConversionMem().
ADC0 is configured to use A0_0 (MEM_IDX_0) , A0_1(MEM_IDX_1) , A0_2 (MEM_IDX2), A0_3(MEM_IDX_3) and A0_7(MEM_IDX_4).
ADC1 is configured to use A1_0 (MEM_IDX_0) , A1_1(MEM_IDX_1) , A1_2 (MEM_IDX2), A1_3(MEM_IDX_3) and A1_7(MEM_IDX_4).
For ADC0 i configure the following sequential sample:
DL_ADC12_initSeqSample(ADC0, DL_ADC12_REPEAT_MODE_ENABLED, DL_ADC12_SAMPLING_SOURCE_AUTO, DL_ADC12_TRIG_SRC_EVENT, DL_ADC12_SEQ_START_ADDR_00, DL_ADC12_SEQ_END_ADDR_04, DL_ADC12_SAMP_CONV_RES_12_BIT, DL_ADC12_SAMP_CONV_DATA_FORMAT_UNSIGNED);
And then I configure 5 conversion memory using e.g for A0_0:
DL_ADC12_configConversionMem(ADC0, DL_ADC12_MEM_IDX_0, DL_ADC12_INPUT_CHAN_0, DL_ADC12_REFERENCE_VOLTAGE_VDDA, DL_ADC12_SAMPLE_TIMER_SOURCE_SCOMP0, DL_ADC12_AVERAGING_MODE_DISABLED, DL_ADC12_BURN_OUT_SOURCE_DISABLED, DL_ADC12_TRIGGER_MODE_AUTO_NEXT, DL_ADC12_WINDOWS_COMP_MODE_DISABLED);
When the DL_ADC12_IIDX_MEM4_RESULT_LOADED interrupt is triggered for ADC0 I read (from the main loop. Not from the interrupt) the ADC values using DL_ADC12_getMemResult().
The problem I have seen, and the reason I am writing in this forum is that sometimes the wrong ADC values are read using DL_ADC12_getMemResult().
E.g if I apply 3.3V to ADC0_3 that on the MCU, the result sometimes ends up in the result read for ADC0_0. And sometimes (after a reboot) the result ends up in ADC0_3 as it should.
What could be causing this behaviour?
/Regards, Jens