Reaching 160K SPS on ADuCM350

The DFT samples per second is very slow for my needs, so I thought to myself to take the raw data (ADC) via USB to a pc (using a log file). I managed to do it.
However, I can't pass the 60k samples per second, while there is a claim that ADUCM350 is able to achieve 160K samples per second. How can I increase the SPS?

This is the code I'm working with:

#ifdef _MISRA_RULES
#pragma diag(push)
#pragma diag(suppress:misra_rules_all:"suppress all MISRA rules for test")
#endif /* _MISRA_RULES */


#include <stdio.h>
#include <string.h>

#include "test_common.h"

#include <ADuCM350_device.h>

#include "afe.h"
#include "afe_lib.h"
#include "uart.h"


#if defined ( __ICCARM__ ) // IAR compiler...
/* Apply ADI MISRA Suppressions */
#define ASSERT_ADI_MISRA_SUPPRESSIONS
#include "misra.h"
#endif

#define BUFFER_SIZE 6

/* Rx and Tx buffers */
//static uint8_t RxBuffer[BUFFER_SIZE];
static uint8_t TxBuffer[BUFFER_SIZE];


/* Macro to enable the returning of AFE data using the UART */
/* 1 = return AFE data on UART */
/* 0 = return AFE data on SW (Std Output) */
#define USE_UART_FOR_DATA (1)

/* Helper macro for printing strings to UART or Std. Output */
#define PRINT(s) test_print(s)

/* The duration (in us) to measure from the auxilliary channel */
#define DUR ((uint32_t)(100000))
//#define DUR ((uint32_t)(1000000))

/* Select Aux Channel: AN_A, AN_B, AN_C, AN_D */
#define ADC_MUX_SEL (ADI_AFE_ADC_MUX_SEL_AN_B)

/* Enable/Disable ANEXCITE switch (0 = disable, 1 = enable) */
#define ANEXCITESW_EN (1)

/* Select ADC Gain and Offset (TIA, Aux, Temp Sense, Aux) */
#define ADC_GAIN_OFFS (ADI_AFE_ADC_GAIN_OFFS_AUX)

/* DO NOT EDIT: macro to set the value of the AFE_ADC_CFG register */
/* based on inputs above. */
#define ADC_CFG_REG_DATA ((ADC_MUX_SEL << BITP_AFE_AFE_ADC_CFG_MUX_SEL) +\
(ANEXCITESW_EN << BITP_AFE_AFE_ADC_CFG_ANEXCITESW_EN) +\
(ADC_GAIN_OFFS << BITP_AFE_AFE_ADC_CFG_GAIN_OFFS_SEL))

/* DO NOT EDIT: Calculate number of samples for sequence size */
/* SAMPLE_COUNT = (Duration)us * (160k/178)samples/s */
//#define SAMPLE_COUNT (uint32_t)((2 * DUR) / 2225) // 2247 samples at 2.5secs (DUR time)
//#define SAMPLE_COUNT (uint32_t)((2 * DUR) / 20) // ~54K samples at 2.5secs (DUR time) about 20Ksps
#define SAMPLE_COUNT (uint32_t)(6500) // SAMPLE_COUNT = (Duration)us * (160k)samples/s

/* Number of samples per DMA transfer. Max of 1024. */
#define DMA_BUFFER_SIZE (1024u)

/* DO NOT EDIT: Maximum printed message length. Used for printing only. */
#define MSG_MAXLEN (50)

#define BUFF_NUM (6)

#pragma location="volatile_ram"
uint16_t dmaBuffer[DMA_BUFFER_SIZE * 2];

uint32_t count = 0;
#pragma location="volatile_ram"
uint16_t adc[BUFF_NUM][DMA_BUFFER_SIZE]={0};

/* Sequence for Auxilliary Channel measurement */
uint32_t seq_afe_auxmeas[] = {
0x000900F3, /* 0 - Safety Word, Command Count = 9, CRC = 0xF3 */
0x84003818, /* 1 - AFE_FIFO_CFG: DATA_FIFO_SOURCE_SEL = 0b01 (ADC) */
0x00000640, /* 2 - Wait: 100 us */
0xA0000228, /* 3 - AFE_ADC_CFG: MUX_SEL = 0b01001 (AN_B), GAIN_OFFS_SEL = 0b10 (AUX) */
0x00000640, /* 4 - Wait: 100us */
0x800201B0, /* 5 - AFE_CFG: ADC_CONV_EN = 1 ADC_EN = 1 */
0x00000000, /* 6 - Wait: DUR (placeholder, user programmable) */
0x800200B0, /* 7 - AFE_CFG: ADC_CONV_EN = 0, ADC_EN = 1 */
0xA0000200, /* 8 - AFE_ADC_CFG: MUX_SEL = 0b00000, GAIN_OFFS_SEL = 0b10 (AUX) */
0x82000002, /* 9 - AFE_SEQ_CFG: SEQ_EN = 0 */
};

