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 configure GPIO in program with bootloader? C6748-LCDK.

Other Parts Discussed in Thread: OMAP-L138, OMAPL138

Hi,


I'm using C6748-LCDK, and want to set it in stand alone mode. Now I can download to flash and run it. But here I found a question.

A: The UARTpart can work properly with CCS in debug/release mode, and stand alone mode.

B: The LED part can work properly with CCS in debug/release mode. However, when I download it to flash, and try to run it in stand alone mode, the LEDs on board didn't blinking.

C: I combine UART with the LED, and use the UART as debug information printer in stand alone mode, and I found that the code was running, functions were called, but the LED still didn't blinking. Also, the register's value didn't change as what I wanted.

Here is part of my code.

::

/*
** Configures the I2C for the LED interface
*/
void LedIfConfig(void)
{
    /* Pin Multiplexing of pin 12 of GPIO Bank 6.*/ //GPIO 6-12/6-13

	UARTPuts("\n LedIfConig in. \n\r", -1);

    GPIOBank6Pin12PinMuxSetup();
    GPIOBank6Pin13PinMuxSetup();

    HWREG(0x01E26088)=0xffffcfff;
    UARTprintf("\n HWREG(0x01E26088)=0xffffcfff: 0x%x. \n\r",HWREG(0x01E26088));
    HWREG(0x01E26088)=0xffffffff;
    UARTprintf("\n HWREG(0x01E26088)=0xffffffff: 0x%x. \n\r",HWREG(0x01E26088));
    /* Sets the pin 109 (GP6[12][13]) as output.*/
    GPIODirModeSet(SOC_GPIO_0_REGS, 109, GPIO_DIR_OUTPUT);
    UARTprintf("\n GPIODirModeSet(109):0x%x. \n\r",HWREG(0x01E26088));
    GPIODirModeSet(SOC_GPIO_0_REGS, 110, GPIO_DIR_OUTPUT);
    UARTprintf("\n GPIODirModeSet(110): 0x%x. \n\r",HWREG(0x01E26088));
    HWREG(0x01E26088)=0xffffcfff;
    UARTprintf("\n HWREG(0x01E26088)=0xffffcfff: 0x%x. \n\r",HWREG(0x01E26088));
    UARTPuts("\n LedIfConig out. \n\r", -1);
}

/*
** Toggle the LED state
*/
void LedToggle(void)
{
	GPIOPinWrite(SOC_GPIO_0_REGS, 110, ledState);
    if(ledState == 0) ledState = 1;
    else ledState = 0;
	GPIOPinWrite(SOC_GPIO_0_REGS, 109, ledState);
}

/*
** Turn the  LED Off.
*/
void LedOff(void)
{
	GPIOPinWrite(SOC_GPIO_0_REGS, 109, GPIO_PIN_LOW);
	GPIOPinWrite(SOC_GPIO_0_REGS, 110, GPIO_PIN_LOW);

}


int main(void) {

	UARTConsoleInit();
	UARTPuts("\n Program is running. \n\r", -1);

	LedIfConfig();
	LedOff();
   /* Set up the Timer2 peripheral */
	TimerSetUp64Bit();

	/* Set up the AINTC to generate Timer2 interrupts */
	TimerIntrSetUp();

	/* Enable the timer interrupt */
	TimerIntEnable(SOC_TMR_2_REGS, TMR_INT_TMR12_NON_CAPT_MODE);

    /* Start the timer. Characters from cntArr will be sent from the ISR */
    TimerEnable(SOC_TMR_2_REGS, TMR_TIMER12, TMR_ENABLE_CONT);

	while(1);
}


-----------------------

In the function void LedIfConfig(void), the value in register GPIO0.DIR67 was printed.

The problem I found:

With CCS, each time the value will change as it supposed should be. LEDs are blinking.

Printed by UART:

::: Begin:::
Program is running.

 LedIfConig in.

 HWREG(0x01E26088)=0xffffcfff: 0xffffcfff.

 HWREG(0x01E26088)=0xffffffff: 0xffffffff.

 GPIODirModeSet(109):0xffffefff.

 GPIODirModeSet(110): 0xffffcfff.

 HWREG(0x01E26088)=0xffffcfff: 0xffffcfff.

 LedIfConig out.

:::End:::

---------------------------------------------------

However, if I downloaded the program into flash, the results became like this:

::: Begin:::
Program is running.

 LedIfConig in.

 HWREG(0x01E26088)=0xffffcfff: 0x8801.

 HWREG(0x01E26088)=0xffffffff: 0xe373763a.

 GPIODirModeSet(109):0xe373763a.

 GPIODirModeSet(110): 0xe373763a.

 HWREG(0x01E26088)=0xffffcfff: 0xe373763a.

 LedIfConig out.
::: End:::

So, what's the differences between the bootloader and the CCS when program runs? Do I need to KICK unlock something in the code with the bootloader? If so, how to do it?

The .gel file with CCS is the standard one from the startware (..\..\emulation\boards\lcdkc6748\gel\C6748_LCDK.gel).

Regards,

King