AN2294 Freescale Semiconductor / Motorola, AN2294 Datasheet - Page 14

no-image

AN2294

Manufacturer Part Number
AN2294
Description
MC68SZ328 USB Configuration Setup Application Note
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Software Interface
3.2.2 USB Module Endpoint Specific Registers
The USB module Endpoint specific registers cover the memory address locations identified in Table 6.
Each of these registers is programmed according to the characteristics of each endpoint used.
During initialization the endpoint configuration register USB_EPn_STATCR must include the same
configuration setup for each endpoint in the EndPtBuf register. In the USB_EPn_STATCR register, the
direction, maximum packet size, and type of transfers are matched to the EndPtBufs register.
Before downloading the information to the endpoint registers, it is important to reset the interrupt requests
and to mask all desired interrupts in the USB_EP(n)_ISR registers (where n = endpoint 0–4). To clear any
interrupt in the USB module, including interrupts for the endpoints, registers need to be set to 1, because
interrupts do not clear even if the interrupt requests go away. By setting all bits to 1, the particular interrupt
clears. Writing 0 to registers that are already set does not clear these interrupts.
All other endpoint registers can be set with the default setting for initialization purposes.
In Code Example 4 all endpoints 0 through 5 are set for initialization.
static unsigned int epstat[NUM_ENDPOINT] = { 0x0002, 0x0032, 0x00B2, 0x0072, 0x00F2 };
// Same configuration as the already configured EndPtBufs register
bool usbdFifoInit( void ) {
for (ep = 0; ep < NUM_ENDPOINT; ep++)
}
14
{
for (i = 0; i < NUM_ENDPOINT; i++)
{
}
Table 6. Endpoint Specific Register Memory Address Range
Code Example 4. Setting Endpoints 0–5 for Initialization
USB_EP_STATCR(ep) = epstat[ep];// Program dir, max size, type
USB_EP_FCTRL(ep) = 0x0900000 // Frame mode disable
Freescale Semiconductor, Inc.
For More Information On This Product,
Endpoint 0
Endpoint 1
Endpoint 2
Endpoint 3
Endpoint 4
Endpoint 5
Endpoint
USB_EP_ISR(i) = 0x1FF; //Clear interrupts
USB_EP_MASK(i) = 0x1F0; //Set desired masks
MC68SZ328 Application Note
Go to: www.freescale.com
0xFFFE0430 – 0xFFFE0458
0xFFFE0460 – 0xFFFE0488
0xFFFE0490 – 0xFFFE04B8
0xFFFE04C0 – 0xFFFE04E8
0xFFFE04F0 – 0xFFFE0518
0xFFFE0520 – 0xFFFE0548
Memory Address Range
MOTOROLA

Related parts for AN2294