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.

TM4C123G GPIO driving problem

Hi Sir,

I'm confusing on driving LED on lanchPad of TM4C123G.

as below

<code>

(*((volatile uint32_t *)(SYSCTL_RCGCGPIO_R)))=0x3F;//enable PA~PF GPIO clock
(*((volatile uint32_t *)(GPIO_PORTF_LOCK_R)))=0x4C4F434B;//unlock
(*((volatile uint32_t *)(GPIO_PORTF_CR_R)))=0x00000001;//enable all
(*((volatile uint32_t *)(GPIO_PORTF_PUR_R)))=0x00;//
(*((volatile uint32_t *)(GPIO_PORTF_PCTL_R)))=0x00000000;//
(*((volatile uint32_t *)(GPIO_PORTF_DIR_R)))=0x0E;//PF1,2,3 output
(*((volatile uint32_t *)(GPIO_PORTF_AFSEL_R)))=0;//
(*((volatile uint32_t *)(GPIO_PORTF_DEN_R)))=0xff;
(*((volatile uint32_t *)(GPIO_PORTF_DATA_R)))=0X02 ;// Turn on PF1
(*((volatile uint32_t *)(GPIO_PORTF_DATA_R)))=0X00 ;//Turn off PF1

</code>

I dont know why can't drive LED,who can support me solve this problem.

  • Hello JD

    Most probably;y there is a bus fault that is happening in the code. I would suggest using TivaWare instead of DRM style access first of all as it makes the code readable for others on the forum.
  • DRM - always delightfully - scores AGAIN while insuring user delay, uncertainty, & frustration.   And - that frustration over-flows to vendor staff & humble outsiders - who seek to aid. (community service required under terms of parole...)

    That said - as NO Delays reveal w/in users (unfortunate) DRM code scramble - "How would user, "EVEN NOTE" the (very brief) "Turn ON" of PF_1?"

    We note that the "most unfortunate, "FORCED USE" of DRM sufficiently EXHAUSTS "compliant DRM users" - so much so - that they (usually) fall victim to (very) simple mistakes!  (i.e. as here!)

    Vendor's API guides users, "around, above, safely past" such pitfalls - the case for, "DRM and DRM ONLY" sits atop (very) slim (and unstable/declining) OLD ground!

    Nothing w/in API use "PREVENTS" the user from reviewing Register Selection & the various impacts of particular "Bit Settings!"     In fact the GUARANTEE of "user success" should insure, "User Learning!"

    Perhaps the INSPIRED BLEND of "API" AND Register Selection & "Bit Drilling" produces a TRUER, FASTER, VASTLY MORE EFFICIENT LEARNING!   Pretending that the hugely advantaged API does NOT exist - or banning its inspection and/or use - proves HIGHLY QUESTIONABLE!