Hi,
I've written the code configuring four channels of ADC0 based on the library "tsc_adc_ss" . The module seems to be working, but no data is stored in FIFO buffer.
First, I've acquired the base address and enabled clocking (by CHIPDBBaseAddress and PRCMModuleEnable functions.)
Secondly, the general options were set, such as: clock divider, maping of hw events, general mode of operation:
TSCADCClkDivConfig(adc_base,25,25);
TSCADCSetHwEventMap(adc_base, TSCADC_HW_EVENT_MAP_HW_INPUT);
TSCADCSetMode(adc_base, TSCADC_MODE_GP_ADC);
TSCADCStepIdTagEnable(adc_base, FALSE);
TSCADCStepConfigWrProtectEnable(adc_base, FALSE);
Thirdly, the options for respective steps were set (where i is step number={1:4}): SIngle ended mode, streamed to FIFO0 of the size fifo_level=4.
TSCADCStepConfig(adc_base, i, FALSE, &Step1);
TSCADCStepFifoConfig(adc_base,i,TSCADC_FIFO_SEL_0,fifo_level,TRUE);
TSCADCStepMode(adc_base, i, TSCADC_STEP_MODE_HW_SYNC_ONE_SHOT);
TSCADCStepSamplesAvg(adc_base,i,TSCADC_SAMPLES_NO_AVG);
TSCADCStepDelayConfig(adc_base,i,3,5);
TSCADCStepEnable(adc_base, i, TRUE);
Finally, the interrupt is generated at the end of sequence (after all the steps) and the module is enabled.
TSCADCIntrEnable(adc_base, TSCADC_INTR_MASK_END_OF_SEQUENCE);
TSCADCStepConfigWrProtectEnable(adc_base, TRUE);
TSCADCEnable(adc_base, TRUE);
The module is hardaware synchronized by one of my timers. After a second, the interrupt TSCADC_INTR_MASK_END_OF_SEQUENCE is handled with these instructions:
number = TSCADCGetFifoWordCount(adc_base, TSCADC_FIFO_SEL_0);
data[0]=TSCADCGetFifoData(adc_base, TSCADC_FIFO_SEL_0);
data[1]=TSCADCGetFifoData(adc_base, TSCADC_FIFO_SEL_0);
data[2]=TSCADCGetFifoData(adc_base, TSCADC_FIFO_SEL_0);
data[3]=TSCADCGetFifoData(adc_base, TSCADC_FIFO_SEL_0);
I expect the ADC to work if the interrupt is generated at the end of the cycle. The problem is that the number of words in FIFO is zero and the voltage measured is zero also (for sure the voltage of 1V is present at the pad...). Should I acquire the following data samples one by one by the TSCADCGetFifoData instruction? Could you tell me if the presented way is correct or I should modify/add something important?
I use the IDK AM437X board and and sysbios sdk 2.1.1.2 (the TSC ADC library "tsc_adc_ss" from starterware folder was used).
Thank you in advance for your help
Regards,
Jacek