background image

DRM002/D

 

M

6

8H

C

08

M

6

0

8M

6

8

H

C

0

8

M

8

HC

0

8

M6

8

H

C

USB08 Universal Serial Bus
Evaluation Board
Using the MC68HC908JB8

Designer Reference Manual

Содержание MC68HC908JB8

Страница 1: ...DRM002 D 68HC08M6 8M68HC08M HC08M68HC USB08 Universal Serial Bus Evaluation Board Using the MC68HC908JB8 Designer Reference Manual ...

Страница 2: ...blank ...

Страница 3: ...C908JB8 By Dipl Ing Oliver Thamm MCT Elektronikladen GbR Hohe Str 9 13 04107 Leipzig Germany Telephone 49 0 341 2118354 Fax 49 0 341 2118355 Email mct elektronikladen de Web http www elektronikladen de mct Motorola and are registered trademarks of Motorola Inc DigitalDNA is a trademark of Motorola Inc Motorola Inc 2001 ...

Страница 4: ...rts Motorola does not convey any license under its patent rights nor the rights of others Motorola products are not designed intended or authorized for use as components in systems intended for surgical implant into the body or other applications intended to support or sustain life or for any other application in which the failure of the Motorola product could create a situation where personal inj...

Страница 5: ... USB08 Quick Start 17 Section 2 Hardware Description 27 Section 3 Software Module Descriptions 43 Section 4 Universal Serial Bus USB Interface 59 Appendix A Supported Standard Device Requests 81 Appendix B USB08 Descriptors 83 Appendix C Source Code Files 89 Appendix D Bill of Materials and Schematic 127 Appendix E Universal USB Device Driver USBIO 131 ...

Страница 6: ...Designer Reference Manual USB08 Evaluation Board 6 List of Sections MOTOROLA List of Sections ...

Страница 7: ...rd to the PC 18 1 5 Driver Installation 19 1 6 Starting the Windows Demo Application 24 Section 2 Hardware Description 2 1 Contents 27 2 2 Introduction 27 2 3 Technical Data 28 2 3 1 MC68HC908JB8 Microcontroller 28 2 3 2 USB08 Evaluation Board 29 2 4 Circuit Description 30 2 4 1 MCU Core Circuit and USB Interface 31 2 4 2 Input Output Functions 32 2 4 3 Monitor Mode Interface 33 2 4 4 User RS232 P...

Страница 8: ...Firmware 44 3 4 How to Build the Compiler Project 45 3 5 Main Module U08MAIN C 48 3 6 Interrupt and Reset Vector Module VECJB8 C 49 3 7 C Startup Module CRTSJB8 S 50 3 8 Push Button Module U08KEY C 50 3 9 LED Control with U08LED H 52 3 10 Software ADC Module U08ADC C 52 3 11 RS232 Communication Module U08232 C 54 3 12 USB Communication Module U08USB C 56 3 13 Compiler Specific Adjustments 57 Secti...

Страница 9: ...tors 72 4 6 4 Device Configuration 74 4 6 5 STALL Condition 74 4 7 Data Communication via Endpoints EP1 and EP2 75 4 7 1 Receiving Data 76 4 7 2 Transmission of Data 76 4 8 Host Interaction Vendor ID and Product ID 78 4 9 Windows Device Driver 78 Appendix A Supported Standard Device Requests Supported Standard Device Requests 81 Appendix B USB08 Descriptors B 1 Contents 83 B 2 Introduction 83 B 3 ...

Страница 10: ...119 CRTSJB8 S 120 USB08 LKF 121 BUILD BAT 121 USB08 MAP 122 USB08 S19 125 Appendix D Bill of Materials and Schematic Bill of Materials and Schematic 127 Appendix E Universal USB Device Driver USBIO E 1 Contents 132 E 2 Introduction 135 E 3 Overview 135 E 3 1 Platforms 136 E 3 2 Features 136 E 4 Architecture 138 E 4 1 USBIO Object Model 140 E 4 1 1 USBIO Device Objects 140 E 4 1 2 USBIO Pipe Object...

Страница 11: ...1 CUsbIo Class 220 E 6 2 CUsbIoPipe Class 221 E 6 3 CUsbIoThread Class 222 E 6 4 CUsbIoReaderClass 222 E 6 5 CUsbIoWriter Class 222 E 6 6 CUsbIoBufClass 223 E 6 7 CUsbIoBufPool Class 223 E 7 USBIO Demo Application 223 E 7 1 Dialog Pages for Device Operations 224 E 7 1 1 Device 224 E 7 1 2 Descriptors 224 E 7 1 3 Configuration 225 E 7 1 4 Interface 225 E 7 1 5 Pipes 225 E 7 1 6 Class or Vendor Requ...

Страница 12: ...allation Issues 229 E 8 1 Automated Installation The USBIO Installation Wizard 229 E 8 2 Manual Installation The USBIO Setup Information File 232 E 8 3 Uninstalling USBIO 236 E 8 4 Building a Customized Driver Setup 237 E 9 Registry Entries 239 E 10 Related Documents 241 E 11 Light Version Limitations 241 ...

Страница 13: ... Device Manager Window 25 2 1 USB08 Evaluation Board 30 2 2 PCB Component Side Layout Plan 37 2 3 Detailed Layout Plan 37 2 4 Solder Bridge Placement on Downside of the PCB 39 3 1 Structure and Dependencies of the Firmware Files 45 3 2 Measurement of Resistor Values Using a Digital Input 52 4 1 USB Address Register UADDR 65 4 2 USB Control Register 3 UCR3 66 4 3 USB Interrupt Register 0 UIR0 68 4 ...

Страница 14: ...14 List of Figures MOTOROLA List of Figures Figure Title Page D 1 USB08 Evaluation Board Schematic 129 E 1 USB Driver Stack 138 E 2 USBIO Device and Pipe Objects Example 143 E 3 Layout of an Isochronous Transfer Buffer 183 E 4 USBIO Class Library 220 ...

Страница 15: ...nfiguration 34 2 3 Jumper Configuration 38 2 4 Solder Bridges Configuration 39 2 5 MC68HC908JB8 Memory Map 41 3 1 Memory Utilization 47 4 1 Low Speed USB Packet Types 62 4 2 MC68HC908JB8 Endpoint Configuration 66 D 1 Bill of Materials for USB08 V 1 01 128 E 1 I O Operations Supported by the USBIO Device Driver 149 E 2 Error Codes Defined by the USBIO Device Driver 218 E 3 Registry Parameters Suppo...

Страница 16: ...Designer Reference Manual USB08 Evaluation Board 16 List of Tables MOTOROLA List of Tables ...

Страница 17: ...SB08 universal serial bus evaluation board demo application The main component of the USB08 is the Motorola MC68HC908JB8 8 bit microcontroller MCU 1 3 Required System Configuration To connect the USB08 you will need a personal computer PC with one of the following Microsoft operating systems Windows 98 Windows ME Windows 2000 Professional NOTE Ensure that the PC has the necessary hardware universa...

Страница 18: ... are always type A Therefore the cable of the USB08 demo board has a type A plug The connection of the demo board is made directly to the USB socket of the PC or as shown in the Figure 1 1 to a USB hub Figure 1 1 Demo Board Connected to the USB Hub The board supply current can be delivered by the USB connection Therefore the jumper JP2 which is directly beside the USB cable has to be in the positi...

Страница 19: ...nstallation of the driver software is described using the Windows 2000 operating system The installation using Windows 98 second edition looks quite similar After the electrical connection of the demo board the Windows operating system recognizes the presence of a new hardware component and shows the message Found New Hardware Figure 1 2 Found New Hardware Screen ...

Страница 20: ...ick Start The hardware assistant Figure 1 3 now tries to find the suitable driver information for the USB08 evaluation board Click the Next button NOTE The installation using the Windows 2000 operating system requires administrator rights Figure 1 3 Found New Hardware Wizard Start Screen ...

Страница 21: ...uation Board Designer Reference Manual MOTOROLA USB08 Quick Start 21 Insert the USB08 product CD into the CD ROM drive and mark the appropriate check box CD ROM drives as shown in Figure 1 4 Click the Next button Figure 1 4 Locate Driver Files Screen ...

Страница 22: ... Quick Start MOTOROLA USB08 Quick Start As shown in Figure 1 5 the hardware assistant will find the driver information file usbio_el inf in the root directory of the CD ROM Confirm this selection by clicking Next Figure 1 5 Driver Files Search Results Screen ...

Страница 23: ...he INF file and the driver file usbio_el sys to the appropriate Windows directories After clicking Finish Figure 1 6 the driver installation will be completed and the USB device will be ready for use Figure 1 6 Found New Hardware Wizard Finish Screen NOTE The installation does not require a restart of the computer since this is a true Plug Play installation ...

Страница 24: ...diodes LED The demo application is located in the root directory of the USB08 product CD The file name of the demo application is IO08USB EXE This program can be started directly from the CD Figure 1 7 Windows Demo Application IO08USB As shown in Figure 1 7 the bottom line of the application window shows the status of the connection established to the USB08 demo board The LED symbols on the left u...

Страница 25: ...s the thermistor value Input 3 can be varied using the turnable regulator The USB08 evaluation board can be disconnected from the USB port and reconnected at any time because the drivers are automatically activated or deactivated by the Windows operating system The activation deactivation of the drivers can be watched in the operating system s device manager window start button settings control pa...

Страница 26: ...k Start The Windows demo application IO08USB EXE must be re started in the case of a hardware connection interrupt This is because an automatic resynchronization though it would be possible was not implemented here The demo application is arranged as simply and as understandable as possible ...

Страница 27: ...face 31 2 4 2 Input Output Functions 32 2 4 3 Monitor Mode Interface 33 2 4 4 User RS232 Port 35 2 4 5 Power Supply 36 2 5 Board Layout 36 2 6 Jumpers and Bridges 38 2 7 Connectors 40 2 7 1 Expansion Connector X1 40 2 7 2 Monitor Mode Connector X2 40 2 7 3 User RS232 Connector X3 41 2 8 Memory Map 41 2 2 Introduction The USB08 evaluation board is the hardware platform for the universal serial bus ...

Страница 28: ...des technical data for both the MC68HC908JB8 and the USB08 evaluation board 2 3 1 MC68HC908JB8 Microcontroller The main component of the USB08 evaluation board is the MC68HC908JB8 a Motorola 8 bit MCU Features of the MC68HC908JB8 include Efficient M68HC08 MCU core 8 Kbytes of on chip FLASH memory with security feature 256 bytes of random access memory RAM 3 MHz bus clock 6 MHz quartz crystal 2 16 ...

Страница 29: ...ee analog sensors Light Temperature Angle of rotation Current supplied alternatively via USB connection or on board voltage regulator Monitor mode interface for in system programming and debugging Additional RS232 interface for connection to PC or serial liquid crystal display LCD Push buttons for reset and IRQ Jumper for power on reset POR All MCU pins are accessible via a 26 pin universal expans...

Страница 30: ...endix D Bill of Materials and Schematic The MC68HC908JB8 MCU needs few external elements A wide range of peripheral functions including the USB module and an 8 Kbyte FLASH memory are integrated on chip The MC68HC908JB8 is offered in several packages For the USB08 reference design the 28 pin SOIC version was chosen instead of the 20 pin dual in line package DIP because the SOIC package has some add...

Страница 31: ...he MCU This oscillator produces a clock frequency of 6 MHz The internal bus clock of the MCU 3 MHz as well as the USB clock 1 5 MHz are derived from the main clock frequency The USB data lines are connected to the MCU pins PTE3 USB D and PTE4 USB D So that the USB hub will be able to classify this equipment as a low speed USB device a pullup resistance of 1 5 kΩ R7 to the data line D is required O...

Страница 32: ...program see Section 3 Software Module Descriptions For optical signalling three LEDs are attached to port D These port pins have a high drive capability of up to 25 mA Therefore it is not necessary to use a driver On the board PTD0 PTD1 and PTD2 are used for LED control All outputs generated by the port D pins have an open drain characteristic and are 5 V tolerant The remaining port D pins PTD3 PT...

