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.

6747 GPIO's

Other Parts Discussed in Thread: OMAP-L137

 

I'm trying to toggle GPIO 72 and 92. (72 is pin AXR1[7]/EPWM1B/GP4[7])   92 is pin AXR1[11]/GP5[11])

I looked at the Code in the EVM and modified it to work with my GPIOs but they are not working.

I call

    EVMC6747_GPIO_setDirection( 72, GPIO_OUT );
    EVMC6747_GPIO_setDirection( 92, GPIO_OUT );

at the beginning,

then do

{

        EVMC6747_GPIO_setOutput( 72, 1)

        EVMC6747_waitusec( 25000 );

        EVMC6747_GPIO_setOutput( 72, 0);

        EVMC6747_waitusec( 25000 );

}

in a loop forever and it does not change. GPIO 92 does the same thing. Using 12-15 works fine on the EVM. What am I missing?

Ringo

 

  • Have you made sure these are configured as GPIO pins via PINMUX registers (PINMUX13[15:12] and PINMUX8[27:24])?

  • I'm setting it like this in Main() , Am I doing it wrong?

        PINMUX8 = PINMUX8 | 0x8000;//bit 12-15 = 0x08
        PINMUX13 = PINMUX13 | 0x8000000;//bit 24-27=0x08

  • I have the numbers backwards, it should be

        PINMUX8 = PINMUX8 | 0x8000000;//
        PINMUX13 = PINMUX13 |  0x8000 ;//

    but it still does not work.

  • This comes from the Ch 2.9 of the GPIO Guide:

    The following steps are required to configure the GPIO module after a hardware reset:

    1. Perform the necessary device pin multiplexing setup (see your device-specific data manual).
    2. Program the Power and Sleep Controller (PSC) to enable the GPIO module. For details on the PSC, see see your device-specific System Reference Guide.
    3. Program the direction, data, and interrupt control registers to set the configuration of the desired GPIO pins (described in this document).

    The GPIO module is now ready to perform data transactions.

    We have already covered #1 and #3, but we have not discussed configuring the PSC to ensure the GPIO module is powered up. Have you done this already? PSC1.LPSC3 controls whether or not the GPIO module is powered.

  • No I have not configured that. I assumed it was already configured since GPIOS 12-15 work. I'm reading sprufk4c now trying to figure out how to configure it but it is very confusing.

    Is it bits 0-2 of register MDCTL3 I have to set? If so is the register at 0xA12?

  • In the Gel File there is this:

    etup_Psc_All_On( )
    {
        int i;
        GEL_TextOut( "Setup Power Modules (All on)... " );

        // PSC0
        PSC0_lPSC_enable(0, 0);
        PSC0_lPSC_enable(0, 1);
        PSC0_lPSC_enable(0, 2);
        PSC0_lPSC_enable(0, 3);  // EMIFA
        PSC0_lPSC_enable(0, 4);
        PSC0_lPSC_enable(0, 5);
        PSC0_lPSC_enable(0, 6);
        PSC0_lPSC_enable(0, 8);
        PSC0_lPSC_enable(0, 9);
        PSC0_lPSC_enable(0, 10);
        PSC0_lPSC_enable(0, 11);
        PSC0_lPSC_enable(0, 12);
        PSC0_lPSC_enable(0, 13);

        // PSC1
        PSC1_lPSC_enable(0, 1);
        PSC1_lPSC_enable(0, 2);
        PSC1_lPSC_enable(0, 3);
        PSC1_lPSC_enable(0, 4);
        PSC1_lPSC_enable(0, 5);
        PSC1_lPSC_enable(0, 6);  // EMIFB
        PSC1_lPSC_enable(0, 7);
        PSC1_lPSC_enable(0, 8);
        PSC1_lPSC_enable(0, 9);
        PSC1_lPSC_enable(0, 10);
        PSC1_lPSC_enable(0, 11);
        PSC1_lPSC_enable(0, 12);
        PSC1_lPSC_enable(0, 13);
        PSC1_lPSC_enable(0, 16);
        PSC1_lPSC_enable(0, 17);
        PSC1_lPSC_enable(0, 20);
        PSC1_lPSC_enable(0, 21);
        PSC1_lPSC_enable(0, 24);
        PSC1_lPSC_enable(0, 25);
        PSC1_lPSC_enable(0, 26);
        PSC1_lPSC_enable(0, 31);

        GEL_TextOut( "[Done]\n" );
    }

     

    Is the line

        PSC1_lPSC_enable(0, 3);

    what I should be looking at? IF so is setting it to 0 correct? I would have thought I would set it to 3 from the SPRU if I was right about how to set it, but Since GPIO 12-15 work I must be missing something.

    Ringo

  • I wrote a quick little code snippet using #define statements for the necessary registers to remove the dependency of a library.

    #define PINMUX8 (*(int *)0x01C14140)
    #define PINMUX13 (*(int *)0x01C14154)

    #define GPDIR45 (*(int *)0x01E26060)
    #define GPSET45 (*(int *)0x01E26068)
    #define GPCLR45 (*(int *)0x01E2606C)

    void main(){
     PINMUX8 |= 0x8000000;
     PINMUX13 |= 0x8000 ;

    GPDIR45 &= ~((1 << 7) | (1 << 27));

     while(1){
      GPSET45 = (1 << 7) | (1 << 27);
      GPCLR45 = (1 << 7) | (1 << 27);
     }
    }
    If I place breakpoints on each of the statements within the while loop I am able to see the OUT_DATA45 register at address 0x01E26064 toggle between 0x00000000 and 0x08000080. Are you not able to see this behavior using your code?

  • I tried the code above and I do see out_data45 toggle from 0x00 to 0x08000080 on every step. However the pin never changes.

    Ringo

     

  • GPIO72 is low when I power up the board, GPIO 92 is high. When I run the code they never change.

    I changed the code to

    // PINMUX8 |= 0x8000000;
    // PINMUX13 |= 0x8000 ;
     PINMUX8 &= 0x0ffffff;
     PINMUX13 &= 0xf000 ;

    so the pins should be tri-stated but it still stays 1 low, 1 high.

    What else could be messing with the pins?

    Ringo

     

  • I think we were messing up our bit-level logic. I got out a scope and changed my PINMUX logic to this

     PINMUX8 &= ~(0xF000000);
     PINMUX8 |= 0x8000000;
     PINMUX13 &= ~(0xF000);
     PINMUX13 |= 0x8000;
    This clears out the field then ORs in the value I want for that particular field. Once I made certain the correct value was in the PINMUX register I was able to control the output on each pin.

    I am using Spectrum Digital's prototype board for the OMAP-L137 EVM to view the output. How are you scoping the pins with your hardware?

  • I have LEDS on the pins and I have removed the leds and am watching the pins on an O'scope and single stepping through the code. I tried the code you just posted and still get the same thing. What Gel file are you using?I'm using the evmc6747_dsp.gel, could there be something in there conflicting?

    Ringo

     

  • I am also using the evmc6747_dsp.gel file. I am not sure how often they update the 'version' number but mine is listed as v1.02 at the top in the comments. I do not think that this is important though.

    I am not sure what else to suggest at this point other than to make certain you are looking at the correct pins. I can attach the source code I used to test this on the EVM but considering I have already copied all my code throughout this thread I don't think it would help. I'll post it all at once just in case it does...

    void main(){
     // GP4[7] and GP5[11] configured as GPIO pins
     PINMUX8 &= ~(0xF000000);
     PINMUX8 |= 0x8000000;
     PINMUX13 &= ~(0xF000);
     PINMUX13 |= 0x8000;

     // PSC configuration handled in GEL
     
     // GP4[7] and GP5[11] configured as outputs
    GPDIR45 &= ~((1 << 7) | (1 << 27));

     // Toggle output on both pins
     while(1){
      if((GPSET45 & (0x80)) != 0x80){
       GPSET45 = (1 << 7) | (1 << 27);
      }
      else{
       GPCLR45 = (1 << 7) | (1 << 27);
      }
     // Some delay loop
     }
    }
  • I pasted your code into my Main and still no luck. I have GP1[8] through 10 on terst points so I also tried this code

    #define GPDIR01     (*(int *)0x01E26010)
    #define GPSET01     (*(int *)0x01E26018)
    #define GPCLR01     (*(int *)0x01E2601C)

     PINMUX16 &= ~(0xF000000);
     PINMUX16 |= 0x88000000;
     PINMUX17 &= ~(0xF000000);
     PINMUX17 |= 0x00000008;

      GPDIR01 |= (1 << 24) | (1 << 25) | (1 << 26);

     while(1)
     {
      GPSET01 = (1 << 24) | (1 << 25) | (1 << 26);
      GPCLR01 = (1 << 24) | (1 << 25) | (1 << 26);
     }

     

    but it does not work either.

    The original code to blink GPIO 12-15 does appear to work though, THose pins are multiplexed with HPI pins that I happen to have resistors on so I can see them toggle with the scope. The chips I have are the TMX, not TMS, would this make a difference?

    Ringo

     

  • I had an error in the DIR code I just posted. It is fixed now but still none of them work. Here is my Main

    void main( void )
    {

    #define PINMUX8 (*(int *)0x01C14140)
    #define PINMUX13 (*(int *)0x01C14154)
    #define GPDIR01     (*(int *)0x01E26010)
    #define GPSET01     (*(int *)0x01E26018)
    #define GPCLR01     (*(int *)0x01E2601C)
    #define OUT_DATA01     (*(int *)0x01E26014)

    #define GPDIR45     (*(int *)0x01E26060)
    #define GPSET45     (*(int *)0x01E26068)
    #define GPCLR45     (*(int *)0x01E2606C)
    #define OUT_DATA45     (*(int *)0x01E26064)

     PINMUX8 &= ~(0xF000000);
     PINMUX8 |= 0x8000000;
     PINMUX13 &= ~(0xF000);
     PINMUX13 |= 0x8000;

     PINMUX16 &= ~(0xF000000);
     PINMUX16 |= 0x88000000;
     PINMUX17 &= ~(0xF000000);
     PINMUX17 |= 0x00000008;

     // PSC configuration handled in GEL
     
     // GP4[7] and GP5[11] configured as outputs
    GPDIR45 &= ~((1 << 7) | (1 << 27));
    GPDIR01 &= ~((1 << 24) | (1 << 25) | (1 << 26));

     // Toggle output on both pins
     while(1)
     {
      GPSET45 = (1 << 7) | (1 << 27);
      GPCLR45 = (1 << 7) | (1 << 27);
      GPSET01 = (1 << 24) | (1 << 25) | (1 << 26);
      GPCLR01 = (1 << 24) | (1 << 25) | (1 << 26);
     }

    }

    I'm not sure what to do next. I have 3 DSP's per board and I have tried different boards and they all act the same. I can read and write to external DRAM so I know the chip is working ok, just can't use any of these GPIO's

    Ringo

     

  • lester davis said:
     PINMUX16 &= ~(0xFF000000);
     PINMUX16 |= 0x88000000;
     PINMUX17 &= ~(0xF);
     PINMUX17 |= 0x00000008;

    There's still a couple errors in here (see bolded fixes), but there definitely seems to be a bigger issue at play. Can you verify that the PINMUX and PSC registers are properly configured? The PINMUX registers should look something like this:

    PINMUX8 = 0xn8nnnnnn
    PINMUX13 = 0xnnnn8nnn
    PINMUX16 = 0x88nnnnnn
    PINMUX17 = 0xnnnnnnn8
    and the PSC registers should all equal 0x00001E03 (the '3' denoting enabled). Assuming these are all configured properly you should see the pins toggle...

  • I finally got it working. Apparently it was a Code composer issue.

    I was working in the Lab using my board and the 510USB Emulator. I dug out my EVM board and tried the code on it and it did not work. So then I tried the original LED project that came with the EVM (since I know it works) and it did not work either. I took the EVM back to my Cubicle and connected it via USB (no emulator) and tried the LED project there and it worked. So I thought maybe it had something to do with the emulator. I went back to the lab with the USB cable and attached it there. I had to reinstall the Emulator driver to get it to work. When I tested the board it worked! So now I switched from the cable to the emulator and it worked as well. I put the EVM up and went back to my board and now it works. Something in reinstalling the driver must have fixed something. It works on every board now.

    Ringo

  • Goodness, talk about an odd issue. I would have never suspected this... Well, in any case I am glad to hear you got this resolved!