AnsweredAssumed Answered

ADuCM350 - Processing large number of raw ADC reading at 160kSPS

Question asked by Tomo1 Employee on Jun 26, 2017
Latest reply on Jul 20, 2017 by mark.ramos

Hi,

 

I am trying to read raw ADC code at 160kSPS with ADuCM350 and process it in RxDmaCB function. I use following sequence to stream ADC code into DMA:

 

seq_afe_raw_adc_read = {

0x000A00B2, /* 0 - Safety Word, Command Count = 9, CRC = 0xB2 */
0x84003818, /* 1 - AFE_FIFO_CFG: DATA_FIFO_DMA_REQ_EN = 1 DATA_FIFO_SOURCE_SEL = 0b00 CMD_FIFO_DMA_REQ_EN = 1 CMD_FIFO_EN = 1 DATA_FIFO_EN = 1 */
0x00000640, /* 2 - Wait: 100us */
0x8600FFFF, /* 3 - all SW open */
0xA0000228, /* 4 - AFE_ADC_CFG: MUX_SEL = 01000(AN_A and V_BIAS) GAIN_OFFS_SEL = 0 ANEXCITESW_EN = 0 */
0x00000640, /* 5 - Wait: 100 us */
0x800201B0, /* 6 - AFE_CFG: ADC_CONV_EN = 1 SUPPLY_LPF_EN = 1 */
0x00000000, /* 7 - Wait: placcholder replaced based on number of samples */
0x800200B0, /* 8 - AFE_CFG: ADC_CONV_EN = 0 SUPPLY_LPF_EN = 0 */
0xA0000200, /* 9 - AFE_ADC_CFG: MUX_SEL = 0 ANEXCITESW_EN = 0 */
0x82000002 /* 10 - AFE_SEQ_CFG: SEQ_EN = 0 */

}

I run adi_AFE_RunSequence(hDevice, seq_afe_ac_vol_rms, (uint16_t *)dmaBuffer,AC_SAMPLE_SIZE), where dmaBuffer size is 1024 and AC_SAMPLE_SIZE = DMA_BUFFER_SIZE(1024) * NUMBER_OF_DMA.

 

 RxDmaCB function is defined as following:

 

void RxDmaCB(void *hAfeDevice, uint32_t length, void *pBuffer)
{
char msg[MSG_MAXLEN];
uint32_t i;
uint16_t *ppBuffer = (uint16_t*)pBuffer;
uint16_t vol_code_temp[DMA_BUFFER_SIZE];
float32_t rms_vol_temp[1];
/* Check if there are samples to be sent */
if (length)
{
for (i = 0; i < length; i++)
{
vol_code_temp[i] = *ppBuffer++;
}
get_rms_vol(vol_code_temp,rms_vol_temp,DMA_BUFFER_SIZE);

}
sprintf(msg, "%u\r\n", length);
printf(msg);
sprintf(msg, "%f\r\n", rms_vol_temp[0]);
printf(msg);
}

DMA is initialized and Rx DMA buffer size and Rx DMA call function is set and registered in the same way as Amperimetric example.

 

When I run the program with NUMBER_OF_DMA = 2, it runs properly, but when NUMBER_OF_DMA is greater than 2, the program stops after the RxDmaCB function is called twice. Is there any thought why this occurs?

 

If this issue is hard to solve, is there any way that I process around 10000 consecutive raw ADC samples on ADuCM350?

 

Thanks!

Tomohiro

Outcomes