How to make the ADC sampling rate of qn9080 reach 25kbps.

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

How to make the ADC sampling rate of qn9080 reach 25kbps.

613 Views
shenzhongyi8
Contributor I

How to make the ADC sampling rate of qn9080 reach 25kbps.

I read the datasheet that ADC sampling rate can reach 32kbps.

But I don't know how to set it.who can provide a example for me.

or tall me how to chage,

this is my change example code ,but it cannot reach 25Kbps

/* Configure DMA. */
DMA_Init(DMA0);
DMA_EnableChannel(DMA0, SENSOR_DMA_CHANNEL);
DMA_CreateHandle(&g_adcDmaHandle, DMA0, SENSOR_DMA_CHANNEL);
DMA_SetCallback(&g_adcDmaHandle, ADC_ConvertDMACallback, NULL);
DMA_PrepareTransfer(&transferConfig, (void *)&ADC->DATA, Adcbuff_A, sizeof(uint32_t), 1024,kDMA_PeripheralToMemory, &g_pingpong_desc[1]);
DMA_SubmitTransfer(&g_adcDmaHandle, &transferConfig);
transferConfig.xfercfg.intA = false;
transferConfig.xfercfg.intB = true;
DMA_CreateDescriptor(&g_pingpong_desc[1], &transferConfig.xfercfg, (void *)&ADC->DATA, &Adcbuff_B, &g_pingpong_desc[0]);
transferConfig.xfercfg.intA = true;
transferConfig.xfercfg.intB = false;
DMA_CreateDescriptor(&g_pingpong_desc[0], &transferConfig.xfercfg, (void *)&ADC->DATA, &Adcbuff_A,&g_pingpong_desc[1]);

 DMA_StartTransfer(&g_adcDmaHandle);

/**
* Initial ADC to default configuration.
*/
ADC_GetDefaultConfig(&adcConfigStruct);
adcConfigStruct.channelEnable = (1U << SENSOR_ACC_CHANNEL);
adcConfigStruct.channelConfig = (SENSOR_ADC_CFG_IDX << SENSOR_ACC_CHANNEL);
adcConfigStruct.triggerSource = kADC_TriggerSelectPWMOUT0;
adcConfigStruct.convMode = kADC_ConvModeSingle;
adcConfigStruct.clock = kADC_Clock2M;
ADC_Init(ADC, &adcConfigStruct);

/* Initial ADC Sigma Delta(SD) configuration */
ADC_GetSdDefaultConfig(&adcSdConfigStruct);
adcSdConfigStruct.downSample=kADC_DownSample32;
ADC_SetSdConfig(ADC, SENSOR_ADC_CFG_IDX, &adcSdConfigStruct);

/* Bandgap voltage */
mAdcBandgap = ADC_GetBandgapCalibrationResult(ADC, SENSOR_ADC_CFG_IDX);

/* Calibration VINN value */
mAdcVinn = ADC_GetVinnCalibrationResult(ADC, &adcConfigStruct);


/* Enable ADC */
ADC_Enable(ADC, true);


SCTIMER_GetDefaultConfig(&sctimerInfo);

/* Initialize SCTimer module */
SCTIMER_Init(SCT0, &sctimerInfo);

/* Configure first PWM with frequency 24kHZ from output 4 */
pwmParam.output = kSCTIMER_Out_0;
pwmParam.level = kSCTIMER_HighTrue;
pwmParam.dutyCyclePercent = 50;
if (SCTIMER_SetupPwm(SCT0, &pwmParam, kSCTIMER_CenterAlignedPwm, 25000U, CLOCK_GetFreq(kCLOCK_ApbClk), &event) == kStatus_Fail)
{
return -1;
}


/* Start the timer */
SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_L);

Labels (2)
0 Kudos
1 Reply

517 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

Could you please help me checking this other post ?

https://community.nxp.com/thread/479675 

I believe that you can use that post as a guide to what you are trying to achieve

Regards,

Estephania

0 Kudos