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.

Working around GPIO using CSLR Example

Other Parts Discussed in Thread: OMAP-L137

Hi.

1) How do I make an output pin on GP0[14] goes High and Low (bit-wise operation)?

2) How if I want to make all the output pins on GP0 high & low ?

Below code is a snippet for GPIO example program based on PSP 1.20 using on OMAP-L137.  I did try to change parameter "12" to "14" assuming it will work for GP0[14]; but it did not.

  /* Configure GPIO0_12 (GPIO0_12_PIN) as an output */
  gpioRegs->BANK[0].DIR &= ~(CSL_GPIO_DIR_DIR_IN << CSL_GPIO_DIR_DIR12_SHIFT);

  /* Configure GPIO0_8 (GPIO0_8_PIN) as an input */
  temp = gpioRegs->BANK[0].DIR;
  temp = ( (temp & CSL_GPIO_DIR_DIR8_MASK) | (CSL_GPIO_DIR_DIR_IN << CSL_GPIO_DIR_DIR8_SHIFT) );
  gpioRegs->BANK[0].DIR |= temp;

 

    while (ledBlinkCount < MAX_BLINK)
    {
        /* Make the GPIO pin (GPIO0_12_PIN) conected to the LED to low. *
         * This turns on the LED - see schematic         */
        temp = gpioRegs->BANK[0].CLR_DATA;
        temp = ( (temp & CSL_GPIO_CLR_DATA_CLR12_MASK) |
             (CSL_GPIO_CLR_DATA_CLR_CLR << CSL_GPIO_CLR_DATA_CLR12_SHIFT) );
        gpioRegs->BANK[0].CLR_DATA |= temp;

       delay(2000);

        /* Make the GPIO pin (GPIO0_12_PIN) conected to the LED to high *
         * This turns the off the LED - see schematic    */
        temp = gpioRegs->BANK[0].SET_DATA;
        temp = ( (temp & CSL_GPIO_SET_DATA_SET12_MASK) |
             (CSL_GPIO_SET_DATA_SET_SET << CSL_GPIO_SET_DATA_SET12_SHIFT) );
        gpioRegs->BANK[0].SET_DATA |= temp;


       delay(2000);
    }

  • Hi,

    You must place the unlock code into KICK0R & KICK1R registers before change pinmux registers.

        /* Key to be written to enable the pin mux registers for write            */

        sysRegs->KICK0R = 0x83e70b13;

        sysRegs->KICK1R = 0x95A4F1E0;

  • Hi Rahiman,

    Is the GPIO CSLr Example provided by the BIOS PSP working?. 

    Mohd Hafiz Fazalul Rahiman said:
    I did try to change parameter "12" to "14" assuming it will work for GP0[14]; but it did not.

    If you refer the gpioExample(..) Initially, there is PINMUX done to enable GPIO0_8 and GPIO0_12. Make sure you are doing this(PINMUX) appropriately for  GP0[14]. The code snippet looks like you are using the PSP provided example itself. Is it the same example or a modified one?. Load the default binaries that come with the PSP and check.

     

    Thanks & regards,

    Raghavendra

  • Hi Guys,

     

    thank you for reply. finally i got it. just sharing

    CSL_FINS(gpioRegs->BANK[GP0].DIR,GPIO_DIR_DIR12,0);                //GP0[12] as output
    CSL_FINS(gpioRegs->BANK[GP0].DIR,GPIO_DIR_DIR14,0);                //GP0[14] as output

    CSL_FINS(gpioRegs->BANK[GP0].OUT_DATA, GPIO_OUT_DATA_OUT12, 1);    //GP0[12] high
    CSL_FINS(gpioRegs->BANK[GP0].OUT_DATA, GPIO_OUT_DATA_OUT14, 1);    //GP0[14] high

    CSL_FINS(gpioRegs->BANK[GP0].OUT_DATA, GPIO_OUT_DATA_OUT12, 0);    //GP0[12] low
    CSL_FINS(gpioRegs->BANK[GP0].OUT_DATA, GPIO_OUT_DATA_OUT14, 0);    //GP0[14] low