Страница 33: ...s serial interface function on the port pin PTA0 This interface works bidirectionally half duplex and corresponds to the usual RS232 conventions The baud rate equals 9600 baud An additional requirement besides the quartz clock 6 MHz is the allocation of certain logic levels to some port pins as listed in Table 2 1 The monitor mode circuitry on the evaluation board produces the levels shown in Tabl...

Страница 34: ... cable consists of A flat cable with a Berg connector 2 5 pin crimping connection on the device side A sub D9 connector crimping connection on the PC side A one to one connection is implemented by this cable configuration as shown in Table 2 2 The MC68HC908JB8 logic levels are based on the operating voltage VCC 3 3 V however the transceiver IC2 works with VDD 5 V The adjustment of the logic levels...

Страница 35: ...ed from the MCU by removing the jumpers JP1 G and JP1 H X3 is the user RS232 port plug connector If this interface is attached to a PC a line connection similar to the monitor mode interface is necessary In this case the bridges BR1 and BR2 on the downside of the printed circuit board PCB see Figure 2 3 have to be connected in positions 1 and 2 For this configuration the PC works as a host and the...

Страница 36: ...specified with 1 ampere Although no special cooling measures are intended IC3 is more than sufficiently dimensioned The input current of the board even in the worst case is clearly smaller than 100 mA A USB hub supplies at least 100 mA Therefore the power supply of the board via the USB is possible without any problem The USB08 board power input specification should be registered in the device des...

Страница 37: ...Hardware Description Board Layout USB08 Evaluation Board Designer Reference Manual MOTOROLA Hardware Description 37 Figure 2 2 PCB Component Side Layout Plan Figure 2 3 Detailed Layout Plan ...

Страница 38: ... connected to the power supply JP1 C Open PTA0 can be used without restriction Closed PTA0 is used for monitor mode communication JP1 D Open PTA1 can be used without restriction Closed PTA1 is used for monitor mode configuration JP1 E Open PTA2 can be used without restriction Closed PTA2 is used for monitor mode configuration JP1 F Open PTA3 can be used without restriction Closed PTA3 is used for ...

Страница 39: ...nfiguration Solder Bridge Position 1 1 delivery status Function BR1 and BR2 1 2 User RS232 configured in external device mode PC 2 3 User RS232 configured in host mode LCD connection BR3 Open VCC is not present at user RS232 port standard Closed VCC is present at pin 9 of the user RS232 BR4 1 2 Power supply via voltage regulator 8 20 V needed at X4 2 3 Power supply directly from X4 must be stabili...

Страница 40: ...scribed here 2 7 1 Expansion Connector X1 2 7 2 Monitor Mode Connector X2 VDD 1 2 VCC RTS 3 4 PTA0 PTD0 5 6 PTA1 PTD1 7 8 PTA2 PTD2 9 10 PTA3 PTD3 11 12 PTA4 PTD4 13 14 PTA5 PTD5 15 16 PTA6 PTD6 17 18 PTA7 PTE3 19 20 PTE0 PTE4 21 22 PTE1 PTC0 23 24 PTE2 GND 25 26 GND X1 N C 1 2 N C PC_RxD 3 4 N C PC_TxD 5 6 N C N C 7 8 N C GND 9 10 N C X2 ...

Страница 41: ...ontrol registers and interrupt vectors refer to the MC68HC908JB8 Technical Data Motorola document order number MC68HC908JB8 D N C 1 2 N C Rx Tx 3 4 N C Tx Rx 5 6 N C N C 7 8 VDD GND 9 10 N C X3 Table 2 5 MC68HC908JB8 Memory Map From To Size Content 0x0000 0x003F 64 bytes Control registers 0x0040 0x013F 256 bytes RAM 0x0140 0xDBFF Reserved 0xDC00 0xFBFF 8 Kbytes FLASH memory 0xFC00 0xFFDF Reserved ...

Страница 42: ...Designer Reference Manual USB08 Evaluation Board 42 Hardware Description MOTOROLA Hardware Description ...

Страница 43: ... 3 6 Interrupt and Reset Vector Module VECJB8 C 49 3 7 C Startup Module CRTSJB8 S 50 3 8 Push Button Module U08KEY C 50 3 9 LED Control with U08LED H 52 3 10 Software ADC Module U08ADC C 52 3 11 RS232 Communication Module U08232 C 54 3 12 USB Communication Module U08USB C 56 3 13 Compiler Specific Adjustments 57 3 2 Introduction This section describes the structure and interaction of the software ...

Страница 44: ...equired The control of keys LEDs and analog to digital A D transmitters are support functions to the demonstration project because the main attention is paid to the communication interface The communication functions are implemented directly by means of include instructions in the main module U08MAIN C Two ways of communication are implemented in the demonstration RS232 or USB The selection takes ...

Страница 45: ... can to arrange a project within the compiler IDE The compiler project owns A list of source modules to be complied Translation options Additional tools such as S record generation Figure 3 1 Structure and Dependencies of the Firmware Files HC08JB8 H Register Definitions U08USB H USB Communication U08232 H RS232 Communication U08KEY H Push Button Module U08LED H LED Functions U08ADC H Soft ADC Mod...

Страница 46: ...d into the FLASH memory of the MC68HC908JB8 Another important file for controlling the translation is the linker file USB08 LKF USB08 LINK COMMAND FILE COSMIC HC08 C COMPILER seg text b 0xdc00 n text program start address seg const a text constants follow code seg bsct b 0x0040 n bsct zero page start address seg ubsct a bsct n ubsct data start address seg data a ubsct data start address def __sbss...

Страница 47: ... the address range 0x0000 0x0040 The data segment follows the zero page in the random access memory RAM The interrupt vectors start at 0xFFF0 and the stack pointer is set to 0x013F end of the internal RAM memory Table 3 1 shows the approximate values for memory utilization when USB communication has been implemented Table 3 1 Memory Utilization Starting Address End Address Length Contents 0x0000 0...

Страница 48: ...cted in each case The function main contains the continuous loop of the master program As usual it is called by the C startup module after all fundamental hardware and system initializations are finished Also at the beginning of these initializations the C startup module calls the function _HC08Setup In this function all register accesses and initializations which must take place immediately after...

Страница 49: ...utilizing the first six bytes of the eight bytes available In the first three bytes the status of the input keys is coded The next three bytes transmit the last values of the three analog converter channels 4 Now the function putPipe is called eight times to send the data telegram Afterward the entire cycle run is repeated All further program functions in particular the communication via USB and t...

Страница 50: ... module from the Cosmic C Compiler package with one exception Immediately after a reset and after the initialization of the stack pointer a subroutine reference was inserted to _HC08Setup This subfunction is defined in U08MAIN C and performs urgent accesses to M68HC08 control registers which should be completed immediately after the reset 3 8 Push Button Module U08KEY C Port A PTA of the MC68HC908...

Страница 51: ...e status variable KeyState By activation of a key the key status is inverted This implementation simulates an on off push button If the main program wants to know the current status of a key on off it uses the access function getKey The number of the key 1 will be handed over as a function argument The function getKey calculates a bit mask for access to an individual bit of the internal status var...

Страница 52: ... switching of the LEDs is performed via four macros Therefore a header file is enough for the realization of these functions A special C module is not required in this case The LEDs are addressed beginning with a 1 The switching on of the first LED at PTD 0 takes place for example by means of onLED 1 3 10 Software ADC Module U08ADC C Although the MC68HC908JB8 does not have an integrated ADC it is ...

Страница 53: ...of Rx first the value of the capacity C and the constant k have to be determined However that is not economical particularly with series products having a certain distribution of its value Instead one can accomplish a calibration cycle before the actual measurement This calibration cycle uses a reference resistance value R0 and determines the time t0 The following measure cycle uses series connect...

Страница 54: ...ation operations small the scaling function is implemented using some in line assembler directives A detailed discussion of the software A D converter used here is contained in the application note entitled Simple A D for MCUs without Built in A D Converters Motorola document order number AN477 D This application note can be found on the World Wide Web at http www motorola com semiconductors 3 11 ...

Страница 55: ...aming error Also an over scanning for the purpose of noise reduction does not take place The production of the bit rate is controlled by the module internal function delayHalfBit The function is implemented with help from some in line assembly code to ensure an accurate time performance which can be simply changed by the user if necessary The possible changes necessary for the adjustment to differ...

Страница 56: ...o USE_USB_PIPE in the main module U08MAIN C is activated Just like RS232 the USB uses serial streams for the data communication The substantially more complex operational sequence of the USB can be encapsulated so that the integration into existing projects is possible without problems Therefore the USB implementation shown here is just as simple to manage for the firmware programmer as the classi...

Страница 57: ...lies here as well The character handed over to putUSB is placed into the buffer If the buffer is full the routine waits until the send buffer again is able to store data After placing the character into the send buffer the access index variable is updated Interrupt controlled implementation of these functions is performed in the background of the microcontroller application Filling of the receive ...

Страница 58: ...he following instruction _asm assembly statement When using other compilers similar instructions should be available However some small syntactic adjustments can be necessary Beside the main module the modules U08232 C and U08ADC C also contain such in line assembler constructions The marking of a function as an interrupt service routine is not regulated in the ANSI C standard For lack of a unifor...

Страница 59: ...onfiguration 65 4 5 3 USB Reset 67 4 6 Device Management with Endpoint 0 69 4 6 1 Enumeration 69 4 6 2 Assignment of the Device Address 69 4 6 3 Requesting Descriptors 72 4 6 4 Device Configuration 74 4 6 5 STALL Condition 74 4 7 Data Communication via Endpoints EP1 and EP2 75 4 7 1 Receiving Data 76 4 7 2 Transmission of Data 76 4 8 Host Interaction Vendor ID and Product ID 78 4 9 Windows Device ...

Страница 60: ... known speed classifications low speed and full speed Beyond that release 2 0 introduces a high speed device type First high speed devices are expected to be established in the market by end of the year 2001 The basic specification of the USB is supplemented by several class specifications for certain types of device classes which can be found frequently for example human interface device class fo...

Страница 61: ... can be arranged easily using a dozen low speed USB devices and two or three commercial hubs This reference design contains USB08 evaluation board firmware therefore this Plug Play demo application can be evaluated immediately Beyond that all source code is provided in the form of C modules for the M68HC08 Cosmic C compiler The user can use these sources as a starting point for their own USB devel...

Страница 62: ...modules of the USB communication in the levels above the electrical connection Packets are atomic for instance they cannot be interrupted or divided into sections The packet types shown in Table 4 1 are relevant for low speed USB In addition to the packets shown in Table 4 1 the bus traffic consists of further quasi static bus conditions reset suspend resume and the Keep alive EOP refer to Univers...

Страница 63: ... of data The packets DATA0 and DATA1 are always sent in an alternating sequence This procedure is called data toggle and serves for error protection Following the data packet the device answers with a handshake packet If the device could receive the data it sends an ACK packet If the device was not immediately ready it sends a NAK packet signalling to the host that the packet should be sent again ...

Страница 64: ...transfers are secured using a double handshake Control transfers consist of two or three transaction stages like those shown here 2 Stage Control Transfer No Data 3 Stage Control Transfer Host Read The setup stage starts with a SETUP transaction see above The data stage is necessary if data has to be sent from the device to the host and consists of several IN transactions The status stage serves f...

Страница 65: ...stor at D PTE4 being activated if this option was selected in the source code For this the macro USB_IPUE must be defined as 1 Alternatively it is possible to add an external resistor on the USB08 evaluation board see Section 2 Hardware Description 4 5 2 Endpoint Configuration The integrated USB module of the MCHC908JB8 supports three endpoints In addition to the mandatory bidirectional control en...

