Connect with us

friendly ARM MINI2440 port access help

Discussion in 'Microcontrollers, Programming and IoT' started by anroop, Jan 20, 2014.

Scroll to continue with content
  1. anroop

    anroop

    65
    0
    Dec 11, 2013
    I have a doubt if the GPIO pins in a MINI2440 accessed programatically. The board is loaded with Android or Linux. can any help me ?
     
  2. anroop

    anroop

    65
    0
    Dec 11, 2013
  3. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,480
    2,826
    Jan 21, 2010
    I think that board uses voodoo. Or maybe ESP.

    Come on, how else but programatically would you access them?
     
  4. azad200517

    azad200517

    3
    0
    Jan 21, 2014
    Accessing of GPIO pins of MCU


    The GPIO pins can be accesed either using Bitwise operation on that whole register or by using enum, struct(Bit fields) etc. together.
    Actually the MCU pins are assigned to some specific registers (refer the Datasheet of that particular controller) and this registers are usually having a particular adderss something like REG = 0x12345678h

    Eg. It can be re-used for any register:

    typedef union // Generic 8-bit register Type
    {
    uint8 reg; // whole register
    struct
    {
    unsigned bit7 : 1; // Bit 7
    unsigned bit6 : 1; // Bit 6
    unsigned bit5 : 1; // Bit 5
    unsigned bit4 : 1; // Bit 4
    unsigned bit3 : 1; // Bit 3
    unsigned bit2 : 1; // Bit 2
    unsigned bit1 : 1; // Bit 1
    unsigned bit0 : 1; // Bit 0
    } bit;
    } GPIO_REG8; // Give the name using typedef

    So, now to define a port we want to address:

    #define MCU_GPIO_PORTx (*(volatile GPIO_REG8 *)(0x12345678)) // here Number is the address

    And to directly twiddle a pin on that port:

    #define MCU_PORTx_PINn (MCU_GPIO_PORTx.bit.bit0)

    In the code you can use:

    MCU_PORTx_PINn = 1; // Set pin high


    Entire register:

    MCU_GPIO_PORTx.reg = 0xF; // All pins high
     
  5. anroop

    anroop

    65
    0
    Dec 11, 2013
    I think the MCU is already programmed with its Firmware. Its GPIO pins (as in kit) are already denoted as EINT, CLK, ADC i/p, etc. It has a note that some of its pins are reusable, but no information of which pin is reusable!!. I mostly don't know about the software side for making the configuration. can anyone with info. help me?
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-