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.

How to Set up ADC GPIO pin on TMS320F2837xS

Other Parts Discussed in Thread: CONTROLSUITE

I am trying to set up a GPIO pin on my 2837xS launchpad. The specific pin I am trying to use is ADC-A input 0. Here are the two lines of code I am calling to set it up:

GPIO_SetPinUpOptions(43, /*Need to figure out how to set the output*/, GPIO_QUAL6);

AdcSetMode(43, 16, /*Need to figure out this parameter*/);

First, am I calling the write functions to set up my pin? I am calling these functions from the files provided in controlSUITE. If they are correct, how do I initialize my missing parameters? I understand that there are a lot of structs in the header files that can be used but I am not certain how to use them and there does not seem to be a register associated with pin 43. Any help would be appreciated. 

  • Hi Nikhil,

    The GPIOs and ADC pins are disparate pin sets on this device.

    The GPIOs can be manually read or written by SW, or the mux can be configured to allow a peripheral like ePMW, SPI, EMIF, etc. to control the pin directly for a digital function.

    ADC inputs are only muxed with other analog functions. For comparator inputs, you don't have to do any explicit muxing, you just have to enable the comparator (and this function can be used at the same time as the ADC input). For the DAC outputs, you just need to enable the DAC and it will drive out of the ADC pin (you could theoretically still sample the pin voltage with the ADC, but it will just read whatever the DAC is driving onto the pin).

    A good place to start to determine how the ADC is configured for sampling would be the various ControlSUITE examples that start with "adc_". Probably the best ones to look at would be adc_soc_epwm or adc_soc_software.