Страница 66: ...ter 3 UCR3 has to be set to activate the endpoint EP1 Likewise the bit ENABLE2 has to be set for activation of the endpoint EP2 However the activation of the endpoints EP1 and EP2 takes place not in the initialization routine initUSB but only after the device receives a USB reset Table 4 2 MC68HC908JB8 Endpoint Configuration Endpoint Type Direction Function EP0 Control IN OUT Device configuration ...

Страница 67: ...08MAIN C The USB reset interrupt together with all the other USB sources of interrupt points to a central USB interrupt vector The USB interrupt has apart from the software interrupt SWI the highest priority in the interrupt system of the MC68HC908JB8 The USB interrupt vector is stored at the vector address 0xFFFA 0xFFFB see 3 6 Interrupt and Reset Vector Module VECJB8 C In the reference design it...

Страница 68: ... attached to the bus and is supplied with current In addition it has received a USB reset and reacts to instructions with the default address zero For further information refer to Universal Serial Bus Specification Revision 1 1 Chapter 9 1 USB Device States After these fundamental initialization steps further setup steps summarized under the term of enumeration follow Bit 7 6 5 4 3 2 1 Bit 0 Read ...

Страница 69: ...s purpose the host sends a SET_ADDRESS standard device request Standard device requests are always served by the EP0 These transfers are control transfers which are implemented for the EP0 only the other endpoints are used exclusively for the data communication by means of interrupt transfers USB device requests are started by the host sending a SETUP packet The MCU receives this information and g...

Страница 70: ...should contain the value 0 48 The eight bytes received by endpoint 0 are available in the eight registers UE0D0 UE0D7 and will be transferred into the buffer variable SetupBuffer This variable of the type setup_buffer is explained in the following excerpt from U08USB H Structure of Setup Packet sent during SETUP Stage of Standard Device Requests according to USB1 1 spec page 183 typedef struct uch...

Страница 71: ...ional safety feature is the mandatory control transfer status stage The handshake takes place via a telegram with a data length of zero which is requested by the host by means of an IN transaction For this purpose the length TP0SIZx is defined as zero and the TX0E bit is set in the USB control register 0 UCR0 This enables the transmitter of the endpoint 0 This handshake transaction always uses a D...

Страница 72: ...etion is noted in the SetupBuffer by setting the flag REQUEST_COMPLETE 4 6 3 Requesting Descriptors Further in the process of enumeration the host will request the configuration of the device For this purpose descriptors which contain information about the status and one or more possible configurations are made available by the device The host loads these descriptors selects a suitable driver and ...

Страница 73: ...eral sequential IN transactions The last data block is identified by the host due to a length smaller than eight bytes That means if the length of the transmitted data amounts to an integral multiple of eight there has to be an additional empty IN transaction data length zero The data length and the transmitter release bit TX0E are inserted into the USB control register 0 UCR0 see SET_ADDRESS then...

Страница 74: ...to setConfiguration take place The configuration specified by the host is coded in the field wValue lo of the structure SetupBuffer If this field is larger than zero the USB08 is ready to be put into operation For this purpose the transmitter of endpoint 1 and the receiver of endpoint 2 will be enabled and the internal status of the device changed to CONFIGURED In reverse the host is able to retur...

Страница 75: ...ata Communication via Endpoints EP1 and EP2 The transmission of user data from or to the USB device takes place via the endpoints 1 and 2 EP1 is an endpoint of the type IN and serves for sending of information to the host EP2 possesses the direction OUT and is used by the device to receive data from the host All data traffic of the pay load endpoints EP1 and EP2 as well as the administrative traff...

Страница 76: ...answers further transmission attempts of the host with a NAK handshake NOTE In a real application you should not leave the buffer unserviced over a longer period of time 4 7 2 Transmission of Data The transmit data for EP1 is placed by the user program via the function putUSB into the send buffer TxBuffer This is just like RxBuffer a ring buffer which blocks the application as soon as the buffer i...

Страница 77: ...s 0 The T1SEQ bit is inverted to switch between DATA0 and DATA1 packets data toggle Finally by setting the bit TX1E in the USB control register 1 UCR1 the transmission of the data is enabled The operation mode selected here is based on a continuous data stream If there is no transmit data in the buffer the device will send data packets with zero byte contents If this condition continues for a long...

Страница 78: ...e product ID for the demo application is 0x0000 To avoid collisions and complications every type of device is requested to have a unique vendor ID and or product ID Devices which have fantasy IDs cannot be used as that would lead to the immediate collapse of the compatibility of different devices at the USB Registered users of the USB08 evaluation board can receive their own PID out of the PID poo...

Страница 79: ... standard driver for human interface devices HID The device class HID summarizes PC input devices for example a keyboard attached to the PC It is possible to camouflage the measuring data as an HID input packet and tunnel through the HID driver The advantage of this approach is that a kernel mode driver doesn t have to be developed Instead you can program your own PC application on top of the exis...

Страница 80: ...e driver USBIO from the company Thesycon This third party USB driver is professionally maintained and updated as soon as new operating system conditions occur The USBIO driver is used for the USB08 reference design as a free of charge adapted Light EL version For detailed documentation components and demo programs refer to Appendix E Universal USB Device Driver USBIO World Wide Web at http www the...

Страница 81: ...rence Manual USB08 Evaluation Board Appendix A Supported Standard Device Requests Definition of the supported standard device requests are given here Standard Device Request ID Supported Options SET_ADDRESS 5 Any GET_DESCRIPTOR 6 DEVICE CONFIGURATION STRING SET_CONFIGURATION 9 0 1 CLEAR_FEATURE 1 ENDPOINT_HALT ...

Страница 82: ...Designer Reference Manual USB08 Evaluation Board 82 Supported Standard Device Requests MOTOROLA Supported Standard Device Requests ...

Страница 83: ...8 Evaluation Board Appendix B USB08 Descriptors B 1 Contents B 2 Introduction 83 B 3 Device Descriptor 84 B 4 Configuration Descriptor 84 B 5 Interface Descriptor 85 B 6 Endpoint 1 Descriptor 85 B 7 Endpoint 2 Descriptor 85 B 8 String Descriptors 86 B 2 Introduction This appendix defines the USB08 descriptors ...

Страница 84: ... BCD 1 Index of String Desc for Manufacturer 2 Index of String Desc for Product 0 Index of String Desc for SerNo 1 Number of possible Configurations end of DeviceDesc B 4 Configuration Descriptor const configuration_descriptor ConfigDesc Size of this Descriptor in Bytes sizeof configuration_descriptor DT_CONFIGURATION Descriptor Type 2 sizeof configuration_descriptor sizeof interface_descriptor si...

Страница 85: ...de 0xff Vendor specific 0 Index of String Desc for this Interface end of InterfaceDesc B 6 Endpoint 1 Descriptor const endpoint_descriptor Endpoint1Desc Size of this Descriptor in Bytes sizeof endpoint_descriptor DT_ENDPOINT Descriptor Type 5 0x81 Endpoint Address EP1 IN 0x03 Interrupt 0x08 0x00 Max Endpoint Packet Size 10 Polling Interval Interrupt in ms end of Endpoint1Desc B 7 Endpoint 2 Descri...

Страница 86: ... Language IDs define SD0LEN 4 const uchar String0Desc SD0LEN Size Type SD0LEN DT_STRING LangID Codes 0x09 0x04 Manufacturer String define SD1LEN sizeof MCT Elektronikladen 2 const uchar String1Desc SD1LEN Size Type SD1LEN DT_STRING Unicode String M 0 C 0 T 0 0 E 0 l 0 e 0 k 0 t 0 r 0 o 0 n 0 i 0 k 0 l 0 a 0 d 0 e 0 n 0 ...

Страница 87: ... 87 Product String define SD2LEN sizeof USB08 Evaluation Board 2 const uchar String2Desc SD2LEN Size Type SD2LEN DT_STRING Unicode String U 0 S 0 B 0 0 0 8 0 0 E 0 v 0 a 0 l 0 u 0 a 0 t 0 i 0 o 0 n 0 0 B 0 o 0 a 0 r 0 d 0 Table of String Descriptors uchar const StringDescTable String0Desc String1Desc String2Desc ...

Страница 88: ...Designer Reference Manual USB08 Evaluation Board 88 USB08 Descriptors MOTOROLA USB08 Descriptors ...

Страница 89: ...ference Manual USB08 Evaluation Board Appendix C Source Code Files C 1 Contents HC908JB8 H 90 U08USB H 93 U08232 H 96 U08LED H 96 U08MAIN C 97 U08DESC C 100 U08USB C 104 U08232 C 113 U08KEY C 116 U08ADC C 117 VECJB8 C 119 CRTSJB8 S 120 USB08 LKF 121 BUILD BAT 121 USB08 MAP 122 USB08 S19 125 ...

Страница 90: ... _P 0x09 define TSC _P 0x0A not implemented 0x0B define TCNTH _P 0x0C define TCNTL _P 0x0D define TMODH _P 0x0E define TMODL _P 0x0F define TSC0 _P 0x10 define TCH0H _P 0x11 define TCH0L _P 0x12 define TSC1 _P 0x13 define TCH1H _P 0x14 define TCH1L _P 0x15 define KBSCR _P 0x16 define KBIER _P 0x17 define UIR2 _P 0x18 define UCR2 _P 0x19 define UCR3 _P 0x1A define UCR4 _P 0x1B define IOCR _P 0x1C d...

Страница 91: ...0x80 USB Module Enable Bits in UIR0 define BM_EOPIE 0x80 End of Packet Detect Interrupt Enable define BM_RXD2IE 0x10 EP2 Rx Interrupt Enable define BM_TXD1IE 0x08 EP1 Tx Interrupt Enable define BM_TXD0IE 0x02 EP0 Tx Interrupt Enable define BM_RXD0IE 0x01 EP0 Rx Interrupt Enable Bits in UIR1 define BM_EOPF 0x80 End of Packet Detect Flag define BM_RSTF 0x40 Clear Reset Indicator Bit define BM_RXD2F ...

Страница 92: ...Size Bits in UCR2 define BM_STALL2 0x40 EP2 Force Stall Bit define BM_RX2E 0x10 EP2 Rx Enable Bits in UCR3 define BM_TX1STR 0x40 Clear EP0 Transmit 1st Flag define BM_OSTALL0 0x20 EP0 force STALL Bit for OUT Token define BM_ISTALL0 0x10 EP0 force STALL Bit for IN Token define BM_PULLEN 0x04 Pull up Enable define BM_ENABLE2 0x02 EP2 Enable define BM_ENABLE1 0x01 EP1 Enable Bits in USR0 define BM_R0...

Страница 93: ...ol Device Protocol Code uchar bMaxPacketSize0 Maximum Packet Size for EP0 iword idVendor Vendor ID iword idProduct Product ID iword bcdDevice Device Release Number in BCD uchar iManufacturer Index of String Desc for Manufacturer uchar iProduct Index of String Desc for Product uchar iSerialNumber Index of String Desc for SerNo uchar bNumConfigurations Number of possible Configurations device_descri...

Страница 94: ...rding to USB1 1 spec page 203 typedef struct uchar bLength Size of this Descriptor in Bytes uchar bDescriptorType Descriptor Type 5 uchar bEndpointAddress Endpoint Address Number Direction uchar bmAttributes Endpoint Attributes Transfer Type iword wMaxPacketSize Max Endpoint Packet Size uchar bInterval Polling Interval Interrupt in ms endpoint_descriptor Structure of Setup Packet sent during SETUP...

Страница 95: ...x07 optional define GET_CONFIGURATION 0x08 define SET_CONFIGURATION 0x09 define GET_INTERFACE 0x0a define SET_INTERFACE 0x0b define SYNCH_FRAME 0x0c optional define REQUEST_COMPLETE 0xff not part of the Standard just a Flag to indicate that the recent Request has been finished Descriptor Types according to USB1 1 spec page 187 define DT_DEVICE 1 define DT_CONFIGURATION 2 define DT_STRING 3 define ...

Страница 96: ...ektronikladen GbR http hc08web de usb08 Rem View Edit this File with TAB Size 4 Function Prototypes void initSSCI void putSSCI char c char getSSCI U08LED H File U08LED H Func LED Functions for USB08 Auth C 2000 by MCT Elektronikladen GbR Oliver Thamm http www elektronikladen de mct No code in this Module just Macros define initLED DDRD 0x07 define toggleLED x PTD 1 x 1 define offLED x PTD 1 x 1 de...

Страница 97: ...ing you can select the communication interface if defined USB if not RS232 Includes include hc08jb8 h HC908JB8 Register and Bitmap Definitions include u08key h Keyboard Module Header File include u08led h LED Module Header File just Macros include u08adc h Soft ADC Module Header File Compiler dependent Stuff define cli _asm cli define nop _asm nop Data Type Definitions typedef unsigned char uchar ...

Страница 98: ... case you are looking for spurious Interrupts interrupt void isrDummy nop just for Debugging void main uchar n a uchar io_buffer 8 uchar adc 3 initPipe init RS232 or USB Pipe initLED init LED Output initKey init Key Input initSADC init Soft ADC cli a 0 while 1 update ADC results 1 out of 3 at one time adc a getSADC a 1 if a 3 a 0 get data from input pipe n 0 do io_buffer n getPipe while n 8 proces...

Страница 99: ...on Board Designer Reference Manual MOTOROLA Source Code Files 99 send data to output pipe io_buffer 0 getKey 1 io_buffer 1 getKey 2 io_buffer 2 getKey 3 io_buffer 3 adc 0 io_buffer 4 adc 1 io_buffer 5 adc 2 n 0 do putPipe io_buffer n while n 8 ...

Страница 100: ...Maximum Packet Size for EP0 0x70 0x0c Vendor ID MCT Elektronikladen 0x00 0x00 Product ID Generic Demo 0x00 0x01 Device Release Number in BCD 1 Index of String Desc for Manufacturer 2 Index of String Desc for Product 0 Index of String Desc for SerNo 1 Number of possible Configurations end of DeviceDesc const configuration_descriptor ConfigDesc Size of this Descriptor in Bytes sizeof configuration_d...

Страница 101: ...for this Interface end of InterfaceDesc const endpoint_descriptor Endpoint1Desc Size of this Descriptor in Bytes sizeof endpoint_descriptor DT_ENDPOINT Descriptor Type 5 0x81 Endpoint Address EP1 IN 0x03 Interrupt 0x08 0x00 Max Endpoint Packet Size 10 Polling Interval Interrupt in ms end of Endpoint1Desc const endpoint_descriptor Endpoint2Desc Size of this Descriptor in Bytes sizeof endpoint_descr...

Страница 102: ...Source Code Files MOTOROLA Source Code Files Manufacturer String define SD1LEN sizeof MCT Elektronikladen 2 const uchar String1Desc SD1LEN Size Type SD1LEN DT_STRING Unicode String M 0 C 0 T 0 0 E 0 l 0 e 0 k 0 t 0 r 0 o 0 n 0 i 0 k 0 l 0 a 0 d 0 e 0 n 0 ...

Страница 103: ...Product String define SD2LEN sizeof USB08 Evaluation Board 2 const uchar String2Desc SD2LEN Size Type SD2LEN DT_STRING Unicode String U 0 S 0 B 0 0 0 8 0 0 E 0 v 0 a 0 l 0 u 0 a 0 t 0 i 0 o 0 n 0 0 B 0 o 0 a 0 r 0 d 0 Table of String Descriptors uchar const StringDescTable String0Desc String1Desc String2Desc ...

Страница 104: ... build in Pull up Resistor 0 Disable external Pull up required Variables volatile uchar USB_State define MAX_TXBUF_SIZE 16 must be 2 x volatile uchar TxBuffer MAX_TXBUF_SIZE volatile uchar TxBuf_RdIdx volatile uchar TxBuf_WrIdx define MAX_RXBUF_SIZE 16 must be 2 x volatile uchar RxBuffer MAX_RXBUF_SIZE volatile uchar RxBuf_RdIdx volatile uchar RxBuf_WrIdx volatile uchar SuspendCounter setup_buffer...

Страница 105: ...ALT SetupBuffer wIndex lo 0x81 SetupBuffer wIndex lo 0x02 clear EP1 2 Force STALL Bit if SetupBuffer wIndex lo 0x81 EP1 UCR1 BM_T1SEQ BM_STALL1 clear STALL Sequence DATA0 else EP2 UCR2 BM_STALL2 clear STALL R2Sequence 0 Sequence DATA0 prepare to send empty DATA1 at next IN Transaction UCR0 BM_T0SEQ BM_TX0E 0 else forceSTALL SET_ADDRESS Standard Device Request Handler called by handleSETUP void set...

Страница 106: ...upBuffer wValue lo 1 USB_State US_DEFAULT forceSTALL else if SetupBuffer wValue lo 0 no need to remember the Configuration Value since we support only one Configuration anyway USB_State US_CONFIGURED Activate Interrupt Endpoints reset STALL and DATA Toggle UCR1 BM_TX1E 0 EP1 Tx Enable Data Size is 0 UCR2 BM_RX2E EP2 Rx Enable else Zero means go back to Adressed State USB_State US_ADDRESSED UCR1 0 ...

Страница 107: ...hecked SetupDataPtr StringDescTable SetupBuffer wValue lo SetupSize SetupDataPtr break default forceSTALL break if SetupBuffer wValue hi DT_DEVICE SetupBuffer wValue hi DT_CONFIGURATION SetupBuffer wValue hi DT_STRING check if requested Length is less than Descriptor Length if SetupBuffer wLength lo SetupSize SetupBuffer wLength hi 0 SetupSize SetupBuffer wLength lo copy up to 8 Bytes to EP0 Data ...

Страница 108: ...mRequestType 0x60 0 forceSTALL Non Standard Requests will not be handled else Standard Request Decoder switch SetupBuffer bRequest case CLEAR_FEATURE 1 clearFeature break case SET_ADDRESS 5 setAddress break case GET_DESCRIPTOR 6 getDescriptor break case SET_CONFIGURATION 9 setConfiguration break default forceSTALL break UCR0 BM_RX0E Activate EP0 Receiver void handleOUT UCR0 BM_RX0E BM_TX0E Deactiv...

Страница 109: ...RIPTOR copy up to 8 Bytes to EP0 Data Registers n 0 dest uchar UE0D0 while SetupSize 0 n 8 dest SetupDataPtr dest SetupDataPtr SetupSize n prepare to send n Bytes at next IN Transaction toggle DATA0 1 UCR0 UCR0 BM_T0SEQ BM_T0SEQ BM_TX0E BM_RX0E n check if this is the last DATA packet to send if n 8 SetupBuffer bRequest REQUEST_COMPLETE break case CLEAR_FEATURE case SET_CONFIGURATION nothing to do ...

Страница 110: ...dIdx TxBuf_RdIdx 1 MAX_TXBUF_SIZE 1 dest n Activate EP1 Transmitter to send n Bytes UCR1 UCR1 BM_T1SEQ BM_T1SEQ BM_TX1E n handle OUT Packet received over EP2 void handleOUT2 uchar n uchar newIdx uchar src UCR2 BM_RX2E Deactivate EP2 Receiver UIR2 BM_RXD2FR Reset EP2 Receive Flag Sender s DATA Toggle should be checked read out EP2 Rx Data Buffer src UE2D0 n USR1 BM_RP2SIZ Check Transfer Size while ...

Страница 111: ...ts UIR2 0xff clear all Flags in UIR1 R0Sequence 0 EP0 Rx starts with DATA0 R2Sequence 0 EP2 Rx starts with DATA0 USB_State US_POWERED powered but not yet reset TxBuf_RdIdx 0 reset Buffer Indexes TxBuf_WrIdx 0 RxBuf_RdIdx 0 RxBuf_WrIdx 0 uchar getUSB uchar c while RxBuf_RdIdx RxBuf_WrIdx wait if RxBuffer is empty c RxBuffer RxBuf_RdIdx RxBuf_RdIdx RxBuf_RdIdx 1 MAX_RXBUF_SIZE 1 return c void putUSB...

Страница 112: ... if USR0 BM_SETUP was it a SETUP Packet handleSETUP else or a normal OUT Packet handleOUT else if UIR1 BM_TXD0F has EP0 sent Data handleIN else if UIR1 BM_TXD1F has EP1 sent Data handleIN1 else if UIR1 BM_RXD2F has EP2 received Data handleOUT2 else if UIR1 BM_RSTF USB Reset Signal State detected initUSB Soft Reset of USB Systems UCR3 BM_ENABLE1 BM_ENABLE2 Enable EP1 and EP2 UIR0 BM_TXD0IE BM_RXD0I...

Страница 113: ...nge the following Definitions to meet your Hardware Requirements Transmit Line is PTC 0 define setTxLow PTC 0x01 define setTxHigh PTC 0x01 define enaTxOut DDRC 0x01 Receive Line is PTA 7 define tstRxLvl PTA 0x80 define enaRxIn DDRA 0x80 Hardware Dependencies SSCI Bit Timing generated by System Timer TIM Change the following Definitions to meet your Hardware Requirements clear TSTOP Bit in TSC Regi...

Страница 114: ...id initSSCI setTxHigh set Output Data Latch H enaTxOut enable Output Driver for Tx enaRxIn Rx is an Input Line void putSSCI char c unsigned char n unsigned char ccr_save ccr_save getCCR save current Interrupt Mask disableINTR disable Interrupts setTxLow send Startbit delayBitTime n 8 do send 8 Databits LSB first if c 1 0 setTxLow else setTxHigh delayBitTime c 1 while n setTxHigh send Stopbit delay...

Страница 115: ...ave ccr_save getCCR save current Interrupt Mask disableINTR disable Interrupts while tstRxLvl 0 wait for H L transition delayHalfBit n 8 do get 8 Databits delayBitTime c 1 if tstRxLvl 0 c 0x80 while n delayBitTime if tstRxLvl 0 check Rx Line during Stopbit add framing error handling if desired delayHalfBit setCCR ccr_save restore previous Interrupt Mask return c ...

Страница 116: ...ted to Port Bit 4 define KEY_MASK 0x70 define KEY_FIRST 4 Variables Var used to track the Key Status unsigned char KeyState void initKey POCR 0x01 enable PTA Pullups PTA KEY_MASK write 1 to Output Latches DDRA KEY_MASK output H Level Pulse DDRA KEY_MASK back to Input KBIER KEY_MASK enable Interrupts KBSCR 0x04 reset ACKK just in case KeyState 0 reset internal Status Var char getKey unsigned char x...

Страница 117: ...b08 Rem View Edit this File with TAB Size 4 include hc08jb8 h include u08adc h void initSADC disable internal Pull Ups on PTE POCR 0x80 disable PTE20P unsigned scaleSADC unsigned t1 unsigned t2 t1 4 t2 4 _asm lda 5 sp _asm psha _asm pulh _asm ldx 2 sp _asm lda 6 sp _asm div A H A X _asm clrx 0 A t2 t1 int getSADC char channel unsigned t0 t1 t2 unsigned char p unsigned volatile zz convert channel 1...

Страница 118: ... 2 H DDRE 0x07 Output for zz 0 zz 1000 zz DDRE 0x07 PTE HiZ Input t0 TCNT while PTE channel 0 t1 TCNT t1 t0 acquisition cycle DDRD 0x38 PTD 3 5 HiZ DDRE 0x07 Output for zz 0 zz 1000 zz DDRE 0x07 PTE HiZ Input t0 TCNT while PTE channel 0 t2 TCNT t2 t2 t0 t1 100 if t2 50000u t2 0 underflow if t2 t1 t2 t1 1 overflow calculate scaled result t2 scaleSADC t1 t2 return t2 ...

Страница 119: ...T VECTORS TABLE FOR HC908JB8 Cosmic HC08 C Compiler extern void _stext startup routine extern void isrDummy extern void isrUSB extern void timer0ISR extern void isrKey void const _vectab isrKey Keypad isrDummy TIMER overflow isrDummy TIMER channel 1 isrDummy TIMER channel 0 isrDummy IRQ1 isrUSB USB isrDummy SWI _stext RESET ...

Страница 120: ...ef _main __sbss __memory __stack __HC08Setup xdef _exit __stext __stext ldhx __stack initialize stack pointer txs jsr __HC08Setup ldhx __sbss start of bss bra loop start loop zbcl clr 0 x clear byte aix 1 next byte loop cphx __memory up to the end bne zbcl and loop prog ldhx __stack initialize stack pointer txs jsr _main execute main _exit bra _exit and stay here end ...

Страница 121: ...ta a ubsct data start address def __sbss bss start address of bss Put your startup file here crtsjb8 o startup routine Put your files here u08main o u08key o u08adc o c programs cosmic cx08 Lib libi h08 c programs cosmic cx08 Lib libm h08 seg const b 0xfff0 vectors start address Put your interrupt vectors file here if needed vecjb8 o def __memory bss symbol used by library def __stack 0x013f stack...

Страница 122: ... const Modules crtsjb8 o start 0000dc00 end 0000dc1d length 29 section text u08main o start 0000dc1d end 0000e0e0 length 1219 section text start 00000041 end 00000074 length 51 section bss start 0000e263 end 0000e2f5 length 146 section const u08key o start 0000e0e0 end 0000e133 length 83 section text start 00000074 end 00000075 length 1 section bss u08adc o start 0000e133 end 0000e263 length 304 s...

Страница 123: ...fer 00000051 defined in u08main o section bss _SetupBuffer 00000046 defined in u08main o section bss _SetupDataPtr 00000043 defined in u08main o section bss _SetupSize 00000045 defined in u08main o section bss _String0Desc 0000e295 defined in u08main o section const _String1Desc 0000e299 defined in u08main o section const _String2Desc 0000e2c1 defined in u08main o section const _StringDescTable 00...

Страница 124: ...00dee0 defined in u08main o section text _handleSETUP 0000dd94 defined in u08main o section text _initKey 0000e0e0 defined in u08key o section text used in u08main o _initSADC 0000e133 defined in u08adc o section text used in u08main o _initUSB 0000df2f defined in u08main o section text _isrDummy 0000dfff defined in u08main o section text used in vecjb8 o _isrKey 0000e122 defined in u08key o secti...

Страница 125: ...2956C0247 S123DEC026026C017CC60062C100612705F6A10825D2B63CA880A480FBAB20B73CA70381FF S123DEE0A7FC450019F6A4EFF7A610B718A63095E7036F02B63EA40FE7012028C6004F4C1A S123DF00A40FF7C1005027FB95E602EE03878AF6CE004F8CD7005195F6C7004F6C032602A2 S123DF206C026A016D0126D4A610B719A70481A680B7383F3B3F3C3F19A644B71A3F1B3F34 S123DF4039A6FFB7184FC70042C700414CC700734FC70062C70061C70050C7004F8187C68F S123DF600050C10...

Страница 126: ...CE605A001E703E604A200E702E60387E60287E605EE04CDE13B26 S106E260A70C8183 S123E2631201100100000008700C000000010102000109022000010100C0000904000002EE S123E283FF01FF000705810308000A0705020308000A0403090428034D0043005400200070 S123E2A345006C0065006B00740072006F006E0069006B006C006100640065006E002E030A S123E2C35500530042003000380020004500760061006C0075006100740069006F006E00AD S115E2E3200042006F00610072006...

Страница 127: ...al MOTOROLA Bill of Materials and Schematic 127 Designer Reference Manual USB08 Evaluation Board Appendix D Bill of Materials and Schematic This appendix includes USB08 V 1 01 bill of materials Table D 1 USB08 evaluation board schematic Figure D 1 ...

Страница 128: ...19 100 nF C5 C6 10 µF C16 100 µF 25 V C20 C21 C22 10 nF D1 D2 D3 D4 LED D5 D6 BAT42 D7 ZD8 2V D8 1N4001 IC1 MC68HC908JB8ADW IC2 MAX232A IC3 7805 JP1 Header 2x8 JP2 Header 1x3 L1 L2 Ferrite Q1 XTAL 6 MHz R1 MPY7P photoresistor R2 K164 4 7k NTC R3 10 k potentiometer R4 R5 R6 10 k R7 1 5 k 5 optional R8 R13 R14 R15 10 k R9 2 2 k R10 R11 R12 R19 330 R R16 R17 27 R R18 10 M S1 S2 S3 S4 S5 Push Button X...

Страница 129: ...USB08 Evaluation Board Designer Reference Manual MOTOROLA Bill of Materials and Schematic 129 Bill of Materials and Schematic Figure D 1 USB08 Evaluation Board Schematic ...

Страница 130: ...Designer Reference Manual USB08 Evaluation Board 130 Bill of Materials and Schematic MOTOROLA Bill of Materials and Schematic ...

Страница 131: ...rmany Telephone 49 3677 8462 0 Fax 49 3677 8462 18 Email USBIO thesycon de Web http www thesycon de Copyright 1998 2000 Thesycon Systemsoftware and Consulting GmbH All Rights Reserved Reprinted with permission from Thesycon Systemsoftware Consulting GmbH For inclusion in this document the manual has been reformatted only The following trademarks are referenced throughout this manual Microsoft Wind...

Страница 132: ..._DESCRIPTOR 151 IOCTL_USBIO_SET_DESCRIPTOR 152 IOCTL_USBIO_SET_FEATURE 153 IOCTL_USBIO_CLEAR_FEATURE 154 IOCTL_USBIO_GET_STATUS 155 IOCTL_USBIO_GET_CONFIGURATION 156 IOCTL_USBIO_GET_INTERFACE 157 IOCTL_USBIO_STORE_CONFIG_DESCRIPTOR 158 IOCTL_USBIO_SET_CONFIGURATION 159 IOCTL_USBIO_UNCONFIGURE_DEVICE 160 IOCTL_USBIO_SET_INTERFACE 161 IOCTL_USBIO_CLASS_OR_VENDOR_IN_REQUEST 162 IOCTL_USBIO_CLASS_OR_V...

Страница 133: ...CRIPTOR_REQUEST 187 USBIO_FEATURE_REQUEST 188 USBIO_STATUS_REQUEST 189 USBIO_STATUS_REQUEST_DATA 190 USBIO_GET_CONFIGURATION_DATA 191 USBIO_GET_INTERFACE 192 USBIO_GET_INTERFACE_DATA 193 USBIO_INTERFACE_SETTING 194 USBIO_SET_CONFIGURATION 195 USBIO_CLASS_OR_VENDOR_REQUEST 196 USBIO_DEVICE_PARAMETERS 198 USBIO_INTERFACE_CONFIGURATION_INFO 200 USBIO_PIPE_CONFIGURATION_INFO 202 USBIO_CONFIGURATION_IN...

Страница 134: ...1 3 Configuration 225 E 7 1 4 Interface 225 E 7 1 5 Pipes 225 E 7 1 6 Class or Vendor Request 226 E 7 1 7 Feature 226 E 7 1 8 Other 226 E 7 1 9 Dialog Pages for Pipe Operations 227 E 7 1 10 Pipe 227 E 7 1 11 Buffers 227 E 7 1 12 Control 228 E 7 1 13 Read from Pipe to Output Window 228 E 7 1 14 Read from Pipe to File 228 E 7 1 15 Write from File to Pipe 229 E 8 Installation Issues 229 E 8 1 Automat...

Страница 135: ...ice drivers for the USB Host Controller hardware for USB Hubs and for some classes of USB devices The USB device drivers provided by Microsoft support devices that conform with the appropriate USB device class definitions made by the USB Implementers Forum USB devices that do not conform to one of the USB device class specifications e g in the case of a new device class or a device under developme...

Страница 136: ...dows 98 Windows 98 Second Edition SE the second release of Windows 98 Windows Millennium the successor to Windows 98 Windows 2000 the successor to Windows NT Windows 2000 Service Pack 1 NOTE Windows NT 4 0 and Windows 95 are not supported by USBIO E 3 2 Features The USBIO driver provides the following features Compiles with the Win32 Driver Model WDM Supports Plug Play Supports Power Management Pr...

Страница 137: ... it is not possible to use the generic USBIO driver However in such a case it is possible to develop a custom device driver based on the source code of the USBIO though Please contact Thesycon if you need support on such kind of project Although the USBIO device driver fully supports isochronous data pipes there are some limitations with respect to isochronous data transfers They result from the f...

Страница 138: ...Controller is the hardware component that controls the Universal Serial Bus It also contains the USB Root Hub OpenHCI SYS is the host controller driver for controllers that conform with the Open Host Controller Interface specification Optionally it can be replaced by UHCD SYS that is the Universal Host Controller Driver Which driver is used depends on the main board chip set for the PC For instanc...

Страница 139: ...caller after completion The USB Driver Interface is accessible for kernel mode drivers only Normally there is no way to use this interface directly from applications that run in user mode The USBIO device driver was designed to overcome this limitation It connects to the USBDI at its lower edge and provides a private interface at its upper edge that can be used by Win32 applications Thus the USB d...

Страница 140: ...face ID All device objects managed by USBIO are identified by the same GUID The GUID is defined in the USBIO Setup Information INF file Based on the GUID and an instance number the operating system generates a unique name for each device object This name should be considered as opaque by applications It should never be used directly or stored permanently It is possible to enumerate all the device ...

Страница 141: ...as user defined interface in USBIO_UserInterfaceGuid in the USBIO INF file The private GUID is also used by the customer s application for device enumeration For that reason the generated GUID must also be included in the application The macro DEFINE_GUID can be used for that purpose See the Microsoft Platform SDK documentation for further information As stated above all devices connected to USBIO...

Страница 142: ... USBD Because of that there is no pipe object for endpoint zero and there are no pipe objects available until the device is configured In order to access a pipe the application has to create a handle by opening the device object as described above and attach it to a pipe This operation is called bind After a binding is successfully established the application can use the handle to communicate with...

Страница 143: ...ction from host to device The application has created three handles for the device by calling CreateFile Handle1 is not bound to any pipe therefore it can be used to perform device related operations only It is called a device handle Handle2 is bound to the IN pipe 0x81 By using this handle with the Win32 function ReadFile the application can initiate data transfers from endpoint 0x81 to its buffe...

Страница 144: ...o GUID g_UsbioID USBIO_IID SP_DEVICE_INTERFACE_DATA DevData SP_INTERFACE_DEVICE_DETAIL_DATA DevDetail NULL DWORD ReqLen DWORD BytesReturned enumerate the devices get a handle to the device list DevInfo SetupDiGetClassDevs g_UsbioID NULL NULL DIGCF_DEVICEINTERFACE DIGCF_PRESENT get the device with index DEVICE_NUMBER SetupDiEnumDeviceInterfaces DevInfo NULL g_usbioID DEVICE_NUMBER DevData get lengt...

Страница 145: ...uration sizeof SetConfiguration NULL 0 BytesReturned NULL setup the data structure to bind the file handle BindPipe EndpointAddress 0x81 the device has an endpoint 0x81 bind the file handle DeviceIoControl FileHandle IOCTL_USBIO_BIND_PIPE BindPipe sizeof BindPipe NULL 0 BytesReturned NULL read or write data from to the device use OVERLAPPED structure if necessary ReadFile FileHandle close file han...

Страница 146: ... down Otherwise a message box appears on the screen and informs the user that the system is not able to go into the sleeping mode Before the system goes into a sleeping state the driver has to save all the information that it needs to reinitialize the device device context if the system is resumed Furthermore all pending requests have to be completed and further requests have to be queued In the d...

Страница 147: ... to 2 the device can go into a suspend state but not into D3 Off A power down request caused by a low battery condition cannot be suppressed by using this parameter If no file handle is currently open for the device the key MinPowerStateUnused defines the minimal power state the device can go into Thus its meaning is similar to that of the parameter MinPowerStateUsed If the parameter AbortPipesOnP...

Страница 148: ...tailed information on the functions RegisterDeviceNotification and UnregisteredDeviceNotification In addition the source code of the USBIO demo application USBIOAPP provides an usage example The device notification mechanism is only available if the USBIO device naming scheme is based on Device Interface IDs GUIDs See E 4 1 1 USBIO Device Objects for details We strongly recommend to use this new n...

Страница 149: ...fault pipe IOCTL_USBIO_UNCONFIGURE_DEVICE device request on default pipe IOCTL_USBIO_SET_INTERFACE device request on default pipe IOCTL_USBIO_CLASS_OR_VENDOR_IN_REQUEST device request on default pipe IOCTL_USBIO_CLASS_OR_VENDOR_OUT_REQUEST device request on default pipe IOCTL_USBIO_GET_DEVICE_PARAMETERS device IOCTL_USBIO_SET_DEVICE_PARAMETERS device IOCTL_USBIO_GET_CONFIGURATION_INFO device IOCTL...

Страница 150: ...of interest DWORD dwIoControlCode control code of operation to perform LPVOID lpInBuffer pointer to buffer to supply input data DWORD nInBufferSize size of input buffer LPVOID lpOutBuffer pointer to buffer to receive output data DWORD nOutBufferSize size of output buffer LPDWORD lpBytesReturned pointer to variable to receive output byte count LPOVERLAPPED lpOverlapped pointer to overlapped structu...

Страница 151: ...mpletely by the caller nInBufferSize Specifies the size in bytes of the buffer point to by lpInBuffer which has to be sizeof USBIO_DESCRIPTOR_REQUEST for this operation lpOutBuffer Pointer to a buffer that will receive the descriptor data nOutBufferSize Specifies the size in bytes of the buffer pointed to be lpOutBuffer Comments The buffer that is passed to this function in lpOutBuffer should be l...

Страница 152: ...ns an USBIO_DESCRIPTOR_REQUEST page 187 data structure This data structure has to be filled completely by the caller nInBufferSize Specifies the size in bytes of the buffer pointed to by lpInBuffer which has to be sizeof USBIO_DESCRIPTOR_REQUEST for this operation lpOutBuffer Pointer to a buffer that contains the descriptor data to be set nOutBufferSize Specifies the size in bytes of the buffer po...

Страница 153: ...contains an USBIO_FEATURE_REQUEST page 188 data structure This data structure has to be filled completely by the caller nInBufferSize Specifies the size in bytes of the buffer pointed to by lpInBuffer which has to be sizeof USBIO_FEATURE_REQUEST for this operation lpOutBuffer Not used with this operation Set to NULL nOutBufferSize Not used with this operation Set to zero Comments The SET_FEATURE r...

Страница 154: ...n USBIO_FEATURE_REQUEST page 188 data structure This data structure has to be filled completely by the caller nInBufferSize Specifies the size in bytes of the buffer pointed to by lpInBuffer which has to be sizeof USBIO_FEATURE_REQUEST for this operation lpOutBuffer Not used with this operation Set to NULL nOutBufferSize Not used with this operation Set to zero Comments The CLEAR_FEATURE request a...

Страница 155: ...Specifies the size in bytes of the buffer pointed to by lpInBuffer which has to be sizeof USBIO_STATUS_REQUEST for this operation lpOutBuffer Pointer to a buffer that will receive an USBIO_STATUS_REQUEST_DATA page 190 data structure nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer which has to be at least sizeof USBIO_STATUS_REQUEST_DATA for this operation Comment...

Страница 156: ...LL nInBufferSize Not used with this operation Set to zero lpOutBuffer Pointer to a buffer that will receive an USBIO_GET_CONFIGURATION_DATA page 191 data structure nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer which has to be at least sizeof USBIO_GET_CONFIGURATION_DATA for this operation Comments A GET_CONFIGURATION request appears on the bus The structure USB...

Страница 157: ...pletely by the caller nInBufferSize Specifies the size in bytes of the buffer pointed to by lpInBuffer which has to be sizeof USBIO_GET_INTERFACE for this operation lpOutBuffer Pointer to a buffer that will receive an USBIO_GET_INTERFACE_DATA page 193 data structure nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer which has to be at least sizeof USBIO_GET_INTERFAC...

Страница 158: ...es the descriptor from the device There may be cases where the USBD driver provided by Microsoft with Windows does not process correctly the configuration descriptor that is reported by the device This means it would not be possible to configure the device In this situation the IOCTL_USBIO_STORE_CONFIG_DESCRIPTOR request may be used to work around the problem This request enables the application t...

Страница 159: ...on Set to zero Comments A SET_CONFIGURATION request appears on the bus The USBD generates additional SET_INTERFACE requests on the bus if necessary All available interfaces have to be configured or the request will fail The number of interfaces and the alternate setting for each interface have to be specified in the structure USBIO_SET_CONFIGURATION page 195 All pipe handles associated with the de...

Страница 160: ... to its unconfigured state lpInBuffer Not used with this operation Set to NULL nInBufferSize Not used with this operation Set to zero lpOutBuffer Not used with this operation Set to NULL nOutBufferSize Not used with this operation Set to zero Comments A SET_CONFIGURATION request with the configuration value 0 appears on the bus All pipe handles associated with the device will be unbound and all pe...

Страница 161: ...ly by the caller nInBufferSize Specifies the size in bytes of the buffer pointed to by lpInBuffer which has to be sizeof USBIO_INTERFACE_SETTING for this operation lpOutBuffer Not used with this operation Set to NULL nOutBufferSize Not used with this operation Set to zero Comments A SET_INTERFACE request appears on the bus All pipe handles associated with the interface will be unbound and all pend...

Страница 162: ... to be sizeof USBIO_CLASS_OR_VENDOR_REQUEST for this operation lpOutBuffer Pointer to a buffer that receives the data transferred from the device during the data phase of the control transfer If the request does not return any data this value can be NULL nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer If this value is set to zero then there is no data transfer ph...

Страница 163: ...which has to be sizeof USBIO_CLASS_OR_VENDOR_REQUEST for this operation lpOutBuffer Pointer to a buffer that contains the data to be transferred to the device during the data phase of the control transfer If the request has no data phase this value can be NULL nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer If this value is set to zero then there is no data trans...

Страница 164: ... nInBufferSize Not used with this operation Set to zero lpOutBuffer Pointer to a buffer that will receive an USBIO_DEVICE_PARAMETERS page 198 data structure nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer which has to be at least sizeof USBIO_DEVICE_PARAMETERS for this operation Comments The default state of the device parameters is defined by a set of registry p...

Страница 165: ..._PARAMETERS page 198 data structure This data structure has to be filled completely by the caller nInBufferSize Specifies the size in bytes of the buffer pointed to be lpInBuffer which has to be sizeof USBIO_DEVICE_PARAMETERS for this operation lpOutBuffer Not used with this operation Set to NULL nOutBufferSize Not used with this operation Set to zero Comments The default state of the device param...

Страница 166: ...onfigured lpInBuffer Not used with this operation Set to NULL nInBufferSize Not used with this operation Set to zero lpOutBuffer Pointer to a buffer that will receive an USBIO_CONFIGURATION_INFO page 204 data structure nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer which has to be at least sizeof USBIO_CONFIGURATION_INFO for this operation Comments This operatio...

Страница 167: ...nbound and all pending requests will be cancelled Note that the device receives two USB Resets and a new USB address is assigned by USBD After this operation the device is in the unconfigured state The USBIO driver allows an USB reset request only if the device is configured That means IOCTL_USBIO_SET_CONFIGURATION page 159 was successfully executed If the device is in the unconfigured state this ...

Страница 168: ...ffer Not used with this operation Set to Null nInBufferSize Not used with this operation Set to zero lpOutBuffer Pointer to a buffer that will receive an USBIO_FRAME_NUMBER page 205 data structure nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer which has to be at least sizeof USBIO_FRAME_NUMBER for this operation Comments The returned frame number is a 32 bit val...

Страница 169: ...e in bytes of the buffer pointed to by lpInBuffer which has to be at least sizeof USBIO_DEVICE_POWER for this operation lpOutBuffer Not used with this operation Set to NULL nOutBufferSize Not used with this operation Set to zero Comments The device power state is maintained internally by the USBIO driver This request may be used to change the current power state If the device is set to a power sta...

Страница 170: ... used with this operation Set to NULL nInBufferSize Not used with this operation Set to zero lpOutBuffer Pointer to a buffer that will receive an USBIO_DEVICE_POWER page 206 data structure nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer which has to be at least sizeof USBIO_DEVICE_POWER for this operation Comments The device power state is maintained internally b...

Страница 171: ...urrently running lpInBuffer Not used with this operation Set to NULL nInBufferSize Not used with this operation Set to zero lpOutBuffer Pointer to a buffer that will receive an USBIO_DRIVER_INFO page 186 data structure nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer which has to be at least sizeof USBIO_DRIVER_INFO for this operation Comments An application shoul...

Страница 172: ...iew a disconnect connect is simulated This request causes the following events to occur The USBIO device instance that is associated with the USB device will be removed The corresponding device handles become invalid and should be closed by the application The operating system starts a new enumeration of the device The following events occur on the bus USB Reset GET_DEVICE_DESCRIPTOR USB Reset SET...

Страница 173: ...t Particularly this is required to implement the Device Firmware Upgrade DFU device class specification Note that the USB device receives two USB Resets after this call This does not conform to the DFU specification However this is the standard device enumeration method used by the Windows USB bus driver USBD This request does not work if the system provided multi interface driver is used This dri...

Страница 174: ...y by the caller nInBufferSize Specifies the size in bytes of the buffer pointed to by lpInBuffer which has to be sizeof USBIO__BIND_PIPE for this operation lpOutBuffer Not used with this operation Set to NULL nOutBufferSize Not used with this operation Set to zero Comments This pipe is identified by its endpoint address Only endpoints from the current configuration can be bound After this operatio...

Страница 175: ...le and a pipe object lpInBuffer Not used with this operation Set to NULL nInBufferSize Not used with this operation Set to zero lpOutBuffer Not used with this operation Set to NULL nOutBufferSize Not used with this operation Set to zero Comments After this operation is successfully completed the handle is unbound and may be used to bind another pipe It is not necessary to unbind a pipe handle befo...

Страница 176: ...tion Set to zero Comments If an error occurs while transferring data from or to a pipe the USBD halts the pipe and returns an error code No further transfers can be performed while the pipe is halted To recover from this error condition and to restart the pipe an IOCTL_USBIO_RESET_PIPE has to be sent to the pipe This request causes that a CLEAR_FEATURE ENDPOINT_STALL request appears on the bus In ...

Страница 177: ...on causes that all outstanding requests for the pipe are cancelled lpInBuffer Not used with this operation Set to NULL nInBufferSize Not used with this operation Set to zero lpOutBuffer Not used with this operation Set to NULL nOutBufferSize Not used with this operation Set to zero Comments All outstanding read or write requests on the pipe are aborted and returned with an error status of USBIO_ER...

Страница 178: ...nInBufferSize Not used with this operation Set to zero lpOutBuffer Pointer to a buffer that will receive an USBIO_PIPE_PARAMETERS page 208 data structure nOutBufferSize Specifies the size in bytes of the buffer pointed to by lpOutBuffer which has to be at least sizeof USBIO_PIPE_PARAMETERS for this operation Comments The default state of the pipe parameters is defined by a set of registry paramete...

Страница 179: ...RAMETERS page 208 data structure This data structure has to be filled completely by the caller nInBufferSize Specifies the size in bytes of the buffer pointed to by lpInBuffer which has to be sizeof USBIO_PIPE_PARAMETERS for this operation lpOutBuffer Not used with this operation Set to NULL nOutBufferSize Not used with this operation Set to zero Comments The default state of the pipe parameters i...

Страница 180: ...the caller nInBufferSize Specifies the size in bytes of the buffer pointed to by lpInBuffer which has to be sizeof USBIO_PIPE_CONTROL_TRANSFER for this operation lpOutBuffer Pointer to a buffer that receives the data transferred from the device during the data phase of the control transfer If no data transfer is required the pointer may be NULL nOutBufferSize Specifies the size in bytes of the buf...

