Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Reading GPIO port on AT91SAM9g45
PostPosted: Sat Mar 03, 2012 7:26 am 
Offline

Joined: Wed Mar 02, 2011 1:06 pm
Posts: 4
HI there,

I am interfacing a 16-Bit ADC to AT91SAM9g45 with Embedded Linux OS. I have connected the ADC 16-Bit data bus to port c (PORTC15..PORT30). How can I read the port C or any port on this controller as a whole? Any help would be helpful..

Pankaj C


Top
 Profile  
 
 Post subject: Re: Reading GPIO port on AT91SAM9g45
PostPosted: Sun Mar 04, 2012 1:48 am 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 784
Presumably you could write a driver, or mmap the PIO memory.


Top
 Profile  
 
 Post subject: Re: Reading GPIO port on AT91SAM9g45
PostPosted: Mon Mar 05, 2012 12:16 am 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 330
Location: USA
CptTitanic wrote:
Presumably you could write a driver, or mmap the PIO memory.


Agreed, those are your two choices. However, a device driver would be the preferred method of preserving the integrity & security of the Linux kernel. Mmapping in userland code is the quick & dirty method that is only tolerated on secure embedded platforms.

Regards


Top
 Profile  
 
 Post subject: Re: Reading GPIO port on AT91SAM9g45
PostPosted: Mon Mar 05, 2012 5:30 am 
Offline

Joined: Wed Mar 02, 2011 1:06 pm
Posts: 4
Hi.. Thanks for your reply. I am indeed trying to write a driver for the same. But I driver module I don't know how to access the GPIO port as a parallel port.

What is the function used to do it.

Regards

Pankaj C


Top
 Profile  
 
 Post subject: Re: Reading GPIO port on AT91SAM9g45
PostPosted: Mon Mar 05, 2012 3:59 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 784
pankajcamb wrote:
But I driver module I don't know how to access the GPIO port as a parallel port.

What is the function used to do it.


You'd read the PIO_PDSR register from the PIOC

This is an example GPIO driver, but you'll likely need to adapt the code to read 16-bits in a single operation.

http://www.cs.fsu.edu/~baker/devices/lx ... t91/gpio.c


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: