AN2294 Freescale Semiconductor / Motorola, AN2294 Datasheet
AN2294
Related parts for AN2294
AN2294 Summary of contents
Page 1
... Freescale Semiconductor, Inc. Application Note AN2294/D Rev. 1.1, 07/2003 MC68SZ328 USB Configuration Setup 1 Introduction By Ed Kroitor Contents Due to the advancement of computers and computer peripherals, older systems of peripheral 1 Introduction . . . . . . . . . . 1 communications have been replaced with new and faster technologies. Older technologies 1.1 USB Overview . . . . 1 such as the RS-232 have changed little since their introduction. Even though this 2 Hardware Interface ...
Page 2
Freescale Semiconductor, Inc. Hardware Interface 1.1.2 Pipes Pipes are abstract links between the host and the device. These links are not physical, instead, they are software relationships important to understand pipes relative to the types of data exchange ...
Page 3
Freescale Semiconductor, Inc. Figure 1. Connection From MC68SZ328 to the Transceiver Using USB Outputs Components R313, C252, R314 and C253 are not installed normally, they serve the purpose of fine tuning the circuit. 2.3 USB Crystal Configuration The USB uses ...
Page 4
Freescale Semiconductor, Inc. Software Interface Figure 3. 16 MHz Crystal Configuration Hardware 3 Software Interface This section provides the information to initialize the USB module with the host, program the USB Device Core (UDC) registers, and receive and transmit data. ...
Page 5
Freescale Semiconductor, Inc. UPFSR0 USBPLL Frequency Select Register 0 BIT UMFI TYPE RESET Figure 5. USBPLL Frequency Select Register 0 As these registers show, the values ...
Page 6
Freescale Semiconductor, Inc. Software Interface Table 2. Corresponding UPDF to the UPFSR1 Register Input Values (Continued) 3.1.2 Clock Configuration As shown in Figure 2 and Figure 3, there are two different clocks that can be used to drive the USB ...
Page 7
Freescale Semiconductor, Inc. The results are 192 MHz. However, because USBCDIV / 4 (CSCR bit 13-11) the USB_CLK output frequency will be 48 MHz. Refer to the Code Example 1 on page 8 for more information on programming the USBPLL ...
Page 8
Freescale Semiconductor, Inc. Software Interface Code Example 1. Programming the USBPLL Registers void init_USBPLL(void using 32.768 KHz crystal. */ reg_CSCR= 0x4C04; reg_UPFSR0= 0x2969; reg_UPFSR1= 0x01f3; reg_PLLCR= 0x6400; reg_CSCR= 0x4c03; void init_USBPLL(void using 16 MHz crystal. */ ...
Page 9
Freescale Semiconductor, Inc. 3.2 Programming the USB Device Core (UDC) The USB Device Core implements most of the USB protocol in hardware. As shown in Figure 7, the UDC is the front-end device for communication with the USB transceiver and ...
Page 10
Freescale Semiconductor, Inc. Software Interface 2. Download configuration data (EndptBufs) to the device via the USB_DDAT register shown in Figure 8. EndptBufs—A personality file that contains the bytes of the five endpoint buffers (40 bits) that loads directly into the ...
Page 11
Freescale Semiconductor, Inc. Code Example 2. Programming EndptBufs via the USB_DDAT //Setup information that will go into the EndPtBufs register static unsigned char epcfg[NUM_ENDPOINT][ 0x00,0x00,0x08,0x00,0x00 }, { int i,ep; for ( < NUM_ENDPOINT; ep++) ...
Page 12
Freescale Semiconductor, Inc. Software Interface Table 4. EndPBufs Register Description Table (Continued) Bit Field Type [31:29] AltSetting Alternate setting number—Maximum alternate settings. [28:27] Type Type of endpoint Control 01 = Reserved 10 = Bulk 11 ...
Page 13
Freescale Semiconductor, Inc. There will be only one EndPoint0 for the entire device and this EndPoint is associated to all configurations and interfaces in the device. The UDC ignores the values programmed in the Ep_Config, Ep_Interface, and Ep_AltSetting fields of ...
Page 14
Freescale Semiconductor, Inc. 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. Table 6. Endpoint Specific Register Memory Address Range Endpoint Endpoint 0 Endpoint 1 Endpoint ...
Page 15
Freescale Semiconductor, Inc. 3.3 Receive and Transmit Data When receiving and transmitting data certain rules of engagement must be taken into account. The first distinction between both actions is the way that they are processed. Both actions transmit from the ...
Page 16
Freescale Semiconductor, Inc. Software Interface When the WFR bit is set, it tells the device that the next transaction that takes place is the last data word (either bit) for that particular transaction. Even byte size packets: ...
Page 17
Freescale Semiconductor, Inc. Code Example 5. Sending Packets void Send_Odd_Packet(U32 start, U32 end) { U32 i; // write first 2 bytes of last packet // for (i=start; i<end; i=i++) // { // _reg_USBD_EP0_FDAT_byte_access = (USB_CONFIG_DESC[i]); // count ...
Page 18
Freescale Semiconductor, Inc. Software Interface 3.3.2 Receiving Data Customize the program to read USB_EPn_ISR (n=0-4) bit 1. After this bit is set, the end-of-transfer interrupt enables. When set, it tells the device that the last packet of the transfer has ...
Page 19
Freescale Semiconductor, Inc. MOTOROLA For More Information On This Product, Motorola Confidential Proprietary, NDA Required / Draft # NOTES MC68SZ328 Application Note Go to: www.freescale.com 19 ...
Page 20
... Motorola and the Stylized M Logo are registered in the U.S. Patent and Trademark Office. All other product or service names are the property of their respective owners. Motorola, Inc Equal Opportunity/Affirmative Action Employer. © Motorola, Inc. 2002 AN2294/D For More Information On This Product, Go to: www.freescale.com ...