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.

CCS/AM6548: GPIO control from R5F

Part Number: AM6548

Tool/software: Code Composer Studio

Hello,

Environment:

  • Hardware: AM65x EVM board
  • Software: Linux in the shipped SD Card or TI-RTOS

I m able to use GPIO1_88 with the following Linux commands.

./busybox devmem 0x11c300 0x08010007
./busybox devmem 0x601060 w 0xFEFFFFFF
./busybox devmem 0x601068 w 0x1000000
./busybox devmem 0x60106c w 0x1000000

Then I try to use R5F running TI-RTOS to control GPIO1_88 as well. I import the hello world example code and add the following code in main().

volatile unsigned int *CTRLMMR_PADCONFIG192 = (volatile unsigned int *)0x11C300;
volatile unsigned int *GPIO_DIR45 = (volatile unsigned int *)0x601060;
volatile unsigned int *GPIO_OUT_DATA45 = (volatile unsigned int *)0x601064;
volatile unsigned int *GPIO_SET_DATA45 = (volatile unsigned int *)0x601068;
volatile unsigned int *GPIO_CLR_DATA45 = (volatile unsigned int *)0x60106C;

Int main()
{
    System_printf("hello world\n");

    System_printf("*CTRLMMR_PADCONFIG192: 0x%x\n", *CTRLMMR_PADCONFIG192);
    System_printf("*GPIO_DIR45: 0x%x\n", *GPIO_DIR45);
    System_printf("*GPIO_OUT_DATA45: 0x%x\n", *GPIO_OUT_DATA45);
    System_printf("*GPIO_SET_DATA45: 0x%x\n", *GPIO_SET_DATA45);
    System_printf("*GPIO_CLR_DATA45: 0x%x\n", *GPIO_CLR_DATA45);

    *CTRLMMR_PADCONFIG192 = 0x8000007;
    *GPIO_DIR45 = 0xFEFFFFFF;
    *GPIO_SET_DATA45 = 0x1000000;

    System_printf("*CTRLMMR_PADCONFIG192: 0x%x\n", *CTRLMMR_PADCONFIG192);
    System_printf("*GPIO_DIR45: 0x%x\n", *GPIO_DIR45);
    System_printf("*GPIO_OUT_DATA45: 0x%x\n", *GPIO_OUT_DATA45);
    System_printf("*GPIO_SET_DATA45: 0x%x\n", *GPIO_SET_DATA45);
    System_printf("*GPIO_CLR_DATA45: 0x%x\n", *GPIO_CLR_DATA45);

    /*
     *  normal BIOS programs, would call BIOS_start() to enable interrupts
     *  and start the scheduler and kick BIOS into gear.  But, this program
     *  is a simple sanity test and calls BIOS_exit() instead.
     */
    BIOS_exit(0);  /* terminates program and dumps SysMin output */
    return (0);
}

After the execution of my program with TI-RTOS, the value of GPIO1_88 remains low and the value of CTRLMMR_PADCONFIG192 is the same.

[MCU_PULSAR_Cortex_R5_0] hello world
*CTRLMMR_PADCONFIG192: 0x8210007
*GPIO_DIR45: 0xffffffff
*GPIO_OUT_DATA45: 0x0
*GPIO_SET_DATA45: 0x0
*GPIO_CLR_DATA45: 0x0
*CTRLMMR_PADCONFIG192: 0x8210007
*GPIO_DIR45: 0xfeffffff
*GPIO_OUT_DATA45: 0x0
*GPIO_SET_DATA45: 0x1000000
*GPIO_CLR_DATA45: 0x0

I m wondering if any initialization of modules is not done... Could any one provide some comments? 

  • Hi,

    I suspect you need to write to the Kick Protection registers to enable writes to the PAD configuration register. In this case, you'll write to CTRLMMR_LOCK7_KICK0 & CTRLMMR_LOCK7_KICK1. Please see the AM654x TRM (spruid7d.pdf), 5.1.3.3.1.2 Kick Protection Registers.

    Regards,
    Frank

  • Hi Frank,

    Thanks for the reply. The following software configuration works fine for me.

    • building my bare-mental code without SYS/BIOS
    • writing the correct values to CTRLMMR_LOCK7_KICK0 & CTRLMMR_LOCK7_KICK1 to unlock partitions
    • writing CTRLMMR_PADCONFIG192 to enable drive
    • writing GPIO_SET_DATA45 to set GPIO1_88 to high
    • the voltage of pin0 of J19 becomes 3.3v which is what I expected

    The problem now is that I fail to read/write CTRLMMR_LOCK7_KICK0 & CTRLMMR_LOCK7_KICK1 after I load the bare-mental code with SYS/BIOS.

    I have opened another thread for this problem: https://e2e.ti.com/support/processors/f/791/t/871545.