Message: 1
Date: Thu, 14 Aug 2008 15:31:06 +0200
From: "Valentin Favreau" <[EMAIL PROTECTED]>
Subject: [uClinux-dev] Controlling GPIO on coldfire
To: uclinux-dev@uclinux.org
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="windows-1252"

Hey,
I'm new on uClinux/coldifre and I have a problem with the GPIO.

I found, on the Internet, that I just need to set up a pointer to the I/O
address to access to the I/O but when I run my application on uClinux the
error message "Memory Fault" appears and my application quit.

Here is my simple test code:

#define GPTADR (*(volatile unsigned char *)0x401a001d)
#define GPTADDR (*(volatile unsigned char *)0x401a001e)

int main(void){
    GPTADDR = 0xFF;

    return 0;
}

I'm working on the DNP/5280 board, Coldfire 5282.
I use this command to compile my code:
m68k-uclinux-gcc –Wall –m5307 –Wl,-elf2flt –Os –o hello hello.c –lc

Does anyone has an idea to solve my problem?
Thanks a lot!

Valentin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20080814/9999dc6c/attachment-0001.html

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

Valentin

Are you sure your GPIO addresses are correct? It will depend on the value of the MBAR register. I do direct I/O from userspace. I include the following header files then access as shown. In my case I am using a MCF5272 and accessing GPIO port C. There is also a m5282sim.h file.

#include <asm/coldfire.h>
#include <asm/m5272sim.h>
...
pcdat = *(volatile unsigned short *) (MCF_MBAR + MCFSIM_PCDAT);
pcdat &= 0xfeff;
*(volatile unsigned short *) (MCF_MBAR + MCFSIM_PCDAT) = pcdat;

Hope it helps,
Mark
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to