This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: PWM initialization on at91sam7sek
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Rasmus Stougaard <stou dot nospam at gmail dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Thu, 11 Oct 2007 14:55:55 +0200
- Subject: Re: [ECOS] PWM initialization on at91sam7sek
- References: <dbc951020710110544x72872855iba00418c68429436@mail.gmail.com>
> // Enable PWM interrupts
> HAL_WRITE_UINT32(AT91_PWM + AT91_PWM_IER, (1 << AT91_PWM_CHANNEL_ID_0));
>
> // Enable the pwm generator for channels
> HAL_WRITE_UINT32(AT91_PWM + AT91_PWM_ENA, (1 << AT91_PWM_CHANNEL_ID_0));
>
> // configure pin as output
> HAL_ARM_AT91_GPIO_CFG_DIRECTION(STOU_PWM_PIN, AT91_PIN_OUT);
This last call is wrong. You want the pin to be driven by the
peripheral, not the PIO controller. So you need to call
HAL_ARM_AT91_PIO_CFG(STOU_PWM_PIN)
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