This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Again with AT91SAM7X-EK
Quoting Andrew Lunn <andrew@lunn.ch>:
> 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
>
I tried with your code using AT91_PWM_PWM0 and even with AT91_GPIO_PB19, but the
led won't turn on.
I think the problem is somewhere else, after compiling my code i pass the elf
file through objcopy to obtain the binary that i put on my board with sam-ba,
maybe this is not the correct way to work with?
Andrea
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss