« Return to Thread: Sam7X and the USB Device Port

Re: Sam7X and the USB Device Port

by Eric Haver :: Rate this Message:

Reply to Author | View in Thread


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

 « Return to Thread: Sam7X and the USB Device Port