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.

AM3358 EVM - SIMPLE CODE TO TOGGLE J16 (MAVRK CONNECTOR) GPIO1_D0 PIN (AM335X_GPMC_A0) USING SYS/BIOS

Other Parts Discussed in Thread: SYSBIOS

Looking for a sample project to:

1) simply toggle the J16 (MAVRK CONNECTOR) GPIO1_D0 PIN using SYS/BIOS

2) used HWI to trigger and interrupt based on a Digital Input in 1)

I've seen the SYS/BIOS videos but the example don't seem to cover the AM335x (Sitara) processor. I've tried the examples from the Starterware (../ti\AM335X_StarterWare_02_00_01_01\platform\evmAM335x) . Most of the projects seem to use Beaglbone or Linux. I have also tried the PINMUX programs to set up the pins with no luck.

I've also referenced the AM335x ARM® Cortex™-A8 Microprocessors (MPUs) Technical Reference Manual (TRM) section 25 General-Purpose Input/Output (GPIO)

Could someone provide  sample code or link to either a project or a walkthrough instructions

My Environment:

Windows 7 with CCS6.x;  SYS/BIOS

Using AM3358 EVM (Note the actual processor is AM3359) with the TI XDS2xx USB Debug Probe

Thanks

  • Rob,

    I haven’t found any GPIO toggle examples using SYS/BIOS on AM335x.  You said you tried PINMUX programs with no success.  Can you please describe what you did and what didn’t work?  It may be best to get that working before trying with SYS/BIOS...

    Thanks,
    Scott

  • I'm surprised at the lack of documentation for this processor. I'm simply trying to use it like a micro-controller that has a high speed response to to pulses on the GPIO using a RTOS to detect the starting edges    - Its kind of unique in the industry. I don't really need the more advanced features of the chip at this time.

    I'm able to start a BIOS typical project project and run it using XDS200 Debugger.. I'm able to ad a HWI in the app.cfg screen using GPIO1A interrupt number 19 (20 is used for GPIO1_B). I would simply like to detect the edged based on this HWI and start a timer/ counter to count pulses on another digital in. I was hoping to use something like the following code (which is a combination of the sample program with the added GPIOINIT(). GPIO1Afn() is the function to handle the HWI for GPIO1_A interrupt 19. (there is no specific pinmux for this code):

    *  ======== main.c ========

    */

    //#include <gpio.h>

    #include <gpio_v2.h>

    #include <hw_gpio_v2.h>

    #include <xdc/std.h>

    #include <hw_control_AM335x.h>

    #include <hw_usbOtg_AM335x.h>

    #include <soc_AM335x.h>

    #include <xdc/runtime/Error.h>

    #include <xdc/runtime/System.h>

    #include <ti/sysbios/BIOS.h>

    #include <ti/sysbios/knl/Task.h>

    /*

    *  ======== taskFxn ========

    */

    Void taskFxn(UArg a0, UArg a1)

    {

       System_printf("enter taskFxn()\n");

       Task_sleep(10);

       System_printf("exit taskFxn()\n");

       System_flush(); /* force SysMin output to console */

    }

    void GPIOInit()

    {

    /*GPIOModuleEnable();

    GPIOModuleReset();

    GPIODirModeSet();

    GPIODebounceFuncControl();

    GPIODebounceTimeConfig();

    GPIOIntTypeSet();

    GPIOPinIntEnable();

    GPIOPinWrite();

    */

    /* Enabling functional clocks for GPIO1 instance. */

       GPIO1ModuleClkConfig();

       /* Selecting GPIO1[23] pin for use. */

       GPIO1Pin23PinMuxSetup();

       /* Enabling the GPIO module. */

       GPIOModuleEnable(GPIO_INSTANCE_ADDRESS);

       /* Resetting the GPIO module. */

       GPIOModuleReset(GPIO_INSTANCE_ADDRESS);

       /* Setting the GPIO pin as an output pin. */

       GPIODirModeSet(GPIO_INSTANCE_ADDRESS,

                      GPIO_INSTANCE_PIN_NUMBER,

                      GPIO_DIR_OUTPUT);

    }

    }

    int GPIO1Afn()

    {

    int result1 = 0;

    return(result1);

    }

    /*

    *  ======== main ========

    */

    Int main()

    {

    GPIOInit();

       Task_Handle task;

       Error_Block eb;

       System_printf("enter main()\n");

       Error_init(&eb);

       task = Task_create(taskFxn, NULL, &eb);

       if (task == NULL) {

           System_printf("Task_create() failed!\n");

           BIOS_exit(0);

       }

       BIOS_start();    /* does not return */

       return(0);

    }

  • Rob,

    I downloaded the AM335x StarterWare and looked at the GPIO examples.  I think what is missing from your code is the configuration and enabling of the GPIO interrupt.   The gpio_card_detect example (examples/evmskAM335x/gpio_card_detect) shows examples of these calls:

    GPIOINTCConfigure()
    GPIOIntTypeSet()
    GPIOPinIntEnable()

    I see mention of the last two of these in the comments in your code, but the calls are missing from the actual code.

    You'll probably want to add calls to GPIODebounceFuncControl() and GPIODebounceTimeConfig() too, as described in this wiki page: processors.wiki.ti.com/.../StarterWare_GPIO_V2

    I’ve not used StarterWare, but I think you need to add at least these interrupt enable calls before the Hwi you’ve created can be triggered.

    Regards,
    Scott