ADC conversion for S12ZVML128

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC conversion for S12ZVML128

920 Views
pratibhasurabhi
Contributor V

I have to do ADC conversion.

i am declaring ADC command list as ADC1CommandList[1][4] = {{0xC0,0x00,0x00,0x00}};

In initADC function i have initialized all required registers of ADC1.

I have created get ADC(uint8_t channel no) function , in this function I am filling command list with channel number(passed in argument of function) and after that i have triggered the restart event.Even after end of list interrupt flag in ADC1CONIF register gets set there is no result in ADCresult list.could you please provide me the solution for this?

Labels (1)
0 Kudos
3 Replies

505 Views
RadekS
NXP Employee
NXP Employee

Hi PRATIBHA,

Please look at simple example code here:

https://community.nxp.com/docs/DOC-332475

I used ADC0FLWCTL_TRIG bit as a trigger for new ADC conversion.

 

Please be aware that loading commands from command list and storing results into result list is managed by internal DMA mechanism. Therefore the command and results lists must be aligned to the 4 byte boundary. For example:

volatile unsigned long adc0_cmdlist[NR_A_CH] __attribute__ ((aligned (4))); //max 256 bytes = 64 commands per 4-byte entries

volatile unsigned int adc0_results[NR_A_CH] __attribute__ ((aligned (4)));  //max 128 bytes = 64 results per 2-byte entries

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

505 Views
pratibhasurabhi
Contributor V

I have referred the sample code you mentioned.

Please see the question regarding The ADC conversion which is asked by me on community.

And please tell me what is the mistake in that code?

0 Kudos

505 Views
RadekS
NXP Employee
NXP Employee

Hi PRATIBHA,

I suppose that you mean your thread here:

https://community.nxp.com/message/871165

Have a great day,
Radek

0 Kudos