/* Variables and functions needed for data output through UART */
ADI_UART_HANDLE hUartDevice = NULL;

/* Function prototypes */
void test_print (char *pBuffer);
ADI_UART_RESULT_TYPE uart_Init (void);
ADI_UART_RESULT_TYPE uart_UnInit (void);
extern int32_t adi_initpinmux (void);
void RxDmaCB (void *hAfeDevice,
uint32_t length,
void *pBuffer);

int main(void) {
ADI_AFE_DEV_HANDLE hAfeDevice;

/* Initialize system */
SystemInit();

/* Change the system clock source to HFXTAL and change clock frequency to 16MHz */
/* Requirement for AFE (ACLK) */
SystemTransitionClocks(ADI_SYS_CLOCK_TRIGGER_MEASUREMENT_ON);

/* SPLL with 32MHz used, need to divide by 2 */
SetSystemClockDivider(ADI_SYS_CLOCK_UART, 2);

/* Test initialization */
test_Init();

/* Initialize static pinmuxing */
adi_initpinmux();

/* Initialize the UART for transferring measurement data out */
if (ADI_UART_SUCCESS != uart_Init())
{
FAIL("uart_Init");
}

/* Initialize the AFE API */
if (ADI_AFE_SUCCESS != adi_AFE_Init(&hAfeDevice))
{
FAIL("adi_AFE_Init");
}

/* AFE power up */
if (ADI_AFE_SUCCESS != adi_AFE_PowerUp(hAfeDevice))
{
FAIL("adi_AFE_PowerUp");
}

/* Aux Channel Calibration */
if (ADI_AFE_SUCCESS != adi_AFE_AuxChanCal(hAfeDevice))
{
FAIL("adi_AFE_AuxChanCal");
}

#if (ADI_AFE_CFG_ENABLE_RX_DMA_DUAL_BUFFER_SUPPORT == 1)
/* Set the Rx DMA buffer sizes */
if (ADI_AFE_SUCCESS != adi_AFE_SetDmaRxBufferMaxSize(hAfeDevice, DMA_BUFFER_SIZE, DMA_BUFFER_SIZE))
{
FAIL("adi_AFE_SetDmaRxBufferMaxSize");
}
#endif /* (ADI_AFE_CFG_ENABLE_RX_DMA_DUAL_BUFFER_SUPPORT == 1) */

/* Register Rx DMA Callback */
if (ADI_AFE_SUCCESS != adi_AFE_RegisterCallbackOnReceiveDMA(hAfeDevice, RxDmaCB, 0))
{
FAIL("adi_AFE_RegisterCallbackOnReceiveDMA");
}

/* Configure the AFE_ADC_CFG register */
seq_afe_auxmeas[2] = SEQ_MMR_WRITE(REG_AFE_AFE_ADC_CFG, ADC_CFG_REG_DATA);

/* Set the duration of the measurement in ACLK periods */
seq_afe_auxmeas[6] = (DUR * 16); // configure # of clk cycles wait of DUR in usec using 16MHz clock

/* Recalculate CRC in software for the amperometric measurement */
adi_AFE_EnableSoftwareCRC(hAfeDevice, true);
while (1) //////////////////// continous sequence //////////////////
{count = 0;
/* Perform the Aux Channel measurement(s) */
if (ADI_AFE_SUCCESS != adi_AFE_RunSequence(hAfeDevice, seq_afe_auxmeas, (uint16_t *) dmaBuffer, SAMPLE_COUNT))
{
FAIL("adi_AFE_RunSequence(seq_afe_auxmeas)");
}

uint16_t j,k;
int16_t txSize0 = 6;
char msg4[MSG_MAXLEN];
char msg8[MSG_MAXLEN];
sprintf(msg8, "%02u\n", count);

for (j = 0; j < BUFF_NUM; j++)
{
for (k = 0; k < DMA_BUFFER_SIZE; k++)
{
sprintf(msg4, "%u\r\n",adc [j][k]);

//transmit the character
TxBuffer[0] = msg4[0];
TxBuffer[1] = msg4[1];
TxBuffer[2] = msg4[2];
TxBuffer[3] = msg8[0];
TxBuffer[4] = msg8[1];
TxBuffer[5] = '\n';
adi_UART_BufTx(hUartDevice, TxBuffer, &txSize0); }
}
} //////////////////////////////////////////////////////////
/* Restore to using default CRC stored with the sequence */
adi_AFE_EnableSoftwareCRC(hAfeDevice, false);

/* AFE Power Down */
if (ADI_AFE_SUCCESS != adi_AFE_PowerDown(hAfeDevice))
{
FAIL("adi_AFE_PowerDown");
}

/* Unregister Rx DMA Callback */
if (ADI_AFE_SUCCESS != adi_AFE_RegisterCallbackOnReceiveDMA(hAfeDevice, NULL, 0))
{
FAIL("adi_AFE_RegisterCallbackOnReceiveDMA (unregister)");
}

/* Uninitialize the AFE API */
if (ADI_AFE_SUCCESS != adi_AFE_UnInit(hAfeDevice))
{
FAIL("adi_AFE_UnInit");
}

/* Uninitialize the UART */
adi_UART_UnInit(hUartDevice);

PASS();
}

