This is the mail archive of the
mailing list for the eCos project.
AT91 GPIO read problem
- From: Steven Clugston <steven dot clugston at newcastle dot ac dot uk>
- To: "ecos-discuss at ecos dot sourceware dot org" <ecos-discuss at ecos dot sourceware dot org>
- Date: Tue, 18 Aug 2009 15:36:53 +0100
- Subject: [ECOS] AT91 GPIO read problem
I'm fairly new to AT91 and have been trying to use the platform macros to setup and read some GPIOs on an Olimex AT91SAM7S256 based board.
They provide their board pre-flashed with a demo program (no source) and you can press the micro switches to toggle/activate various board features using the program. The switches are externally pulled up.
With ecos, I can configure any gpio as an output and set it high or low without any problems, but when it comes to reading a pin's value it seems to always return 0 regardless of the logic level on it.
'value' is always 0. I've tried a couple of different boards in case the first one has been damaged somehow and different pins in case there is a perculiarity with a particular mulifunction pin.
HAL_READ_UINT32(AT91_PIO + AT91_PIO_PDSR, pdsr);
The pdsr status register never seems to change its value when the external logic level is changed.
The only example I can find is in the AT91 usb driver on the power pin.
Does anybody familiar with the AT91 have any ideas what school boy type error I might be making?
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss