Hi,
I'm developing on a SITARA AM263x Evaluation Kit, using CCS 11 IDE and the provided mcu_plus_sdk_am263x_08_01_00_39 SDK.
I noticed a strange behavior on internal ADC when I try to acquire more than three analog inputs triggered simultaneoulsy. In details, I modified the provided adc_soc_am263x-cc_r5fss0-0-nortos_ti-arm-clang example to force the trigger of multiple SOCs as showed in the code below and I applied a 1V DC Voltage just to the analog input configured to belong to the SOC 0 (ADCIN0). I left all the other analog inputs unconnected. Running the code I noticed that If I start a number of SOCs less or equal to 3 (SOC_NUM macro), then the acquired SOC 0 channel seems to be correct (see SOC 0 raw value showed on Capture2.PNG file). When I increase the number of conversions (4 or more) the results are correct only on the first cycle of acquisitions; all the consecutive samples values seem wrong (see the same SOC 0 value on Capture1.PNG).
The ADC configuration is generated by the SysConfig Tool.
Is anything wrong on the code below?
Here the modified code:
* This example uses the ADC module to perform an ADC SOC conversion
* triggered by software.
*
* In this example ADC0 is used to convert the SOC, the user can also
* select a different one.
*
* This example also showcases how to configure and use the ADC module.
*/
#define LOOP_CNT 10
#define SOC_NUM 3
void adc_soc_software_main(void *args)
{
int i;
uint32_t baseAddr = CONFIG_ADC0_BASE_ADDR;
uint32_t loopCnt = 0;
uint16_t result[LOOP_CNT*SOC_NUM];
uint16_t socMask = 0;
/* Open drivers to open the UART driver for console */
Drivers_open();
Board_driversOpen();
for(i=0; i<SOC_NUM; i++)
{
socMask |= 1L<<i;
}
DebugP_log("ADC Software Triggered Conversion Test Started ...\r\n");
while(loopCnt<LOOP_CNT)
{
/* Clear any pending interrupts */
ADC_clearInterruptStatus(baseAddr, ADC_INT_NUMBER1);
//ADC_forceSOC(baseAddr, ADC_SOC_NUMBER0);
ADC_forceMultipleSOC(baseAddr, socMask);
while(ADC_getInterruptStatus(baseAddr, ADC_INT_NUMBER1) == false)
{
/* Wait for the SOC conversion to complete */
}
for(i=0; i<SOC_NUM; i++)
{
result[SOC_NUM*loopCnt+i] = ADC_readResult(CSL_CONTROLSS_ADC0_RESULT_U_BASE, i);
}
loopCnt++;
}
loopCnt = 0;
while(loopCnt<LOOP_CNT)
{
for(i=0; i<SOC_NUM; i++)
{
DebugP_log("ADC Result SOC%d register value : %d\r\n", i, result[SOC_NUM*loopCnt+i]);
}
DebugP_log("\r\n");
loopCnt++;
}
/* Clear and disable interrupt */
ADC_disableInterrupt(baseAddr, ADC_INT_NUMBER1);
ADC_clearInterruptStatus(baseAddr, ADC_INT_NUMBER1);
/* Power down the ADC */
ADC_disableConverter(baseAddr);
DebugP_log("ADC Software Triggered Conversion Test Passed!!\r\n");
DebugP_log("All tests have passed!!\r\n");
Board_driversClose();
Drivers_close();
}
Capture1.PNG
Capture2.PNG