Motorola MPC823e Reference Manual page 832

Microprocessor for mobile computing
Table of Contents

Advertisement

Communication Processor Module
16.10.8.11 USB CONTROLLER INITIALIZATION EXAMPLE (FUNCTION MODE). The
following is an example initialization sequence for the USB controller operating in function
mode. It can be used to set up four function endpoints (0–3) that fill up transmit FIFOs, so
that data is ready for transmission when an IN token is received from the USB. You can
generate the token by using a USB traffic generator.
1. Write 0x00010000 to the BRGC1 register for division factor 1 to produce 48MHz,
assuming the system clock is 48MHz.
2. Clear the DR14 and DR15 bits of the PADIR. Set the DD14 and DD15 bits of the
PAPAR to select the USBRXD and USBOE pins.
3. Clear the DR10 and DR11 bits of the PCDIR. Set the DD10 and DD11 bits of the
PCPAR and the CD1 and CTS1 bits of the PCSO to select the USBRXP and USBRXN
pins.
4. Set the DR6 and DR7 bits of the PCDIR and the DD6 and DD7 bits of the PCPAR to
select the USBTXP and USBTXN pins.
5. Write 0x0000 to initialize the FRAME_N parameter.
6. Write DPRAM+500 to the EP0PTR and DPRAM+520 to the EP1PTR to set up the
endpoint 0 and 1 pointers.
7. Write DPRAM+540 to the EP2PTR and DPRAM+560 to the EP3PTR to set up the
endpoint 2 and 3 pointers.
8. Write 0xBC800004 to DPRAM+20 to set up the various status and DATA LENGTH
fields of the endpoint 0 TX buffer descriptor.
9. Write DPRAM+200 to DPRAM+24 to set up the TX DATA BUFFER POINTER field of
the endpoint 0 TX buffer descriptor.
10. Write BCC00004 to DPRAM +28 to set up the status and DATA LENGTH fields of the
endpoint 1 TX buffer descriptor.
11. Write DPRAM+210 to DPRAM+2C to set up the DATA BUFFER POINTER field of the
endpoint 1 TX buffer descriptor.
12. Write BC80004 to DPRAM+30 to set up the status and DATA LENGTH fields of the
endpoint 2 TX buffer descriptor.
13. Write DPRAM +220 to DPRAM+34 to set up the DATA BUFFER POINTER field of the
endpoint 2 TX buffer descriptor.
14. Write BCC00004 to DPRAM+30 to set up the status and DATA LENGTH fields of the
endpoint 3 TX buffer descriptor.
15. Write DPRAM+30 to DPRAM+3C to set up the DATA BUFFER POINTER field of the
endpoint 3 TX buffer descriptor.
16. Write CAFECAFE to DPRAM+200 to set up the endpoint 0 TX data pattern.
17. Write FACEFACE to DPRAM+210 to set up the endpoint 1 TX data pattern.
18. Write BACEBACE to DPRAM+220 to set up the endpoint 2 TX data pattern.
19. Write CACECACE to DPRAM+230 to set up the endpoint 3 TX data pattern.
16-378
MPC823e REFERENCE MANUAL
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents