Part Number: AM6548
Hello,
I'm trying to get ADC running on AM65xx_IDK Eval Board. For now I only found an example in <pdk>/packages/ti/diag/adc. Are there any other sources or even binaries? I cannot make this example to get any binary for debugging.
Until now I do the following in my source code (the code is mostly copied from <pdk>/packages/ti/diag/adc/src/adc_test_v2.c :
- call "BoardDiag_initADC" with the base address of ADC0. Which itself calls ADCClearIntrStatus() , ADCPowerUp(baseAdr,True) & ADCInit(baseAddress, FALSE, 0U, 0U)
- call ADCEnableIntr(adcBaseConf.baseAddress, (ADC_INTR_SRC_END_OF_SEQUENCE | ADC_INTR_SRC_OUT_OF_RANGE))
call
adcConfig.mode = ADC_OPERATION_MODE_SINGLE_SHOT;
adcConfig.openDelay = 0x1U;
adcConfig.sampleDelay = 0U;
adcConfig.rangeCheckEnable = 0U;
adcConfig.averaging = ADC_AVERAGING_NONE;
adcConfig.fifoNum = ADC_FIFO_NUM_0;
adcConfig.channel = static_cast<uint32_t>(channel);
configStatus = ADCSetStepParams(adcBaseConf.baseAddress,
adcConfig.channel, &adcConfig);
where channel is the channel I want to read. For beginning I want to read only one channel
Then I get to start conversion:
- call ADCStepEnable(baseAddress, channel, TRUE); adcStart(baseAddress);
After that and some time I want to read the value:
- call
intrStatus = ADCGetIntrStatus(adc[i].baseAddress);
while(!(ADC_INTR_SRC_END_OF_SEQUENCE == (intrStatus & ADC_INTR_SRC_END_OF_SEQUENCE)))
{
intrStatus = ADCGetIntrStatus(.baseAddress);
}
fifoWordCnt = ADCGetFIFOWordCount(baseAddress, ADC_FIFO_NUM_0);
fifoData = ADCGetFIFOData(baseAddress, ADC_FIFO_NUM_0);
Is this implementaion correct? Or do I need to call something else?
Wiring:
I connected the middle pin of a poti to ADC0_Ch0. Poti is connected to GNC and 1.8V. For now I don't have a reference voltage connected. Poti is configured to provide something in the middle between GND & 1.8V.
Is it necessary to connect reference voltage to the pin header? Or does the SoC get some reference voltages internaly?
I assume I should get at least some changes in the digits. But I get only 0 or FFF depending of the poti state. But it is more like a hysteresis.
Also I don't understand the "Steps" of ADC. Whats is that in this case? Are these the channels? Would be nice if you could write more context in your manuals!!
Kind regrads
Andreas