Страница 181: ...ompletely by the caller nInBufferSize Specifies the size in bytes of the buffer pointed to by lpInBuffer which has to be sizeof USBIO_PIPE_CONTROL_TRANSFER for this operation lpOutBuffer Pointer to a buffer that contains the data transferred to the device during the data phase of the control transfer If no data transfer is required the pointer may be NULL nOutBufferSize Specifies the size in bytes...

Страница 182: ...n is defined as follows BOOL WriteFile HANDLE hFile handle of file to write LPVOID lpBuffer pointer to data to write to file DWORD nNumberOfBytesToWrite number of bytes to write LPDWORD lpNumberOfBytesWritten pointer to number of bytes written LPOVERLAPPED lpOverlapped pointer to OVERLAPPED structure By using these functions it is possible to implement both synchronous and asynchronous data transf...

Страница 183: ...er is equal to the FIFO size this packet is sent No additional zero packet is sent automatically To send a data packet with length zero set the buffer length to zero and use a NULL buffer pointer Bulk or Interrupt Read Transfers The read operation is used to transfer data from the USB device to the host PC The buffer is divided into data pieces packets of the FIFO size of the endpoint The buffer s...

Страница 184: ...rwise every data packet from the endpoint that is smaller than the FIFO size causes an error E 5 3 2 Isochronous Transfers For isochronous transfers the data buffer that is passed to the ReadFile or WriteFile function has to contain a header that describes the location and the size of the data packets to be transferred Therefore the buffer that follows the header is divided into packets Each packe...

Страница 185: ...e less than or equal to the FIFO size of the endpoint There must not be gaps between the data packets in the transfer buffer The Offset and Length member of the USBIO_ISO_PACKET structures have to be initialized correctly before the transfer is started Isochronous Read Transfers The size of each packet should be equal to the FIFO size Otherwise a data overrun error can occur The Offset member of t...

Страница 186: ...he version number of the driver executable The format is as follows upper 8 bit major version lower 8 bit minor version DriverBuildNumber Contains the build number of the driver executable Flags This field contains zero or any combination bit wise or of the following values USBIO_INFOFLAG_CHECKED_BUILD If this flag is set the driver that is currently running is a checked debug build USBIO_INFOFLAG...

Страница 187: ...equest The values are defined by the enumeration type USBIO_REQUEST_RECIPIENT page 215 DescriptorType Specifies the type of descriptor to get or set The values are defined by the Universal Serial Bus Specification 1 1 Chapter 9 and additional device class specifications Value Meaning 1 Device Descriptor 2 Configuration Descriptor 3 String Descriptor 4 Interface Descriptor 5 Endpoint Descriptor 21 ...

Страница 188: ...clear feature request The values are defined by the enumeration type USBIO_REQUEST_RECIPIENT page 215 FeatureSelector Specifies the feature selector value for the set feature or clear feature request The values are defined by the recipient Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for more information Index Specifies the index value for the set feature or clear feature request ...

Страница 189: ...BIO_STATUS_REQUEST USBIO_REQUEST_RECIPIENT Recipient USHORT Index USBIO_STATUS_REQUEST Members Recipient Specifies the recipient of the get status request The values are defined by the enumeration type USBIO_REQUEST_RECIPIENT page 215 Index Specifies the index value for the get status request The values are defined by the device Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for mor...

Страница 190: ...s operation Definition typedef struct _USBIO_STATUS_REQUEST_DATA USHORT Status USBIO_STATUS_REQUEST_DATA Member Status Contains the 16 bit value that is returned by the recipient in response to the get status request The interpretation of the value is specific to the recipient Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for more information Comments This structure is an output of...

Страница 191: ... typedef struct _USBIO_GET_CONFIGURATION_DATA UCHAR ConfigurationValue USBIO_GET_CONFIGURATION_DATA Member ConfigurationValue Contains the 8 bit value that is returned by the device in response to the get configuration request The meaning of the value is defined by the device A value of zero means the device is not configured Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for more i...

Страница 192: ...used to request the current alternate setting of an interface Definition typedef struct _USBIO_GET_INTERFACE USHORT Interface USBIO_GET_INTERFACE Member Interface Specifies the interface number The meaning is device specific Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for more information Comments This structure has to be used as an input for IOCTL_USBIO_GET_INTERFACE page 157 re...

Страница 193: ...erface operation Definition typedef struct _USBIO_GET_INTERFACE_DATA UCHAR AlternateSetting USBIO_GET_INTERFACE_DATA Member AlternateSetting Contains the 8 bit value that is returned by the device in response to a get interface request The interpretation of the value is specific to the device Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for more information Comments This structure...

Страница 194: ...e device Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for more information AlternateSettingIndex Specifies the alternate setting to be set for this interface The value is defined by the device Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for more information MaximumTransferSize Specifies the maximum size in bytes of data transfers to or from endpoints of this inte...

Страница 195: ..._CONFIGURATION Members ConfigurationIndex Specifies the configuration to be set The meaning of the value is defined by the device Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for more information NbOfInterface Specifies the number of interfaces in this configuration This is the number of valid entries in InterfaceList InterfaceList USBIO_MAX_INTERFACES An array of USBIO_INTERFACE_...

Страница 196: ...RT_TRANSFER_OK If this flag is set the USBIO driver does not return an error if a data packet received from the device is shorter than the maximum packet size of the endpoint Otherwise a short packet causes an error condition Type Specifies the type of the device request The values are defined by the enumeration type USBIO_REQUEST_TYPE page 216 Recipient Specifies the recipient of the device reque...

Страница 197: ...ture are used to generate an eight byte setup packet for the control endpoint of the device The format of the setup packet is defined by the Universal Serial Bus Specification 1 1 Chapter 9 The meanings of the values are device dependent This structure has to be used as an input for IOCTL_USBIO_CLASS_OR_VENDOR_IN_REQUEST page 162 and IOCTL_USBIO_CLASS_OR_VENDOR_OUT_REQUEST page 163 operations ...

Страница 198: ...ill be ignored The default state of this option is defined by the registry parameter ResetDeviceOnClose USBIO_UNCONFIGURE_ON_CLOSE If this option is set the USBIO driver sets the USB device to its unconfigured state after the last handle to the device was closed by the application The default state of this option is defined by the registry parameter UnconfigureOnClose USBIO_ENABLE_REMOTE_WAKEUP If...

Страница 199: ...fies the time out interval in milliseconds to be used for synchronous operations A value of zero means an infinite interval time out disabled The default time out value is defined by the registry parameter RequestTimeout Comments This structure is intended to be used with IOCTL_USBIO_GET_DEVICE_PARAMETERS page 164 and IOCTL_USBIO_SET_DEVICE_PARAMETERS page 165 operations ...

Страница 200: ...he configuration descriptor AlternateSetting Specifies the index of the alternate setting as reported by the device in the configuration descriptor The default alternate setting of an interface is zero Class Specifies the class code as reported by the device in the configuration descriptor The meaning of this value is defined by the USB class specifications SubClass Specifies the subclass code as ...

Страница 201: ...08 Evaluation Board Designer Reference Manual MOTOROLA Universal USB Device Driver USBIO 201 reserved1 Reserved field set to zero reserved2 Reserved field set to zero Comments This structure is an output of IOCTL_USBIO_GET_CONFIGURATION_INFO page 166 operations ...

Страница 202: ...IPE_TYPE page 214 MaximumTransferSize Specifies the maximum size in bytes of data transfers the USBD supports on this pipe This is the maximum size of buffers that can be used with read or write operations on this pipe MaximumPacketSize Specifies the maximum packet size of USB data transfers the endpoint is capable of sending or receiving as reported by the device in the corresponding endpoint des...

Страница 203: ...nly Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for more information InterfaceNumber Specifies the index of the interface the pipe belongs to The value corresponds to the field InterfaceNumber of an USBIO_INTERFACE_CONFIGURATION_INFO page 200 structure reserved1 Reserved field set to zero reserved2 Reserved field set to zero reserved3 Reserved field set to zero Comments This stru...

Страница 204: ...O Members NbOfInterface Contains the number of interfaces This is the number of valid entries in the InterfaceInfo structure NbOfPipes Contains the number of pipes This is the number of valid entries in the PipeInfo structure InterfaceInfo USBIO_MAX_INTERFACES An array of USBIO_INTERFACE_CONFIGURATION_INFO page 200 structures that describes the interfaces There are NbOfInterfaces valid entries in ...

Страница 205: ..._NUMBER The USBIO_FRAME_NUMBER structure contains information about the USB frame counter value Definition typedef struct _USBIO_FRAME_NUMBER ULONG FrameNumber USBIO_FRAME_NUMBER Members FrameNumber Contains the current value of the frame counter maintained by the USBD Comments This structure is an output of IOCTL_USBIO_GET_CURRENT_FRAME_NUMBER page 168 requests ...

Страница 206: ...SB device power states Definition typedef struct _USBIO_DEVICE_POWER USBIO_DEVICE_POWER_STATE DevicePowerState USBIO_DEVICE_POWER Member DevicePowerState Contains the power state of the USB device The values are defined by the USBIO_DEVICE_POWER_STATE page 217 enumeration type Comments This structure is used with IOCTL_USBIO_GET_DEVICE_POWER_STATE page 170 and IOCTL_USBIO_SET_DEVICE_POWER_STATE pa...

Страница 207: ...dress Specifies the address of the endpoint on the USB device that shall be associated with the pipe The endpoint address is specified as reported in the corresponding endpoint descriptor The endpoint address includes the direction flag at bit position 7 MSB Bit 7 1 OUT endpoint Bit 7 0 IN endpoint Refer to the Universal Serial Bus Specification 1 1 Chapter 9 for more information Comments This str...

Страница 208: ...ing read operations from a Bulk or Interrupt pipe if a packet received from the device is shorter than the maximum packet size of the endpoint Otherwise a short packet causes an error condition This option is meaningful for IN pipes only Comments This structure is intended to be used with IOCTL_USBIO_GET_PIPE_PARAMETERS page 178 and IOCTL_USBIO_SET_PIPE_PARAMETERS page 179 operations The default s...

Страница 209: ...his field contains zero or the following value USBIO_SHORT_TRANSFER_OK If this flag is set the USBIO driver does not return an error if a data packet received from the device is shorter than the maximum packet size of the endpoint Otherwise a short packet causes an error condition SetupPacket 8 Specifies the setup packet to be sent to the device The format of the eight byte setup packet is defined...

Страница 210: ...he following values USBIO_SHORT_TRANSFER_OK If this flag is set the USBIO driver does not return an error if a data packet received from the device is shorter than the maximum packet size of the endpoint Otherwise a short packet causes an error condition USBIO_START_TRANSFER_ASAP If this flag is set the transfer will be started as soon as possible and the StartFrame parameter is ignored This flag ...

Страница 211: ...all start with An error occurs if the frame number is outside of the valid range ErrorCount Contains the total number of errors occurred during this transaction when the request is returned by the USBIO Comments This structure is the fixed size part of the USBIO_ISO_TRANSFER_HEADER page 213 that has to be used as an input for ReadFile and WriteFile operations with an isochronous pipe the transfer ...

Страница 212: ...o be specified by the caller for read and write operations Length Specifies the size in bytes of the packet This parameter has to be set by the caller for write operations On read operations this field is set by the USBIO when the request is returned Status Contains the final status code for the transfer of this packet when the request is returned by the USBIO Comments A variable size array of USB...

Страница 213: ...rmation IsoPacket 1 This is a variable length array of USBIO_ISO_PACKET page 212 structures Each member defines an isochronous packet to be transferred The number of valid entries in this array is defined by the NumberOfPackets field of IsoTransfer The maximum number of data packets is limited by the registry parameter MaxIsoPackets Comments The data buffer passed to ReadFile or WriteFile operatio...

