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.

Cannot toggle port A, pin_1 (PA1) of TM4C1294NCPDT

Other Parts Discussed in Thread: TM4C1294NCPDT

Hi,

I've tried to toggle the port A, pin_1 (PA1) of TM4C1294NCPDT but could not work it out. Also, I've tried to configure the U0TX(PA1) of the same but could not work it out. Just wanted to know if any settings are required like GPIO_LOCK or anything else. 

Pls go thru the GPIO_INIT() breifed as follows:

void GPIO_INIT (void)
{
static int i,j;

SysCtlPeripheralReset(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

GPIOPinTypeGPIOOutput(GPIO_PORTA_AHB_BASE, GPIO_PIN_1);
for(j = 0; j <= (500000*12); j++)
{

GPIOPinWrite(GPIO_PORTA_AHB_BASE,GPIO_PIN_1,0 );
for(i = 0; i <= (1000000); i++);

GPIOPinWrite(GPIO_PORTA_AHB_BASE,GPIO_PIN_1,1 );
for(i = 0; i <= (1000000); i++);
}
}

Kindly respibd asap...

Thanks,

Mary Ann

  • sreeni siddu said:
    GPIOPinTypeGPIOOutput(GPIO_PORTA_AHB_BASE, GPIO_PIN_1);
    for(j = 0; j <= (500000*12); j++)
    {

    GPIOPinWrite(GPIO_PORTA_AHB_BASE,GPIO_PIN_1,0 );
    for(i = 0; i <= (1000000); i++);

    GPIOPinWrite(GPIO_PORTA_AHB_BASE,GPIO_PIN_1,1 );

    Use GPIO_PORTA_BASE instead.

    -kel

  • Hello Sreeni

    The GPIO Toggle uses bit banding. So the following line (on top of what Kel has added)

    GPIOPinWrite(GPIO_PORTA_AHB_BASE,GPIO_PIN_1,1 );

    must be

    GPIOPinWrite(GPIO_PORTA_AHB_BASE,GPIO_PIN_1,GPIO_PIN_1 );

    Regards
    Amit
  • Or, to more generalize, that final parameter should be "2."  (when you wish to output a "1" from GPIO_PIN_1)
     
    First responder's "guess of 1" fails - applies (only) to bit position "0."

    Use of "GPIO_PIN_x" eliminates your "need to know" and emplace the correct, bit-position value. 

  • Thanks all. Its working now...
  • Please check the following code for configuring uart0 in TM4C1294NCPDT. Its sending data out.

    main()
    {
    SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);
    UART_INIT();
    }

    void UART_INIT (void)
    {
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    UARTDisable(UART0_BASE);
    UARTFIFODisable(UART0_BASE);
    UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE));

    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0); // U0RX
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_1); //U0TX

    GPIOPinConfigure(GPIO_PA1_U0TX);
    GPIOPinConfigure(GPIO_PA0_U0RX);
    UARTFlowControlSet(UART0_BASE, UART_FLOWCONTROL_NONE);

    UARTFIFOEnable(UART0_BASE);
    UARTEnable(UART0_BASE);

    UARTCharPut(UART0_BASE, 'A');
    UARTCharPut(UART0_BASE, 'T');

    }

    Please do respond asap...


    Thanks
    Mary Ann
  • Mary Ann said:
    Please do respond asap... 

    Have we not already done that?  (2 out of 3 of us correctly)   Yet those 2 have not received their (rightful) Verified Answer.

    The subject of your original post has been satisfied - yet now you "over-burden" that post with, "change of subject!"  How then do forum organizers "categorize" your  post - so that others may find (and benefit from) it?

    Some of us have paying tech jobs - real commitments - and other posters have sought help before you.  Your request for "asap" suggests that your wants/needs are to exceed those of others - does it not?   Does the "real world" work that way - we rush to your aid - and receive no thanks in that process?   Really?