===========================================================================================================
                          ADC 1Msps sampling rate power save example.
===========================================================================================================
Copyright(C) Redpine Signals 2016
All rights reserved by Redpine Signals.

This program should be used on your own responsibility.
Redpine Signals assumes no responsibility for any losses
incurred by customers or third parties arising from the use of this file. 

===========================================================================================================

===========================================================================================================                                                       
Function description:
===========================================================================================================
This example demonstrate ADC power consumption for single channel data acquisition with 1Msps sampling rate.
Here ADC internal DMA use for data collection from ADC FIFO.Following configuration used in application,
1.Sampling rate : 1Msps.
2.Input type    : Single ended.
3.Positive input to ADC : ULP_GPIO4
4.Negative input to ADC : ULP_GPIO5,For single ended data acquisition this parameter not used.
5.Reference Voltage     : 3.2V (Bypass LDO)(To change reference voltage modify 'vref_value' variable #line31)
6.Number of sample collection for each interrupt : 1023
7.ADC output memory  : Ping memory : 0x24060800
                       Pong memory : 0x24060800 + (Number of sample collection for each interrupt * 2)
===========================================================================================================
Environment
===========================================================================================================
Test Board:
---------------------
Smark EVK Rev1.2

Assistance software:
---------------------
None

===========================================================================================================
Usage Procedure:
===========================================================================================================
Compile and Run the example.
In single ended mode give the input to ULP_GPIO_4 and in differential ended mode give positive 
input to ULP_GPIO4 and negative input to ULP_GPIO5.
===========================================================================================================
Pass criteria:
===========================================================================================================
This example demonstrate power consumption of ADC in 1ksps as sampling rate.
1. Power pass criteria : 
   a.Define "DONOT_READ_DATA_FROM_MEM" macro in (Options for Target --> C/C++ -->Define)  
     M4 will not read the ADC samples for memory.
   b.Disable the 'ENOB' macro (In adc_1ksps_power_save.c #30)
   Use the "JP40" jumper on EVK to change the chip supply 3.2 to 1.8v.
   Result :   
   1.ADC 1Msps power consumption(Input supply for chip 3.2v)  : 667uA            
   2.ADC 1Msps power consumption(Input supply for chip 1.8v)  : 982uA          

2. Performance pass criteria : For verifying performance follow below step ,
   a.Enable the 'ENOB' macro (In adc_1ksps_power_save.c #30)   
   b.Disable or remove "DONOT_READ_DATA_FROM_MEM" macro form (Options for Target --> C/C++ -->Define)  
     M4 will read the ADC samples for memory.
   c.Apply the following configuration input waveform from waveform generator to ADC. 
     1]Differential Mode(3.2) 
	    1.Vpp(Magnitude)  : (3.2*0.6) = 1.92V
        2.Vcm(Offset)     : (3.2*0.5) = 1.6V
        3.Input frequency : 100Khz  	 
     2]Differential Mode(1.8) 
	    1.Vpp(Magnitude)  : (1.8*0.6) = 1.08V
        2.Vcm(Offset)     : (1.8*0.5) = 0.9V
        3.Input frequency : 100Khz  
     3]Single ended Mode(3.2)
 	    1.Vpp(Magnitude)  : (3.2)     = 3.2V
        2.Vcm(Offset)     : (3.2*0.5) = 1.6V
        3.Input frequency : 100Khz 
     4]Single ended Mode(1.8)
 	    1.Vpp(Magnitude)  : (1.8)     = 1.8V
        2.Vcm(Offset)     : (1.8*0.5) = 0.9V
        3.Input frequency : 100Khz 		 
   d.Apply the FFT on adc_output buffer samples.   
   e.After apply FFT following SNR will get form application 
        1.Differential ended SNR(Input supply for chip 3.2v )    : 55dB 
        2.Single ended SNR(Input supply for chip 3.2v )          : 51dB 		
		3.Differential ended SNR(Input supply for chip 1.8v )    : 54dB 
	    4.Single ended SNR(Input supply for chip 1.8v )          : 49dB 		     	
===========================================================================================================
Note
===========================================================================================================
1]For power consumption measurement 
   a.Enable "DONOT_READ_DATA_FROM_MEM"(in rsi_adc.h) macro or define in (Options for Target --> C/C++ -->Define)  
     M4 will not read the ADC samples for memory.
   b.Disable the 'ENOB' macro (In adc_1ksps_power_save.c #30)   
2]For performance measurement 
   a.Enable the 'ENOB' macro (In adc_1ksps_power_save.c #30)   
   b.Disable "DONOT_READ_DATA_FROM_MEM"(in rsi_adc.h) macro or remove form (Options for Target --> C/C++ -->Define)  
     M4 will read the ADC samples for memory.
For both cases make sure 'GAIN_OFFSET_CAL_EN' macro not enable.
===========================================================================================================