Страница 214: ..._PIPE_TYPE The USBIO_PIPE_TYPE enumeration type contains values that identify the type of an USB pipe or an USB endpoint respectively Definition typedef enum _USBIO_PIPE_TYPE PipeTypeControl 0 PipeTypeIsochronous PipeTypeBulk PipeTypeInterrupt USBIO_PIPE_TYPE Comments The meaning of the values is defined by he Universal Serial Bus Specification 1 1 Chapter 9 ...

Страница 215: ...RECIPIENT The USBIO_REQUEST_RECIPIENT enumeration type contains values that identify the recipient of an USB device request Definition typedef enum _USBIO_REQUEST_RECIPIENT RecipientDevice 0 RecipientInterface RecipientEndpoint RecipientOther USBIO_REQUEST_RECIPIENT Comments The meaning of the values is defined by the Universal Serial Bus Specification 1 1 Chapter 9 ...

Страница 216: ...ice request Definition typedef enum _USBIO_REQUEST_TYPE RequestTypeClass 1 RequestTypeVendor USBIO_REQUEST_TYPE Comments The meaning of the values is defined by the Universal Serial Bus Specification 1 1 Chapter 9 The enumeration does not contain the Standard request type defined by the USB Specification This is because only Class and Vendor requests are supported by the USBD interface Standard re...

Страница 217: ...s values that identify the power state of a device Definition typedef enum _USBIO_DEVICE_POWER_STATE DevicePowerStateD0 0 DevicePowerStateD1 DevicePowerStateD2 DevicePowerStateD3 USBIO_DEVICE_POWER_STATE Entries DevicePowerStateD0 Device fully on normal operation DevicePowerStateD1 Suspend DevicePowerStateD2 Suspend DevicePowerStateD3 Device off Comments The meaning of the values is defined by the...

Страница 218: ...0010L USBIO_ERR_ENDPOINT_HALTED 0xE0000030L USBIO_ERR_NO_MEMORY 0xE0000100L USBIO_ERR_INVALID_URB_FUNCTION 0xE0000200L USBIO_ERR_INVALID_PARAMETER 0xE0000300L USBIO_ERR_ERROR_BUSY 0xE0000400L USBIO_ERR_REQUEST_FAILED 0xE0000500L USBIO_ERR_INVALID_PIPE_HANDLE 0xE0000600L USBIO_ERR_NO_BANDWIDTH 0xE0000700L USBIO_ERR_INTERNAL_HC_ERROR 0xE0000800L USBIO_ERR_ERROR_SHORT_TRANSFER 0xE0000900L USBIO_ERR_B...

Страница 219: ...T_OF_ADDRESS_SPACE 0xE0001015L USBIO_ERR_INTERFACE_NOT_FOUND 0xE0001016L USBIO_ERR_INVALID_DEVICE_STATE 0xE0001017L USBIO_ERR_INVALID_PARAM 0xE0001018L USBIO_ERR_DEMO_EXPIRED 0xE0001019L USBIO_ERR_INVALID_POWER_STATE 0xE000101AL USBIO_ERR_POWER_DOWN 0xE000101BL USBIO_ERR_VERSION_MISMATCH 0xE000101CL USBIO_ERR_SET_CONFIGURATION_FAILED 0xE000101DL USBIO_ERR_VID_RESTRICTION 0xE0001080L USBIO_ERR_ISO_...

Страница 220: ...ass library is provided fully in source code Figure E 4 shows the classes included in the USBIOLIB and their relations Figure E 4 USBIO Class Library E 6 1 CUsbIo Class The class CUsbIo implements the basic interface to the USBIO device driver It includes all functions that are related to an USBIO device object Thus by using an instance of the CUsbIo class all operations which do not require a pip...

Страница 221: ...s The function takes the parameters that are required for the operation and returns the status that is reported by the USBIO driver The CusbIoPipe class supports an asynchronous communication model for data transfers from or to the pipe The Read or Write function is used to submit a data buffer to the USBIO driver The function returns immediately indicating success if the buffer was sent to the dr...

Страница 222: ...threads E 6 4 CUsbIoReaderClass The class CUsbIoReader extends the CUsbIoThread class by a specific worker thread routine that continuously sends Read requests to the pipe The thread s main routine gets buffers from an internal buffer pool and submits them to the pipe using the Read function of the CUsbIoPipe class After all buffers are submitted the routine waits for the first pending buffer to c...

Страница 223: ...element Next pointer This may be used to build a chain of linked buffer objects to hold them in a list This way the management of buffers can be simplified E 6 7 CUsbIoBufPool Class The class CUsbIoBufPool is used to manage a pool of free buffers It provides functions used to allocate an initial number of buffers to get a buffer from the pool and to put a buffer back to the pool E 7 USBIO Demo App...

Страница 224: ...e USBIO device objects currently available It opens each device object and queries the USB device descriptor The USB devices currently attached to USBIO are listed in the output window A device can be opened and closed and the device parameters can be requested or set Related driver interfaces CreateFile CloseHandle IOCTL_USBIO_GET_DEVICE_PARAMETERS page 164 IOCTL_USBIO_SET_DEVICE_PARAMETERS page ...

Страница 225: ...IPTOR page 158 IOCTL_USBIO_SET_CONFIGURATION page 159 IOCTL_USBIO_UNCONFIGURE_DEVICE page 160 E 7 1 4 Interface By using this page the alternate setting of a configured interface can be changed Related driver interfaces IOCTL_USBIO_SET_INTERFACE page 161 IOCTL_USBIO_GET_INTERFACE page 157 E 7 1 5 Pipes This page allows to show all configured endpoints and interfaces by using the button Get Configu...

Страница 226: ... page 163 E 7 1 7 Feature This page can be used to send set or clear feature requests Related driver interfaces IOCTL_USBIO_SET_FEATURE page 153 IOCTL_USBIO_CLEAR_FEATURE page 154 E 7 1 8 Other This page allows to query the device state to reset the USB device to get the current frame number and to query or set the device power state Related driver interfaces IOCTL_USBIO_GET_STATUS page 155 IOCTL_...

Страница 227: ...ions The first three dialog pages are the same in all pipe dialogs The last page has a special meaning E 7 1 10 Pipe By using this page it is possible to access functions Reset Pipe Abort Pipe Get Pipe Parameters and Set Pipe Parameters Related driver interfaces IOCTL_USBIO_RESET_PIPE page 176 IOCTL_USBIO_ABORT_PIPE page 177 IOCTL_USBIO_GET_PIPE_PARAMETERS page 178 IOCTL_USBIO_SET_PIPE_PARAMETERS ...

Страница 228: ... an Interrupt or Bulk pipe and to dump it to the output window For large amounts of data the transfer may be slowed down because of the overhead involved with printing to the output window The printing of the data can be enabled disabled by the switch Print to Output Window Related driver interfaces ReadFile IOCTL_USBIO_ABORT_PIPE page 177 E 7 1 14 Read from Pipe to File This dialog page allows to...

Страница 229: ...device driver Because the USBIO driver is installed in the same way as any other Plug Play device driver the installation requires administrator rights Once the USBIO driver is installed standard user rights are sufficient to load the driver and to use the driver by accessing its programming interface E 8 1 Automated Installation The USBIO Installation Wizard Using the USBIO Installation Wizard is...

Страница 230: ...sible in the system and USBIO Installation Wizard is not able to install the driver for it For some kinds of devices the system does not launch the New Hardware Wizard A system provided device driver will be installed silently This will happen if the device belongs to a predefined device class Human Interface Devices HID Audio Devices or Printer Devices for example The USBIO Installation Wizard is...

Страница 231: ... information about the driver is also shown Verify that you selected the correct device If not use the Back button to return to the device list and select another device To install the USBIO driver for the selected device click the Next button WARNING If you install the USBIO driver for a device that is currently controlled by another device driver the existing driver will be disabled This will ha...

Страница 232: ...tallation process An INF file is in ASCII text format It can be viewed and modified with any text editor Notepad for example The contents and the syntax of an INF file are documented in the Microsoft Windows 2000 DDK The INF file is loaded and interpreted by a software component that is built into the operating system called Device Installer The Device Installer is closely related to the Plug Play...

Страница 233: ...s are required Copy the USBIO driver binary usbio sys to a floppy disk or to a directory location of your choice Copy the INF file usbio inf provided with the USBIO package to the same location Note that you can choose any name for the INF file based on your company name or your product name for example But the file name extension has to be inf In the following discussion it is assumed the INF fil...

Страница 234: ...and a digital signature from the Windows Hardware Quality Labs WHQL If the device belongs to a predefined device class that is supported by the operating system the system does not launch the New Hardware Wizard after the device is plugged in Instead of that a system provided device driver will be installed silently Human Interface Devices HID like mice and keyboards Audio Devices or Printer Devic...

Страница 235: ...ns on top of the USB HID driver The USBIO driver can replace the USB HID driver only In the Device Manager the HID driver is shown in a section labeled Human Interface Devices To be sure to replace the correct driver refer to the Driver File Details dialog in the Properties page of the entry If the driver stack contains the file HIDUSB SYS then you have selected the correct entry in the Device Man...

Страница 236: ...ating system it is necessary to manually remove the INF file that was used to install the USBIO driver During driver installation Windows stores a copy of the INF file in its internal INF file data base that is located in WINDIR INF The original INF file is renamed and stored as oemX inf for example where X is a decimal number The exact INF naming scheme depends on the operating system Windows 200...

Страница 237: ...private location in the registry to be used to store startup parameters In order to do that the usbio inf file has to be customized as well The following list shows the steps required to build a customized USBIO setup Choose a new name for the driver binary file usbio sys The name should not cause conflicts with drivers provided by Windows Rename the file usbio sys to your new name Rename the Setu...

Страница 238: ... registry value USBIO_UserInterfaceGuid Activate this line by removing the at the beginning Use the private GUID in your application to search for available devices GUIDGEN EXE allows you to export a static const struct GUID statement that can be included in the source code of an application For an example refer to the source code of USBIOAPP or ReaderCpp Edit the driver parameter settings in the ...

Страница 239: ...egistry parameters Table E 3 Registry Parameters Supported by the USBIO Driver Value Min Default Max Description RequestTimeout 0 1000 Time out interval for synchronous I O requests in milliseconds Zero means infinite no time out ShortTransferOk 0 1 1 If set to 1 short packets in read transfers are allowed If set to 0 short packets in read transfers cause errors UnconfigureOnClose 0 1 1 If set to ...

Страница 240: ... no suspend allowed if the device is not in use The value 3 D3 means full suspend off allowed if the device is not in use AbortPipesOnPowerDown 0 0 1 Handling of outstanding read or write requests when the device goes into a suspend state leaves D0 1 abort pending requests 0 do not abort pending requests SuppressPnPRemoveDlg 0 1 1 If this flag is set Windows 2000 does not show a warning dialog if ...

Страница 241: ...n contact MCT Elektronikladen to receive a unique product ID Possible error codes when this restriction is offended USBIO_ERR_VID_RESTRICTION 2 Only one Interrupt IN endpoint and one Interrupt OUT endpoint is supported If your device has more endpoints or other endpoint types configuring the device SET_CONFIGURATION will fail Possible error codes when this restriction is offended USBIO_ERR_PIPE_RE...

Страница 242: ...Designer Reference Manual USB08 Evaluation Board 242 Universal USB Device Driver USBIO MOTOROLA Universal USB Device Driver USBIO ...

Страница 243: ...blank ...

Страница 244: ...1 2447 TECHNICAL INFORMATION CENTER 1 800 521 6274 JAPAN Motorola Japan Ltd SPS Technical Information Center 3 20 1 Minami Azabu Minato ku Tokyo 106 8573 Japan 81 3 3440 3569 ASIA PACIFIC Motorola Semiconductors H K Ltd Silicon Harbour Centre 2 Dai King Street Tai Po Industrial Estate Tai Po N T Hong Kong 852 26668334 HOME PAGE http www motorola com semiconductors Q4 00 REV 1 ...

Отзывы: