[En-Nut-Discussion] Sam7X and the USB Device Port

Eric Haver HaverEric1 at gmail.com
Tue Mar 24 02:51:06 CET 2009




Eric Haver wrote:
> 
> 
> I have converted the Atmel CDC-Serial example to run under NutOS.
> 
> When I enable Endpoint0 in the UDP_IER and in UDP_CSR0, I can see it in
> the
> UDP_IMR before I leave the interrupt, but on the next interrupt, the
> UDP_IMR
> does not show Endpoint0 enabled.
> 
> Any ideas?
> 
> 
> 

Answering my own question here.
The ATMEL defines are not exactly the same as the NutOS Defines:
ATMEL:
#define     AT91C_CKGR_USBDIV_0                    (0x0 << 28) // (CKGR)
Divider output is PLL clock output
#define     AT91C_CKGR_USBDIV_1                    (0x1 << 28) // (CKGR)
Divider output is PLL clock output divided by 2
#define     AT91C_CKGR_USBDIV_2                    (0x2 << 28) // (CKGR)
Divider output is PLL clock output divided by 4

In NutOS we see in at91_pmc.h:
#define CKGR_USBDIV_1               0x00000000  /*!< \brief Divider output
is PLL clock output. */
#define CKGR_USBDIV_2               0x10000000  /*!< \brief Divider output
is PLL clock output divided by 2. */
#define CKGR_USBDIV_4               0x20000000  /*!< \brief Divider output
is PLL clock output divided by 4. */

So when I converted:
    AT91C_BASE_CKGR->CKGR_PLLR |= AT91C_CKGR_USBDIV_1 ;

it should have become:
    outr(CKGR_PLLR, inr(CKGR_PLLR) | CKGR_USBDIV_2) ;

instead of the obvious.

Einfach ist es immer, nicht.

*E

-- 
View this message in context: http://www.nabble.com/Sam7X-and-the-USB-Device-Port-tp22545953p22672942.html
Sent from the MicroControllers - Ethernut mailing list archive at Nabble.com.




More information about the En-Nut-Discussion mailing list