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.

Parallel Gpio Toggle

Hello..

i required parallel toggle gpio pin at 1-2MHz.

Required No.Of GPIO:64

So give me sample code how to do this if you know about that.

ans suggest me SBC (Single Board Computer) for above requirement satisfied.

  • Hi Dipen,

    The GPIOs are able to operates at frequencies about 1 - 2 MHz. There is nothing specific with GPIO 64.

    Could you give some more clarifications about where you would like to manage the gpio - in Kernel space or in userspace application?

    BR

    Tsvetolin Shulev

  • Hello,

    Thanks For Reply,

    Yes i know it is not specific with GPIO64.

    I wan't to manage gpio from kernel space.

    i take benchmark so i found gpio rise or fall time not more than 20Khz in My Arm Board.

    so i want to increase that time.


    SO How can i achieve 1-2Mhz Rise / Fall time?

  • Hi Dipen,

    There are basically two ways to control a GPIO pins from userspace: sysfs or memory mapping. But the first necessary step before start control a GPIO pin is to configure it. There is a link to a tutorial about pinmux configuring:

    http://elinux.org/BeagleBoardPinMux

    After the desired GPIO has been configured you are ready to control it. The simplest way is by using sysfs control. This way is describe in the linked article:

    http://processors.wiki.ti.com/index.php/GPIO_Driver_Guide

    The more advanced way is to use memory mapping to map OMAP peripheral memory into my user space application. This way I can access OMAP registers directly instead of having to go through device drivers. So you can only accessed the GPIO registers to play with the user LEDs for example. Look at the example source code below:

        int fd = open("/dev/mem", O_RDWR);
        volatile ulong *A;
        if (fd < 0) {
             printf("Could not open file\n");
             return;
        }
        A = (ulong*) mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x49050000);
        if (A == MAP_FAILED) {
             printf("Mapping failed\n");
             close(fd);
             return;
        }
        A[0x603C / 4] |= 0x600000;   // Turn on LEDs

    BR

    Tsvetolin Shulev