• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Digital Signal Processors (DSP) » C5000 Ultra Low Power DSP » C5000 Ultra Low Power DSP Forum » Enabling AGPIO on the 5507/5509A
Share
C5000 Ultra Low Power DSP
  • Forum
  • Announcements
Options
  • Subscribe via RSS
Top 6 Wiki Links
  • C5000 Main Wiki
  • C5000 Software
  • C5515 Boot-Image Programmer
  • CSL (including CSL 3.00)
  • C5000 Connected Audio Framework
  • Porting C5000 Teaching ROM to C5535 eZdsp
  • Forums

    Enabling AGPIO on the 5507/5509A

    This question is not answered
    Stirling Cosson
    Posted by Stirling Cosson
    on Mar 04 2012 23:39 PM
    Prodigy40 points

    I have a product I have designed using the 5507.  I want to use the address lines of the EMIF as GPIOs.  It seems it should be easy enough to do:

    1) Make sure GPIO0 is pulled LOW at RESET

    2) Set bits 0 and 1 of ESBR to "00" or "11" to ensure the address lines can be configured as GPIOs

    3) Enable whichever AGPIO lines I want to use - in my case, those are AGPO 0-7.

    4) Set the direction of the enabled I/Os, either input or output

    5) Read/write from the input/output

    Sounds easy, but after a week of banging my head against the wall, I am still unable to read the inputs properly.  I have a hex-coded rotary switch on AGPIO (0:3), but when I read the port, it does not correspond to the values on the pins.

    I am using CCS 3.1 (yes, it is old, I know - but licensed).  I modified my .gel file to add the I/O space for the AGPIO:

    /* IO Space */
        GEL_MapAdd(0x0000,2,0x0400,1,1);    /* RHEA 1KW */
        GEL_MapAdd(0x0400,2,0x0300,1,1);    /* EMULATION */
        GEL_MapAdd(0x0800,2,0x0400,1,1);    /* EMIF 1KW */
        GEL_MapAdd(0x0C00,2,0x0400,1,1);    /* DMA 1KW */
        GEL_MapAdd(0x1000,2,0x0400,1,1);    /* TIMER#0 1KW */
        GEL_MapAdd(0x1400,2,0x0400,1,1);    /* ICACHE 1KW */
        GEL_MapAdd(0x1C00,2,0x0400,1,1);    /* CLKGEN 1KW */
        GEL_MapAdd(0x2000,2,0x0400,1,1);    /* TRACE FIFO 1KW */
        GEL_MapAdd(0x2400,2,0x0400,1,1);    /* TIMER#1 1KW */
        GEL_MapAdd(0x2800,2,0x0400,1,1);    /* SERIAL PORT#0 1KW */
        GEL_MapAdd(0x2C00,2,0x0400,1,1);    /* SERIAL PORT#1 1KW */
        GEL_MapAdd(0x3000,2,0x0400,1,1);    /* SERIAL PORT#2 1KW */
        GEL_MapAdd(0x3400,2,0x0400,1,1);    /* GPIO 1KW */
        GEL_MapAdd(0x3800,2,0x0400,1,1);    /* ID 1KW */
    //    GEL_MapAdd(0x3800,2,0x0400,1,1);    /* ID 1KW */
        GEL_MapAdd(0x4400,2,0x0006,1,1);    /* AGPIO */
        GEL_MapAdd(0x5800,2,0x2800,1,1);    /* USB Regs and Buffer */

    This didn't seem to enable the I/O memory space by itself inside CCS, so I added the following in the OnTargetConnect section:

    OnTargetConnect()
    {
    GEL_MemoryFill(0x6C00,2,1,0x0203); //set ESBR parallel bits to binary 11 - allows for AGPIO
    GEL_MemoryFill(0x4400,2,1,0xFFFF); //enable all the address lines as AGPIO
    GEL_MemoryFill(0x4401,2,1,0xFFC0); //set the direction (input/output) so that bits 0-5 are inputs and 6-7 are outputs
    GEL_MemoryFill(0x4402,2,1,0xFFFF); //set the AGPIO data port to 0xFFFF
        init_emif();
    }

    The "init_emif()" was a section I had added before, when I had thought I would require an external SDRAM for storage.  I have removed the SDRAM from my board.  If I try to remove init_emif(), I can't get the target to connect properly in CCS:

    init_emif()
    {
      *( unsigned int* )0x0801@IO = 0x0;       // EMI_RST
      *( unsigned int* )0x0800@IO = 0x0220;   // EGCR
      *( unsigned int* )0x0803@IO = 0x3FFF;   // EMIF CE0_1
      *( unsigned int* )0x0804@IO = 0x5FFF;   // EMIF CE0_2
      *( unsigned int* )0x0805@IO = 0x0;       // EMIF CE0_3
      *( unsigned int* )0x0806@IO = 0x3FFF;   // EMIF_CE1_1
      *( unsigned int* )0x0807@IO = 0x5FFF;   // EMIF_CE1_2
      *( unsigned int* )0x0808@IO = 0x0000;   // EMIF_CE1_3
      *( unsigned int* )0x0809@IO = 0x3FFF;   // EMIF_CE2_1
      *( unsigned int* )0x080A@IO = 0x5FFF;   // EMIF_CE2_2
      *( unsigned int* )0x080B@IO = 0x0000;   // EMIF_CE2_3
      *( unsigned int* )0x080C@IO = 0x3FFF;   // EMIF_CE3_1
      *( unsigned int* )0x080D@IO = 0x5FFF;   // EMIF_CE3_2
      *( unsigned int* )0x080E@IO = 0x0000;   // EMIF_CE3_3
      *( unsigned int* )0x080F@IO = 0x3522;   // SDC1
      *( unsigned int* )0x0810@IO = 0x0100;   // SDPER
      //*( unsigned int* )0x0811@IO = 0x0FFF; // SDCNT
      *( unsigned int* )0x0812@IO = 0x0000;   // INIT
      *( unsigned int* )0x0813@IO = 0x0242;   // SDC2
    //  *( unsigned int* )0x0814@IO = 0x0003;   // SDC2
    }

    When I open CCS and connect to the target (leaving init_emif in the .gel), it works fine, but I/O address space 0x4400 is inaccessible, all dashes. Curiously, if I then "Load GEL" and load the exact same .gel file I used to connect, 0x440x is then accessible.

    However, when I step through my code and read the data from pins AGPIO 0-4, the reading is in no way related to the setting of the hex switch.  I have tried doing both GPIO_pinRead commands:

    Gpin0 = GPIO_pinRead(AGPIO_PIN0);
    Gpin1 = GPIO_pinRead(AGPIO_PIN1);
    Gpin2 = GPIO_pinRead(AGPIO_PIN2);
    Gpin3 = GPIO_pinRead(AGPIO_PIN3);

    and have defined a variable to read the memory location at 0x4402, which is supposed to contain the values on the pins:

    ioport volatile Uint16 * AGPIODATA = (ioport volatile Uint16 *)0x4402; //variable definition

    hex_switch_input = *AGPIODATA; //reading the data at I/O port 0x4402

    Neither method works.  I am so puzzled and frustrated.  Does anybody have ideas what I might be doing wrong?  Thank you.





    5507 GPIO "enable AGPIO" AGPIO .gel
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Stirling Cosson
      Posted by Stirling Cosson
      on Mar 13 2012 20:45 PM
      Prodigy40 points

      I'm still having the problem.  Any suggestions?

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Steve Tsang
      Posted by Steve Tsang
      on Mar 14 2012 10:28 AM
      Genius13285 points

      Hi Stirling,

      I can understand your feeling. The way to enable GPIO is correct.

      I tried to duplicate your inputs with an VC5509A DSK. I am using CCS3.3 (as close as I can to yours).

      I added these into my OnTargetConnect without setting the data to see what I can read. All the other changes as the same.

      GEL_MemoryFill(0x6C00,2,1,0x0203); //set ESBR parallel bits to binary 11 - allows for AGPIO
      GEL_MemoryFill(0x4400,2,1,0xFFFF); //enable all the address lines as AGPIO
      GEL_MemoryFill(0x4401,2,1,0xFFC0); //set the direction (input/output) so that bits 0-5 are inputs and 6-7 are outputs
      //GEL_MemoryFill(0x4402,2,1,0x0000); //set the AGPIO data port to 0xFFFF
          init_emif();

      I can connect to CCS and read 0x4400 as:

      0x00004400    0xFFFF    0xFFC0    0x0000
      0x00004403    0x0000    0x0000    0x0000
      0x00004406    ----    ----    ----
      0x00004409    ----    ----    ----

      I hope this information helps in your debug.

      Regards.




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

      Please click the Verify Answer button on this post if it answers your question

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

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Stirling Cosson
      Posted by Stirling Cosson
      on Mar 14 2012 21:46 PM
      Prodigy40 points

      Steve,

      I appreciate your replying.  I am able to get the AGPIO data port to read my input pins properly when first doing the target connect.  However, once I start stepping through my code, if I change the input values and try to read those new values, the new input values are not read from the AGPIO pins.

      I tried two ways:

      Gpin0 = GPIO_pinRead(AGPIO_PIN0);
      Gpin1 = GPIO_pinRead(AGPIO_PIN1);
      Gpin2 = GPIO_pinRead(AGPIO_PIN2);
      Gpin3 = GPIO_pinRead(AGPIO_PIN3);

      This method does not reflect any changes made on the inputs.

      I also have defined a variable to read the memory location at 0x4402, which is supposed to contain the values on the pins:

      ioport volatile Uint16 * AGPIODATA = (ioport volatile Uint16 *)0x4402; //variable definition

      hex_switch_input = *AGPIODATA; //reading the data at I/O port 0x4402

      This also does not read any changes made to the input pin values.

      Do you see anything wrong with what I am doing?

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Stirling Cosson
      Posted by Stirling Cosson
      on Mar 20 2012 20:14 PM
      Prodigy40 points

      I figured it out.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use