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.

Reassignment of ADC pins to GPIO

Other Parts Discussed in Thread: TM4C1237E6PM

Hi,

I am working on a design that uses the Tiva TM4C1237E6PM device. I am running very low on GPIO pins and would like to reclaim unused ADC inputs. I used the pin mux tool to assign my I/O, and when I enable ADC0, 12 AIN pins turn green. I only need 4 channels of ADC, so I would like to re-assign some of these unused ADC channels to GPIO. Using the tool I select an AIN pin and reassign to GPIO input, and it turns red, indicating a collision.

Does this mean that I cannot reclaim these pins as GPIO? Can I reconfigure these pins after start up to GPIO, either input or output? Do I need to terminate any unused AIN inputs?

I have the same question regarding USB0, I intend to only function as a USB host, and would like to reclaim PB0 and PB1. The datasheet implies that this can be done, but I want to make sure before finalizing my pin assignments.

Thanks,

ART

  • If you're following the proper procedures for that, "pin mux" tool - you may have discovered a weakness w/in that tool.  Our small group has been using ARM MCUs long before the creation of such "tools" - we always felt that the details w/in MCU manual & register examination would prove more worthwhile - long term.  (crutches rarely seen - race finish/award lines...)

    Early M3, Stellaris MCUs indeed supplied, "dedicated ADC pins" - these could not be converted into, "direct" GPIO usage.  (that said - we/others could "massage" them into gpio inputs by reading the resulting ADC value when a (somewhat restricted frequency) digital signal was impressed.  Insure that the digital input signal remains w/in "voltage bounds" as spec'ed by the ADC.  We did this several times - it always did work but was, "inelegant.")

    Now your current device has no such, "forced ADC usage!"  And - via your examination of key, gpio port registers - you can discern just how the default port/pin configurations are set - post MCU reset.  MCU manual details.  It's normal/customary to select the MCU's pin functionality via proper calls to functions, "ROM_GPIOPinType()" and "ROM_GPIOPinConfigure()" when you seek to select any of the pin's "alternate functions."  (i.e. those beyond gpio)  The Peripheral Driver Library User's Guide has long - and nicely - detailed.  Beyond that - many code examples provide exacting detail - usually illustrating the set-up & configuration of all the MCU peripherals.

    Never good to allow inputs to "float" - these MCUs provide weak pull up/down internal resistors which can be emplaced via function, "ROM_GPIOPadConfigSet()."  Again - earlier referenced User's Guide amplifies.  Note that I've provided the "ROM" version of the library functions.  You're free to use, "flash resident" versions of those functions too.  ROM versions may save some (but not as much as most hope) of your MCU's flash space.

    Your USB "reclaimation of PB0" is bit beyond this reporter's pay grade - requires detailed read of the MCU manual or "insider knowledge" - not always well (nor timely) propagated to we outsiders/user-specifiers...

  • Hi,

        I tried to download the Tiva Pin Mux utility to verify. However, I am unable to download the Tiva Pin Mux utility. There is an "Alert Me" button instead of a "Get Software" button.

        Anyway, to understand how to configure your these pin(s) as GPIO without the use of Tiva Pin Mux utility, see, info regarding "GPIOPinTypeGPIOInput()" and "GPIOPinTypeGPIOOutput()" at Tivaware Peripheral Driver Library User's Guide. There is an example gpio code at the User's Guide showing the use of "GPIOPinTypeGPIOInput()" and "GPIOPinTypeGPIOOutput()", that you can review. 

        When configuring your GPIO as ADC using "GPIOPinTypeADC()", you need to "not" include that pin(s) that you intend to use as GPIO. 

         When configuring your GPIO as USB using "GPIOPinTypeUSBDigital()", you need to "not" include that pin(s) that you intend to use as GPIO. 

    -kel    

  • Hello Arthur,

    Can you please send the original file that you are trying to modify in PinMux which gives you this error, so that I can check it? Also which version of PinMux are you using?

    Regards

    Amit Ashara