Maker Pro
Maker Pro

friendly ARM MINI2440 port access help

anroop

Dec 11, 2013
65
Joined
Dec 11, 2013
Messages
65
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 ?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I have a doubt if the GPIO pins in a MINI2440 accessed programatically.

I think that board uses voodoo. Or maybe ESP.

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

azad200517

Jan 21, 2014
3
Joined
Jan 21, 2014
Messages
3
Accessing of GPIO pins of MCU

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 ?


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
 

anroop

Dec 11, 2013
65
Joined
Dec 11, 2013
Messages
65
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?
 
Top