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: Again with AT91SAM7X-EK


On Wed, Feb 07, 2007 at 09:50:21AM +0100, Andrea Visinoni wrote:
> Excuse me to open another post on the same argoment, but i've deleted all mail
> of the other post, and i cant find a way to reply to them.
> this is my current situation, and i still don't know if my board is correctly
> initialized...the led is off.
> 
> * my code
> #include <stdio.h>
> #include <cyg/hal/hal_io.h>
> 
> int main(void)
> {
>     HAL_WRITE_UINT32(AT91_PIOB + AT91_PIO_PER, 1 << 22);
>     HAL_WRITE_UINT32(AT91_PIOB + AT91_PIO_OER, 1 << 22);
> 
>     HAL_WRITE_UINT32(AT91_PIOB + AT91_PIO_CODR, 1 << 22);
> 
>     for (;;);
> }

As i suggested, use the GPIO macros in var_io.h. Assuming your LED is
connected to pin AT91_PWM_PWM0, which for the AT91SAM7S development
board i have is correct, the code would look something like:

 // Configure the pin to be used as a GPIO pin, and set the direction
 // to be an output.
 HAL_ARM_AT91_GPIO_CFG_DIRECTION(AT91_PWM_PWM0,AT91_PIN_OUT);

  while (true) {
     // Set the output, which turns the LED off on the AT91SAM7SEK
     HAL_ARM_AT91_GPIO_SET(AT91_PWM_PWM0);
 
     // Dum du dum du dum.
     cyg_thread_delay(100);

     // Reset the output, which turns the LED on on the AT91SAM7SEK
     HAL_ARM_AT91_GPIO_RESET(AT91_PWM_PWM0);

     // Dum du dum du dum.
     cyg_thread_delay(100);
 }

 Andrew

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