This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: AT91 GPIO read problem


>> 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.

>> cyg_bool value
>> HAL_ARM_AT91_GPIO_CFG_DIRECTION(AT91_GPIO_PA29, AT91_PIN_IN);
>> HAL_ARM_AT91_GPIO_GET(AT91_GPIO_PA29, value);

>> '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.
>> Does anybody familiar with the AT91 have any ideas what school boy type error I might be making?

> Did you enable the clock to the GPIO subsystem? Output works without a
> clock, input does not. Look in i think the power management section of
> the manual.

>       Andrew

No, I didn't even know there was a GPIO subsystem that needs a clock, but now I know that fixed it:

HAL_WRITE_UINT32 (AT91_PMC + AT91_PMC_PCER, AT91_PMC_PCER_PIOA);

Thanks Andrew, there is only brief mention of it in the 757 page AT91SAM7 manual, so it might have taken me awhile to chance upon it.

Regards,

Steven


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]