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.

No Data in FIFO register when using ADC0 channels

Other Parts Discussed in Thread: SYSBIOS, AM3359, AM4379, SYSBIOSSDK-IND-SITARA

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

  • Moving this to the Starterware forum.
  • Jacek

    Your approach parallels the starterware ADC example with a few design differences. When an example is available - a good way to verify a design is to start with the example and to incrementally incorporate the changes to verify the sequence, settings and operation.

    David
  • Hi,

    Thanks for the response.

    I've studied the volt_measure_app (from starterware) and motor_control (from sysbios sdk) examples very thoroughly before writing this code. In general, the detailed module configuration was well explained in both of them. The interrupt chain 'timer'->'ADC'->'CPU' included in motor_control project was also adapted and seems to work. The only thing not clear enought to me is the related modules' preparation (e.g.: ADC Pins enabling/clocking). That's why I asked if there is any additional thing I should be aware of because in those projects it is not emphasized. I was considering if I missed the answers to the following questions:

    - In every example the FIFO buffer is used for one sample only. If there are more samples, I should pick one of them from the buffer output and pick the second one from the output in the next cycle (according to the basic FIFO idea), am I right?

    - Before the exact ADC configuration, several preconditions should be met: The ADC module should be PRCM-enabled (clocked and powered) and the appropriate interrupt should be routed in Control Module (timer4 in my case). I included the board initialization by 'BOARDInit' and pinmux config {CHIPDB_MOD_ID_ADC0, 0, 0} by 'Board_pinMuxConfig'. Should I also initialize GPIO pins manually to be ADC pinouts? The module works because the sequence is executed and the interrupt TSCADC_INTR_MASK_END_OF_SEQUENCE is generated. All steps are enabled and they actually work, however the convertion doesn't result in aquring the sample. My guess is that physical layer of the pinouts is not routed to the ADC0_AINx channels but I'm not sure...

    - In volt_measure_app project the ADC was used to general case (measuring voltage from the channels), so why the 4-wire (TSCADC_MODE_FOUR_WIRE) mode was selected? - in TRM it was stated that this mode is reserved for touchscreen.

    The project volt_measure_app was built and sent to CPU without any errors, however in my case it didn't result in any ADC conversion - I choose the IDK configuration, got active debug configuration in project properties and updated the interrupt Numberdata base of ChipDB in volt_measure_app_main.c - are there any additional steps to be done before compilation?

    Regards,

    Jacek

  • Hi Jacek,

    The AM347 IDK schematic there are three ADC inputs that are available for input without modifying the board. These are
    ADC0_AIN0 is biased at 1.2 V and connected only to J1 pin 31
    ADC1_ANIN6 and 6 are connected directly to J2 pins 1 and 2.

    The other AD0 and ADC 1 inputs are allocated to Motor control current and voltage measurements.

    The Starterware release notes in {Installation_DIrectory}\sysbios_ind_sdk_2.1.1.2\sdk\starterware\docs list the TSC_ADC example as not supported on the AM437x IDK . However this starterware example is supported on the AM335 ICE V2 EVM in the industrial SDK.

    The ADC signals and their pins are listed on table 4.10 of the AM4379 datasheet and table 4.1 of the AM3359 datasheet.
    Unlike other muxed pins, the ADC pins are not multiplexed with any other signals. The reset configuration is that the signal is in off state. However theinput mode is automatically configured after the active low PWRONRSTn terminal transitions from low to high.
    The pin name which is what is used to describe the pin in the software is the same as the adc signal name, in this case.

    The ADC API is documented in {Installation_Directory}\sysbios_ind_sdk_2.1.1.2\sdk\starterware\include\tsc_adc_ss.h
    For a single ended input the ADC should be configured as single ended.

    The 4 wire is used for a touch screen controller. I believe you will be interested in a single ended or differential configuration

    The example below shows a multiple input read configuration on the AM335x
    There are several good posts on ADC configuration are available
    An ADC Configuration example
    Simultaneous capture on multiple ADC channels in AM335x starterware e2e.ti.com/.../1498118
    and the link at the end
    e2e.ti.com/.../1502162

    Two other descriptions of the programming. which may provide additional information are:
    AM335 ADC Steps e2e.ti.com/.../970283
    AM335 ADC Configuration e2e.ti.com/.../324917

    David
  • Hi,
    Thank you for your response.

    You're right about number of ADC channels available in IDK - only three at J1 and J2. Nevertheless, the voltages measured in my application at ADC0_AIN0-ADC0_AIN3 should be equal to 1.2V, 0V, 0V, 0V without any modifications to the board. The problem is that no data is streamed to the FIFO buffer and it's empty. As a result, I get 4x 0V when acquiring data from FIFO by TSCADCGetFifoData function.

    To simplify the program, I reduced the number of ADC0 channels to only one: ADC0_AIN0 (biased at 1.2V). I set its configuration as mentioned in the first post with appropriate initialization (based on the tsc_adc_ss.c and tsc_adc_ss.h files and the examples you enclosed):

    adc_base = CHIPDBBaseAddress(CHIPDB_MOD_ID_ADC0, 0); //getting ADC0 base address

    PRCMModuleEnable(CHIPDB_MOD_ID_ADC0,0,TRUE); //Power and clock enable

    TSCADCAfePowerUp(adc_base); //Power-up of AFE

    TSCADCClkDivConfig(adc_base,24000000,3000000); //Configuration of clock divider

    In addition, in the main function the Board_pinMuxConfig is used on the structure {CHIPDB_MOD_ID_ADC0, 0, 0} but it seems from your answer that it is not needed.

    Unfortunately, the above configuration is different from the presented in the links provided. The functions:

    TSCADCModuleClkConfig(); /* Enable the clock for touch screen */
    TSCADCPinMuxSetUp();
    TSCADCConfigureAFEClock(SOC_ADC_TSC_0_REGS, 24000000, 3000000); /* Configures ADC to 3Mhz */
    TSCADCTSTransistorConfig(SOC_ADC_TSC_0_REGS, TSCADC_TRANSISTOR_ENABLE); /* Enable Transistor bias */

    belong to the former version of tsc_adc_ss library? I don't have them in any of the starterware files. However, I found their definitions on web and most of modified registers seem the same as in 'my' functions. There is no funtion in my tsc_adc_ss library corresponding to TSCADCPinMuxSetUp()- and its registers CONTROL_CONF_AINx don't exist in the list of registers in Control Module. Moreover, was the intention of TSCADCTSTransistorConfig() enabling of touchpanel transistors in ADC0_CTRL register? It seems from the TRM that these transistors should be disabled for general purpose of ADC, am I right?

    The rest of code is consistent with the mentioned in the first post: Timer4 is the source, hardware event map is set, the SE mode in General Purpose ADC - and it follows the example from the link you provided. The result is exactly the same - no data is stored in FIFO during interrupts.

    Because my program seems identicall to the examples found on e2e I thougth that the problems is related to the lack of pinmux config or some register settings in Control Module. The module is powered and clocked, because it generates the interrupts at the end of sequences. I've checked many options and parameters in the functions mentioned in tsc_adc_ss documentation. Could you please suggest some other settings, muxing or registers that need to be configured? Could the problem be related to Sys/Bios itself? I can adapt my code to be more compact and place it here if it helps.

    Regards,
    Jacek
  • Jacek

    I apologize for leaving out this important point.  The previous e2e posts for the AM335x ADC example are based upon the starterware APIs in the SYSBIOSSDK-IND-AM335X ICE V2: v01.01.xx. These APIs are directly applicable to the AM335x . These APIs were updated in the migration to the  SYSBIOSSDK-IND-SITARA SDK v02.01.xx and are applicable to both the AM335x ICE V2  and AM437x IDK.  There is a migration guide in the SYSBIOSSDK-IND-SITARA SDK v02.01.xx for the updated APIs that describe the differences from the earlier APIs. There are both large and small differences between the two SDK APIs so - it is important to reference the migration guide in talking information from the Industrial SDK v 01.01 to v 02.01 .

    Since the AM437x does not have plus and - supplies -  the zero volt input is will occur at the mid supply voltage.  

    Thank you for pointing out the pinmux configuration. Let me follow up with this and your other questions in a later post.

    David

  • Hi,

    The module still doesn't work but now I don't get zero values - the steps' mux configuration was wrong because of the AFE ref values. FIFO_0 buffer is still empty, while the uint32_t values gathered from it are ~3300 for ADC0_AIN0 (connected to 1.2V) and ~2100 for the other three inputs with pulldown resistors. As i see, the AFE is 12-bits so the 1.2V should be coded as ~2700 for the following step configuration (1.8V is external VREFP-VREFN):

    {TSCADC_NEGATIVE_REF_VREFN, TSCADC_POSITIVE_REF_VREFP, TSCADC_INPUT_VREFN , TSCADC_INPUT_CHANNEL1, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE}

    Anyway, for pulldown inputs the above values ~2100 are wrong. I don't even know if these values are from AFE outputs as the FIFO word count function still gives zero. What is surprisng for me that the above values are quite repeatable.

    Regards,

    Jacek

  • Hi David,

    Have you found something related to pinmux settings in TSC_ADC?

    So far I went through eHRPWM pinmux settings so these things are much more clear for me, however there is still problem with ADC configuration when PINMUXModuleConfig includes {ADC,0,0} structure.

    Regards,

    Jacek