This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2432: AM2432: ADC sampling time

Part Number: AM2432

Tool/software:

Hello:

I verified the ADC acquisition time by timer, and the result was a little strange.

In one-shot mode, 8 channels are captured, the trigger FIFO threshold is set to 15 (8*2-1), and the time from adc startup to interrupt entry is about 9us.

However, similarly, with the acquisition of 1 channel, the trigger FIFO threshold is set to 1 (1*2-1), and the time from starting adc to entering the interrupt takes about 50us.

My question:

1. Why the collection channel is less, but the time is extended;

2. According to the data manual, the sampling frequency is 4MSPS, please help us to confirm whether the sampling time of 9us is reasonable;

3. Whether there are measures to speed up the sampling time.

My program is as follows,the timing starts and ends at hal_adc_trigger() and  App_adcGetData():

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
uint16_t adc_original_buff[APP_ADC_NUM_CH];
int32_t adc_buff[APP_ADC_NUM_CH];
float curr_result[3];
static HwiP_Object gAdcHwiObject;
HwiP_Params hwiPrms;
volatile uint32_t adc_start_ns = 0;
volatile uint32_t adc_interval_ns = 0;
void App_adcGetData(void)
{
uint32_t voltageLvl;
uint32_t id;
uint32_t baseAddr = CONFIG_ADC0_BASE_ADDR;
uint32_t i = 0;
uint32_t fifoData = 0;
uint32_t fifoWordCnt;
if(is_float_zero(gUserParams_float.adc_gain) == MT_TRUE)
{
gUserParams_float.adc_gain = 0.15f;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hello Walker li,

    I am looking at your queries and you may get reply in one or two days .

    Regards, Anil.

  • Ok, looking forward to your reply.

  • Hello Walker li,

    By default ADC is connecting to 25MHz clock only  .

    Can you please confirm what is the value of ADC clock selection Mux value in your setup ?

    If you change the Mux selection value to 1 then  ADC will run at 60MHz only to get the 4MSPS .

    Try to change the Mux clock selection to 1 from 0 and check the Results  .

    Please look at the image below.

    The Mux clock selection register is a CTRL MMR. So, there is a lock and unlock mechanism for this memory location.

    Once CTRL_MMR is locked , user can't change the Mux selection.

    So, we can go with lock mechanism to change the clock selection and you  can try the code below.

    Please go through chapter  below for more details about lock protection .

    Fullscreen
    1
    2
    3
    4
    /* set ADC clock source */
    SOC_controlModuleUnlockMMR(SOC_DOMAIN_ID_MAIN, 2);
    *(volatile uint32_t*)AddrTranslateP_getLocalAddr(0x43008510U) = 0x01;
    SOC_controlModuleLockMMR(SOC_DOMAIN_ID_MAIN, 2);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Regards,

    Anil.

  • I added the statement as suggested, but the test found that the adc did not run. Do you need to enable PLL clock before running? How can I enable PLL clock?

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    int32_t hal_adc_init(void)
    {
    uint32_t baseAddr = CONFIG_ADC0_BASE_ADDR;
    /* set ADC clock source */
    SOC_controlModuleUnlockMMR(SOC_DOMAIN_ID_MAIN, 2);
    *(volatile uint32_t*)AddrTranslateP_getLocalAddr(0x43008510U) = 0x01;
    SOC_controlModuleLockMMR(SOC_DOMAIN_ID_MAIN, 2);
    App_adcInit(baseAddr);
    App_adcConfig(baseAddr);
    /* Set EOI to generate next interrupt if any */
    ADCWriteEOI(baseAddr);
    App_adcStart(baseAddr);
    return MT_OK;
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    In addition, I found that when the program was running, occasionally adc interrupts would suddenly fail to trigger (it can be observed through ADCREGS_FIFO0WC that adc FIFO can be updated normally), and at this time PWM, ECAP and other interrupts are normal. Could you please tell me the possible causes of this situation, whether it is related to interrupted preemption, and how to avoid or solve it.

  • Hello Walker li,

    I am able to run the properly ADC example after the modyfing the Clock selection.

    We don't need to configure the PLL settings we just need to update the ADC MUX selection.

    Since, all PLL are configured by DMSC software.

    Can you please confirm what the difference is between your code and an example code?

    Regards,

    Anil.

  • Dear Walker.

    would you please check the response from Anil and provide the status on your side?

    thanks a lot!

    yong