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.

TM4C1231C3PM GPIO

Other Parts Discussed in Thread: TM4C1231C3PM, LM3S811

Hi   all

MCU: TM4C1231C3PM  

KEIL:  keil5.0

I now want to use PB[3:2]  as GPIO Function,but  the table above shows the default state is not GPIO function.

How should I configure them?

Thanks

Lewis

  • Lewis said:
    want to use PB[3:2]  as GPIO Function

    Let me begin by commending you for having the discipline to read/review the GPIO Section of your MCU manual.  (too many do not)

    It's normal/customary for (most) MCU pins to default into GPIO (input) mode.  As you observe - PB3/PB2 break that path - but should respond via the function call:

    "GPIOPinTypeGPIOInput() or GPIOPinTypeGPIOOutput()."  You're responsible for adding - both Port & Pin parameters - to complete those 2 calls.

    Note that call, "GPIOPinConfigure()" is (not) required for GPIO destined pins.  (but is required for most other - pin configurations.)

    Again - nice "get" and you appear very well, "on your way."

  • Hi cb1_mobile
    I do not understand what you mean.I know it is GPIO pin, but it is not the default GPIO function
  • Please read again - I'm mobile - net comes in/out - I've further detailed the function calls you require to "restore" PB2/3 to GPIO operation.
  • Hello Lewis,

    to add to what cb1's extensive post has already mentioned: The function on a pin to be a Digital IO requires GPIODEN to be set which is not the case as per the table. For the Pin to a non-GPIO additionally requires the AFSEL be set besides the PCTL value as well which is not the case either. So the pin is right now a floating pin. By using the GPIOPinTypeGPIOInput or GPIOPinTypeGPIOInput you are setting the respective bit for GPIODEN, clearing the GPIOAFSEL (and based on direction setting the GPIODIR) which would be sufficient for the application's requirement of a GPIO.

    Regards
    Amit
  • Hi Amit,

    When able - we do try to "ease your load."

    I'm pleased that you confirmed my guidance - especially that you detailed that (all 3 Regs) GPIODEN, GPIOAFSEL, & GPIODIR are nicely managed via the extremely efficient call "GPIOPinTypeGPIOx()" (where x must be replaced w/Input or Output.

    Thus this call "GPIOPinTypeGPIOx()" - in "one go" - saves the time/effort and (always) uncertainty which results from posters' use of Direct Register...

  • Hi all  

      ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

      HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;

      HWREG(GPIO_PORTB_BASE + GPIO_O_CR) = 0x04;

      HWREG(GPIO_PORTB_BASE + GPIO_O_AFSEL) &= 0xfb;

      HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;

      HWREG(GPIO_PORTB_BASE + GPIO_O_CR) = 0x08;

      HWREG(GPIO_PORTB_BASE + GPIO_O_AFSEL) &= 0xf7;

     

    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, 0xFF);

    ROM_GPIOPinWrite(GPIO_PORTB_BASE, 0xFF,addr);

    May I ask I need to add those marked in red content?

    Thanks 

    Lewis

  • This reporter hereby withdraws his comment of, "Good read/review" dear poster.

    MCU manual - with some effort - reveals which pins require, "Unlock" treatment.  (doubtful that PB2/3 require such treatment.)

    Two have now responded (one 3 times) - not one word of thanks/appreciation.  (how very motivating...)

    Yes you may "ask" - far better that you "read/review" - and thank those making (near instant) effort in your behalf.

  • Hi  cb1_mobile

         

    I am very pleased to receive your reply again! I am grateful that you can answer my question. I am just beginning to learn this MCU. I saw the table, I feel very confused, and that leads me to suspect that PB [3: 2] These two pins still need a very special configuration it can be used as a normal GPIO pin (for example: PB0 / PB1, PF4 ... ...).
    I now want to use the PB [0: 7] as normal (I / O function) rather than its alternate function, my code is as follows: ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOB);
    ROM_GPIOPinTypeGPIOOutput (GPIO_PORTB_BASE, 0xFF);
    ROM_GPIOPinWrite (GPIO_PORTB_BASE, 0xFF, addr);
    If you feel there is anything wrong place or that the above code is not successful, I also ask you to help me change it?
    I look forward to your reply!

  • Please do read again the code snippets which both vendor's Amit & I earlier supplied.  

    I do not believe that you need your (earlier) "red unlock" code block.  Code you post now (potentially) places each/every pin w/in Port B into Output mode.  (that's caused by your use of 0xFF w/in 2nd function parameter)

    Usually - but not always - use of the unlock procedure is confined to those pins which serve as JTAG/SWD (usually PC0-PC3) and NMI.  (PF0, PD7)  Again - if you "search" for "unlock" w/in your MCU manual (one hopes) the required detail will emerge.

    As you are "just starting out" - and as our small firm hires many interns/new programmers/engineers - we advise that you "avoid" (for now) those special pins.  (revealed in your chart.)  This vendor provides MCUs of 64 pins or beyond - you should be able to harvest a similar functionality - from a "less restricted" pin.

    You've much to learn - KISS dictates that you avoid the more complex issues - until your confidence & experience rise.  Master the basics - it is good that you noted these points but they (now) appear to have garnered too much of your attention - and will impede your progress.  (and that's just what I tell/demand to/of my staff...)

  • Hi cb1_mobile
    I am grateful for your advice!

    Regards
    Lewis
  • Hi Lewis,

    Like cb1 said, special care pins are slowing down your progress so try to avoid them for now, there are so many besides those. If you want to keep looking for that info, look at that table, Which pins have a note "a"? Check what that note says.

    Automated question away: Can i advise you consulting this if you are starting with Tiva?
    https://sites.google.com/site/luiselectronicprojects/tutorials/tiva-tutorials
  • Lewis said:
    I am just beginning to learn this MCU. I saw the table, I feel very confused, and that leads me to suspect that PB [3: 2]

     Hi Lewis, I confirm I got confused too much on first attempt to use this MCU too, I don't feel secure now, too many special usage and too many different mode to do same thing where intermixed. Examples are of little help and I assure you TIVAWare got some thing more simple also if brokened some other where functioning.

     If you, as me, are first time ARM approaching this mcu appear much more complex than necessary.

     I see you , as cb1 marked, one more reading data sheet, it is difficult find someone doing this precise method approach.

     If you are using Launchpad 123, desolder R9, R10 as soon as possible.

     Happy have you in our community.

  • Roberto Romano said:
     If you are using Launchpad 123, desolder R9, R10 as soon as possible.

    It's not the MCU for the launchpad :p



    Roberto Romano said:
     If you, as me, are first time ARM approaching this mcu appear much more complex than necessary.


    That's true! It can be daunting, like most ARM actually, when starting, there's just so much info scattered around but i actually like the TM4C123 datasheet (the TM4C129x it seems some have some info amiss from a post that appeared). But there's also things like NMI locked pins that could be avoided and those resistors you referred.

  • Roberto Romano said:
    confirm I got confused too much on first attempt to use this MCU too

    Mon ami - in such event - cannot you make request of skilled [beginner guru]?  

    If you're willing to, "Do a Search" and/or confine request to PF0/PD7, your confusion may be eased.  (fixation upon the "easy" may dull capability - should your question extend beyond - "most basic"...)

  • LUISSSS!!!!
    Ach... SO please let me reword phrase also if processor don't belong to but saving time and headaches or burned processor to someone is primary.

    If you plan to or are using Launchpad 123 too, desolder R9, R10 as soon as possible.
    General public reworded:
    If someone plan to or use Launchpad 123, we recommend to desolder R9, R10 as soon as possible!!!!!!

    Luis this disclaimer is forever a <<TO MUST BE DONE>> dictat!
    Thank to help sharpen my blade, take care of you. ;)
    You can ... ops MUST share on your site too and use as FIRST READ THIS!!!!
  • Hi Roberto,

    i do have that in here:
    https://sites.google.com/site/luiselectronicprojects/tutorials/tiva-tutorials/note---common-errors

    Maybe i should have it standing up more
    Starting tomorrow i will start studying schedules again, out of vacations, let's see if i start adding stuff to the website (and advancing more of course)
  • Roberto Romano said:
    plan to or are using Launchpad 123 too, desolder R9, R10 as soon as possible.

    Mon Ami,

    Had we not (past) agreed that we're to, "Desolder and then Tombstone" (to memorialize) those delightful, wonderfully placed & considered R9,10?  (as those 0-ohm Rs provide value/effort savings to the (clear) 1 in 1000 who (may) require (past) msp compatibility...)

    If Luis' blog is to shine - blade may well require that sharpness/polish...

  • CB1, You too, original quotation Julius Cesaer "Tu quoque, Brute, fili mi!"...

     Early day of Stellaris prematurely deaden, troubles come from examples where using intermixed register access and BIT BANDING, so some expression that time where completely obscure to me.. Now I understood data need be multiplied by 4 to match 32bit access and also how register are mapped.. I hope decoding 129 LCD driver can be of some help to who approach again this processor..

     First fault was from R9, R10 bricked pin due to contention, after that none more processor was injured too by me !! Nor MSP430 powered from 6V, but one deadened @12V immediately and silently passed over. No experience on TIVA overvoltaging but wait after using some 10K unit.

     Again Luis you can post my "Hacking Exam" public test, or I can join your blog to TIVA "Tempest" you and publish too.

     After some time and LOOOONG reading I really got the [beginner guru] level you mention, so I know EnET, some way EPI, SSI, UART, GPIO, TIMER, USB HOST (not in deep) I never used till now: ADC, USB Device, PWM, QEP (its time is coming very soon), I2C Slave (it is used to communicate to a sllave MSP) nor... hey this processor has too many things on chip.. why not have one simple as it was our good LM3S811??

     CB1, TIVA is not a simple thing and I am no more joung as Luis...

     At last.. Please do a search and tell me if you find my "hacking exam" post, I think forever Shannon theory never was demonstrated in deep like here ;)

     Hey don't drive me freshen thread... This increase Entropy too and ge hint to be forever [beginner guru] >TM<

     See you my friend.

  • @ Roberto,

    And there are (some) who say, "Latin is dead..." En Francais, "et tu, Brutus?"

    Sending you a P.M. -  to clarify few things - and best to you/yours in 2015.