Hi Xioabin,
- Your adc_csl contains these commands: 0x00CDA000 and 0x00CCA000. There missing command which is marked as “End Of List”. So, ADC do not know where should finish with conversion sequence. Therefore the last command should be probably 0xC0CCA000. See more in chapter 9.4.2.15 ADC Command Register 0 (ADCCMD_0) in RM.
- You placed adc_csl into ADC_COMMAND user segment, however I do not see such segment definition in your prm file.
For correct work of ADC DMA, the command list and result list must by aligned to 4 byte boundary.
I would like to recommend declare adc_csl[] and adc_result[] as:
//Command and result list have to be aligned - Base Pointer Register[1,0]=0;
const dword adc_csl[] __attribute__ ((aligned (4))) { //max 256 bytes = 64 commands per 4-byte entries
//...
word adc_result[] __attribute__ ((aligned (4))) { //max 128 bytes = 64 results per 2-byte entries
//...
In that case, you don’t need explicitly specify where command and result will be placed. Linker will place these object automatically.
Since these lists may not be accessed directly in code, I would like to recommend place their names into ENTRIES section in prm linker file for avoid to optimize out it as unused objects. For example:
ENTRIES /* keep the following unreferenced variables */
adc_csl, adc_result
END
In attachment is simple ADC example code S12ZVL.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------