S32K ADC Hardware trigger Processor expert configuration

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

S32K ADC Hardware trigger Processor expert configuration

678 Views
saireddy_saredd
Contributor III

Hallo,

Currently, We configured ADC1 with ADC PAL for two channels group conversion with Processor expert. Unfortunately, We are not using anymore the processor expert and want to configure the ADC0 for continuous conversion either same like ADC PAL group conversion or Hardware conversion.

I just copied the code which is configured for ADC1 and renamed some variable. I am not getting the ADC values in the call back function. Let me know what I did wrong with configuration.

 

Attachements:

Pal: Generated PAL folder

cp_adc.c and cp_adc.h : ADC1 configuration

pp_adc.c and pp_adc.h: ADC0 configuration

 

 

 

ADC Initialization:  
//Initialize ADC1
    ADC_Init(&cp_adc_instance, &g_cp_adc_InitConfig0);
    
    ADC_EnableHardwareTrigger(&cp_adc_instance, 0u);


    //Initialize ADC1
    ADC_Init(&pp_adc_instance, &g_pp_adc_InitConfig0);
    
    ADC_EnableHardwareTrigger(&pp_adc_instance, 0u);

 

 

 

ADC1 call back function getting correct values and ADC0 call back function not getting any values.

Here my main aim is continuously get the 4 values of ADC0 and make average later in the code implementation.

Do I need to use only group conversion to convert the values without software trigger?

 

 

Call Back functions
/**
 *  @brief Interrupt when ADC data is available.
 *   callbackInfo, userData unused
 */
void cp_adc_data_ready_cb(const adc_callback_info_t * const callbackInfo, void * userData)
{
    (void)callbackInfo;
    (void)userData;
    
    g_positive_peak_raw_hist[g_peak_voltage_index] = cp_adc_Results00[0];
    g_negative_peak_raw_hist[g_peak_voltage_index] = cp_adc_Results00[1];
    
    g_peak_voltage_index++;
    g_peak_voltage_index %= CP_HISTORY_LEN;
}

/**
 *  @brief Interrupt when ADC data is available.
 *   callbackInfo, userData unused
 */
void pp_adc_data_ready_cb(const adc_callback_info_t * const callbackInfo, 
void * userData)
{
    (void)callbackInfo;
    (void)userData;
    
    g_proximity_raw_hist[g_proximity_index] = pp_adc_Results00[0];
    
    g_proximity_index++;
    g_proximity_index %= PP_HISTORY_LEN;
}

 

 

 

Best Regards,

Sai

 

@PetrS 

 

0 Kudos
Reply
2 Replies

590 Views
saireddy_saredd
Contributor III

Thanks @PetrS 

I fixed the issue

0 Kudos
Reply

660 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

hard to say based on the attached files. If you want to perform multiple conversions on single or dual ADCs it would be ideal to reuse the PDB module to trigger conversions. There are few example posted on community you can refer to...
baremetal: 
Example S32K144 PDB ADC trigger DMA ISR S32DS - NXP Community

SDK based: 
Example S32K144 PDB ADC DMA S32DS.ARM.2018.R1 - NXP Community
Example S32K148 PDB0-PDB1 ring S32DS3.4 RTM4.0.3 - NXP Community
Example S32K148 PDB0-PDB1 ring DMA S32DS3.4 RTM4.0... - NXP Community  

BR, Petr



 

0 Kudos
Reply