/*!
* @brief AFE Rx DMA Callback Function.
*
* @param[in] hAfeDevice Device handle obtained from adi_AFE_Init()
* length Number of U16 samples received from the DMA
* pBuffer Pointer to the buffer containing the LPF results
*
*
* @details 16-bit results are converted to bytes and transferred using the UART
*
*/
void RxDmaCB(void *hAfeDevice, uint32_t length, void *pBuffer)
{
#if (1 == USE_UART_FOR_DATA)
char msg[MSG_MAXLEN];
char msg0[MSG_MAXLEN];
uint32_t i;
int16_t txSize;

uint16_t *ppBuffer = (uint16_t*)pBuffer;

count++;

txSize = 6u;
/* Check if there are samples to be sent */
if (length)
{
sprintf(msg, "%u\n", *ppBuffer);
sprintf(msg0, "%02u\n", count);

//transmit the character
TxBuffer[0] = msg[0];
TxBuffer[1] = msg[1];
TxBuffer[2] = msg[2];
TxBuffer[3] = msg0[0];
TxBuffer[4] = msg0[1];
TxBuffer[5] = '\n';
adi_UART_BufTx(hUartDevice, TxBuffer, &txSize);

if (count <= BUFF_NUM)
{
for (i = 0; i < length; i++)
{
adc [count-1][i]= *ppBuffer++;
}

}

/*
for (i = 0; i < length; i++)
{
sprintf(msg, "%u\n", *ppBuffer++);
sprintf(msg0, "%03u\n", count);
// sprintf(msg, "%u\n", *ppBuffer);

//transmit the character
TxBuffer[0] = msg[0];
TxBuffer[1] = msg[1];
TxBuffer[2] = msg0[0];
TxBuffer[3] = msg0[1];
TxBuffer[4] = msg0[2];
TxBuffer[5] = '\n';
adi_UART_BufTx(hUartDevice, TxBuffer, &txSize);

}
*/
}

#elif (0 == USE_UART_FOR_DATA)
{ char msg8[MSG_MAXLEN];
uint16_t *ppBuffer = (uint16_t*)pBuffer;
sprintf(msg8, "%u\r\n", *ppBuffer);
PRINT(msg8);
}
#endif /* USE_UART_FOR_DATA */
}

/* Helper function for printing a string to UART or Std. Output */
void test_print (char *pBuffer) {
#if (1 == USE_UART_FOR_DATA)
int16_t size;
/* Print to UART */
size = strlen(pBuffer);
adi_UART_BufTx(hUartDevice, pBuffer, &size);

#elif (0 == USE_UART_FOR_DATA)
/* Print to console */
printf(pBuffer);

#endif /* USE_UART_FOR_DATA */
}

/* Initialize the UART, set the baud rate and enable */
ADI_UART_RESULT_TYPE uart_Init (void) {
ADI_UART_RESULT_TYPE result = ADI_UART_SUCCESS;

/* Open UART in blocking, non-intrrpt mode by supplying no internal buffs */
if (ADI_UART_SUCCESS != (result = adi_UART_Init(ADI_UART_DEVID_0, &hUartDevice, NULL)))
{
return result;
}

/* Set UART baud rate to 115200 */
if (ADI_UART_SUCCESS != (result = adi_UART_SetBaudRate(hUartDevice, ADI_UART_BAUD_115200)))
{
return result;
}

/* Enable UART */
if (ADI_UART_SUCCESS != (result = adi_UART_Enable(hUartDevice,true)))
{
return result;
}

return result;
}

/* Uninitialize the UART */
ADI_UART_RESULT_TYPE uart_UnInit (void) {
ADI_UART_RESULT_TYPE result = ADI_UART_SUCCESS;

/* Uninitialize the UART API */
if (ADI_UART_SUCCESS != (result = adi_UART_UnInit(hUartDevice)))
{
return result;
}

return result;
}


Thanks