TI's SDK for the MSPM0 family has a set of examples. They are all targeting one of their LaunchPad dev kits. In this post, I'm porting another one to the EasyL1105.
The example, adc14_14bit_resolution, uses hardware to oversample the 12 bit onboard ADC. And DMA to retrieve 1024 samples. It goes in low power mode while sampling is happening. It's originally written for the LP-MSPM0L1117 LaunchPad. I'm porting it (just like I did in Port an SDK example to the EasyL1105 MSPM0 board).
What does it do?
The design uses the 12 bit ADC peripheral options to oversample to 14 bits:
From the readme:
ADC12 Hardware averaging is configured to accumulate 16 samples and divide by 4 to achieve 14-bit effective resolution.
Use DMA to get 1024 samples - in low power mode. The selected input is ADC channel 2. On the EasyL1105, this is J2.9.
While ADC and DMA are doing their work in the background, we allow the controller to poll for completeness in a power saving mode:
DL_ADC12_startConversion(ADC12_0_INST); while (false == gCheckADC) { __WFE(); }
The WFE arm assembler instruction A usage for WFE is to put it into a spinlock loop. ... To save power, you can insert the WFE instruction into the loop so the CPUs instead of looping continuously will enter STANDBYWFE. |
The gCheckADC flag gets set in the ADC interrupt handler, when DMA has finished loading 1024 samples:
void ADC12_0_INST_IRQHandler(void) { switch (DL_ADC12_getPendingInterrupt(ADC12_0_INST)) { case DL_ADC12_IIDX_DMA_DONE: gCheckADC = true; break; default: break; } }
The ccs project with source and config files is attached. Thank you for reading.
ccs project adapted to EasyL1105: 3704.adc12_14bit_resolution_EasyL1105_20250923.zip