Home

Cypress Cay CY3640 Computer Drive User Manual

image

Contents

1.
2. god 41 Nid 9 El 20d s O y E O E GI Nid a E 10d a E Os EI Nid 8 amp 00d B O ui 5 E TH Nid T y E east f O O 6 Nid 3 E Te s Y 1037 4 Nid 3 Ins i O O 9 Nid 2 Mi 4 I 8 DDA Nid x39 OIX 904 o Edl Oz or ux aux F 1 Nid E In O MNHOVGIH IX Nod 4671 80 gsvg qd ONIMVEC avd NOILdRIOSA ARI MOOT NOISIASH AMV LAl dOud SSWHdAO Page 17 Cypress CY3640 USB Starter Kit User s Guide H Cypress USB Controller micro code Assembly USB ASM USB_20 ASM A a O ON N a a ON AA ck ck ck ck kk kk Sk Sk Sk ke Sk Sk kk SS Sk Sk Sk Sk Sk Sk Sk Sk Sk Sk Sk Sk Sk Sk Sk kk kk Sk kk kk Sk Sk Sk Sk kk Sk Sk Sk kk Sk ke ke ke ke ke ke ke ke Sk kx kx Sk Sk Sk Sk Sk Sk S amp x S amp A amp M amp Target Cypress 7C63000 8bit RISC microcontroller with 1 5Mbps USB serial interface Dallas 1623 High Resolution Temperature Measurement Sensor Overview There are four main sub systems USB Thermometer LED and Button The system is started in the main routine at reset This routine initializes the USB variables the IO ports the Thermometer logic and the data space All USB communication occurs on an interrupt basis First Main loops waiting for a USB reset After receiving a USB reset Main enables the Endpoint 0 interrup
3. push a pe E D ERO Le E M E Tri state data pin for input mov a gbThermPortMirror or a ThermData iowr ThermPort ThermClock 0 mov a gbThermPortMirror and a ThermClock mov gbThermPortMirror a iowr ThermPort Read in data pin and check for 0 or 1 iord ThermPort and a ThermData jnz ThermPortReadValuel ThermPortReadValueO0 jmp ThermPortReadClock ThermPortReadValuel Use bitmask push x pop a or gbThermPortValue a jmp ThermPortReadClock redundant but good practice ThermPortReadClock ThermClock 1 mov a gbThermPortMirror or a ThermClock mov gbThermPortMirror a iowr ThermPort Next bit in mask push x pop a asl a push a pop x Ge ae tae ED Si OO Finished pop a dec a jnz ThermPortValueReadLoop ret Cypress Semiconductor Ver 0 993 Page 45 SPAG Cypress CY3640 USB Starter Kit E User s Guide EE ARAE RAAB RK RA RK eO Jo SK OR Oeo AK eo AM RAK AANA KAA OR ROS AK BAKKE EOS AK ORIG UOS BAKA OE ISO EOS COE KAAS BER Therm func parm ThermPo 8 mov pus pop mov Therm pus okk 7 G pus pop and jnz Therm Hana mov and mov iow jmp Therm Pp E mov or mov iow 7 jmp Therm pL mov and mov iow PN pus pop asl pus pop i XE mov or iow PortWrite8Bits BYTE gbThermPortValue rtWrite8Bits etup bitmask a l ha x a 8 PortWriteLoop ha et bitmask h ox a a gbThe
4. Get Device Descriptor Event DAT Re Oe OOO SS is raia Descriptor pointer mov a USBDeviceDescription USBSendROMBufferBase mov gbUSBSendBuffer a Descriptor size mov a l2h USBDeviceDescription mov gbUSBSendBytes a Check request size field call USBSendDescriptorCheckLength Send buffer call USBSendROMBuffer Cypress Semiconductor Ver 0 993 Page 26 Cypress CY3640 USB Starter Kit User s Guide jmp USBEventEPOEnd USBEventEP0SetupGetDescriptorConfig Configuration Descriptor cmp a USBDescriptorTypeConfig jnz USBEventEPOSetupGetDescriptorString H Remember this inc gbUSBValidRgsts A E UR NAAR IARI I AR AAD AI SR A Get Configuration Descriptor Event Go RIOR ATTA E DC NR Ask ANS Meh DO Descriptor pointer No mov a USBConfigurationDescription USBSendROMBufferBase mov gbUSBSendBuffer a Descriptor size mov a 09h USBConfigurationDescription add a 09h USBInterfaceDescription add a 07h USBEndPointDescriptionInt mov gbUSBSendBytes a Check request size field call USBSendDescriptorCheckLength Send buffer call USBSendROMBuffer jmp USBEventEPOEnd USBEventEP0SetupGetDescriptorString Get String Descriptor cmp a USBDescriptorTypeString jnz USBEventEPOSetupGetDescriptorEnd FEAL IIR I ALAR o ne TERK RANA ARK KARR RA Get String Descriptor Event EASA AR ER Mots Rok Aan OA Yh Aa Aah AGA AR SAGA Aun Kore Get string descriptor inde
5. KA BAKA UE OO COE KAA KKK AK He ThermPortResetHigh Initialize mirror iord ThermPort mov gbThermPortMirror a ThermReset 1 or a ThermReset mov gbThermPortMirror a iowr ThermPort ret oi ER RN e a o ASK ORA ORM chroch ThermPortResetLow func PR REAL ABA AAA RAKE RERE AR AE ALR EAA AERA RARE REAR REAR AERA E RARE REA E ARAGAO ThermPortResetLow ThermReset 0 mov a gbThermPortMirror and a ThermReset iowr ThermPort ret DO ro AA re Reena ThermWaitForDone func Wait for indication of temperature conversion complete RUE PE E ARERR EAA REAR AK RADAR COR RARE ABA RA AK TERA COE OR OS OCOEOR TERRA RRE AIRE RA KAA UK OK COEUR ThermWaitForDone Read config mov a ThermConfigRead call ThermPortRead Test flag mov a gbThermPortValue and a ThermControlDone jz ThermWaitForDone ret ERRA ENER ia a A AA A AA A AU AA AU ae ThermPortWrite func Write protocol byte and value byte parm byte A Protocol to send Cypress Semiconductor Ver 0 993 Page 42 Cypress CY3640 USB Starter Kit User s Guide A E a A AA ee AA ThermPortWrite Save input mov Call Call Call Call ret gbThermProtocol a ThermPortResetHigh ThermPortProtocolWrite ThermPortWrite8Bits ThermPortResetLow O A AN O dt ONO ThermPortRead func Write protocol byte and read value byte into gbThermPortValue parm byte A Protocol to send RE RETO O o ON The
6. ret SPAGE RO Rc dL E M E ME cont an ANA AA _USBSendROMBuf fer func Buffer and inialize USB send of up to 8 bytes of ROM data on end point 0 comm affects gbUSBSendBytes amp gbUSBSendBuffer o SE ARABIA TAA AAA OA CREA A Aen XE KK OKSK KON Aen AA _USBSendROMBuffer Save x Cypress Semiconductor Ver 0 993 Page 30 Cypress CY3640 USB Starter Kit User s Guide push x Initialize mov x 0h _USendROMBufferLoop Any more mov a 0h cmp a gbUSBSendBytes jz _USendROMBufferLoopDone No more dec gbUSBSendBytes Move bytes to FIFO mov a gbUSBSendBuffer index USBSendROMBufferBase mov x USBEndPOFIFO a INE X Next byte inc gbUSBSendBuffer jmp USendROMBufferLoop _USendROMBufferLoopDone Re enable reception mov a 0h iowr USBEndPORxStatus Toggle sequence mov a USBEndP0TxSequence xor gbUSBSendSequence a Send bytes push x pop a or a gbUSBSendSequence or a USBEndPOTxRespond iowr USBEndPOTxConfig The FIFO is loaded go and wait untill it s read call USBSendWaitForComplete _USendROMBuf ferEnd Restore and exit pop x ret SPAGE EEA AR RSA RUAS RESTOS RNA ACRA AAA RA OR RU OR AGR QR PARADA ARAL RRA QUOKA QU AS USBSendACK func Respond to a USB Status In with a zero byte buffer with 5 Sequence field set on end point 0 Called by SetAddress and SetConfig commands PR E PE deo olo AR co eK RA oe e o KO eo RAE o o KA po BASRA spl
7. 0 993 Page 25 Cypress CY3640 USB Starter Kit User s Guide USBEventEPOSetupSetConfig func End point zero event SETUP to Set Configuration devnote Runs in interrupt enabled context b set enumerated gbSysEnumerated state enable GPIO and EP1 if appropriate Enable P0 and P1 Reset enumerated gbSysEnumerated state Turn off LED Reset variables Disable GPIO and EP1 Disable dallas chip and PO and P1 PE PE E E E o a AER col aeos USBEventEPOSetupSetConfig Enumerated mov a 0lh mov gbSysEnumerated a Initialize thermometer call ThermInitialize Enable button interrupt on port 1 Actually this has already been done in main mov a 04h iowr SysPortlIntEnable enable all appropriate irq s mov a SysIntTimerl1024us SysIntGPIO SysIntUSBEndPO mov gbSysInterruptMask a Send ACK call USBSendACK jmp USBEventEPOEnd SPAGE NR EN Reg M Aan Cea d Aan tien Ann Aas Aan AGA d r r r USBEventEPOSetupGetDescriptor func End point zero event SETUP to Get Descriptor devnote Runs in interrupt enabled context p E ER D Rc E MK E C E C LK IE cp E EE x USBEventEPOSetupGetDescriptor Get descriptor type mov a USBRgstWordValueHi USBEventEP0SetupGetDescriptorDevice Device Descriptor cmp a USBDescriptorTypeDevice jnz USBEventEPOSetupGetDescriptorConfig No Remember this inc gbUSBValidRgsts IR RA AOR Be p c AER AA Wels AK Cee AA ak Ack eat AoA Aan AO
8. 993 Page 23 Cypress CY3640 USB Starter Kit User s Guide Stall any subsequent IN s or OUT s until the H stall bit bit 5 is cleard by an I O write to H the USB End Point 0 TX Configuration Register 0x10 n or any SETUP is received iord USBEndPOTxConfig or a USBEndPOTxStall iowr USBEndPOTxConfig OK We ve set the stall condition for Endpoint 0 Now let s complete the routine jmp USBEventEPOEnd oe cado M M LL A C d E We know we have received a Setup token Now we need to parse it to A determine what command it is ER RATE A i A o A SPAGE ER ERENTO A UC RAGAN ARN ARENA OR KEEN USBEventEPO SETUP func End point event SETUP packet handler devnote Runs in interrupt enabled context se SR IR dh a pngna KR aca doa aec e aed ogons denne kg USBEventEPO SETUP Well we have a SETUP packet Let s find out what to do mov A gbSysInterruptMask iowr SysInterrupt If we are here and are and we are processing a previous Setup we need to abort the processing of the previous Setup mov a 0 Clear any indication that we have bytes left to transfer mov gbUSBSendBytes a Clear EPO RxReg including the Setup flag The Data toggle bit remains unchanged however mov a 0 iowr USBEndPORxStatus HE E RE game ME M d M E M E MO UE E Setup Event EEA AR SE ERA RE RIERA TERRA ERK AAAS ROC OG CR IAN Check the request type and branch to the correct location to handle it mov a USBEndPOFIFO
9. Kit User s Guide a 42h USBEndPOFIFO_0 a Auto ACK OUT packet mov iowr a USBControlAckStatusData USBControl Send bytes as Datal mov or or iowr call a 8 a USBEndPOTxSequence a USBEndPOTxRespond USBEndPOTxConfig USBSendWaitForComplete Restore it pop x Return jmp USBEventEPOEnd PIRCESNUEUROK A O UO RRR AK Noe SPAGE include ds1620a asm RUS A A AA RERE A ado Ad ACACACA SysDelayMS func Delay some number of milliseconds parm register A Number of milliseconds 0 65536 comm Protects A and X registers EEE de Aon APA AA SysDelayMS Save em push push a x SysDelayMSLoop Save count push a Delay 1ms 10 100us mov a 10 SysDelayMSLoopDelay Save it push a Delay 100us mov call a 100 SysDelay Done pop dec jnz a a SysDelayMSLoopDelay Done pop dec jnz a a SysDelayMSLoop Restore em pop pop ret x a SERE KU OO A DAE RAK RADAR ARAL ARAL ALAR AA AA AAA A RIOR AA SysDelay func Delay some number of microseconds Cypress Semiconductor Ver 0 993 Page 34 parm register A comm Protects A and X registers PE En A RAAB apto SysDelay Save em push a push x SysDelayLoop Save count push a Delay 1ms nop 4 clock nop nop nop nop nop nop nop nop nop Done pop a dec a jnz SysDelayLoop Restore em pop po
10. USBSendROMBuffer USBEventEPOEnd ntEPOSetupGetDescriptorStringb5 cmp jnz aya USBEventEP ROA Get String 5 O Descriptor po mov mov gbUSBSend Descriptor si mov a 3Ch mov gbUSBSend OSetupGetDescriptorEnd No RAKKKKKKKKKKKKKKKKKKKKKKKKKKKKK Descriptor Event RAKKKKKKKKKKKKKKKKKKKKKKKKKKKKK inter a USBStringDescription5 USBSendROMBufferBase Buffer a ze USBStringDescription5 Bytes a Check request size field call USBSendDescriptorCheckLength Send buffer call USBSendROMBuffer jmp USBEventEPOEnd USBEventEP0SetupGetDescriptorEnd Unsupported Get request jmp USBEventEPOStall M DA M CS ch d EM d d dL dL A eh Ae AG MU Aen ACH Ae USBSendDescriptorCheckLength func Check and update send length for Get Descriptor requests on end point O0 parm BYTE gbUSBSendBytes Number of bytes to send RT ET CD o RD CEE Kea t USBSendDescriptorCheckLength High byte set Assume lt 255 bytes mov a USBEndPOFIFO_7 cmp a 0 jnz USBSendDescriptorCheckLengthEnd Yes Check size mov a USBEndPOFIFO_6 cmp a gbUSBSendBytes jz USBSendDescriptorCheckLengthEnd equal jnc USBSendDescriptorCheckLengthEnd greater than New size mov gbUSBSendBytes a USBSendDescriptorCheckLengthEnd ret PAGE ERBETEN OR AA BARA AAA KAKA ARTE AKASAKA A aUe OI Ao EK oe ol Role colo ape Cypress Semiconductor USBSendROMBuffe
11. USBStringDescription5 db 3Ch Length db 03h Type 3 string dsu EndPoint1 10ms Interrupt Pipe USBSendROMBufferTail CopyrightStrings ds USB Thermometer Project Version 1 01 ds Copyright Slade Systems Inc July 1997 ds Copyright Marc Reinig July 1997 ds Copyright Cypress Semiconductors Inc July 1997 Cypress Semiconductor Ver 0 993 Page 36 Cypress CY3640 USB Starter Kit User s Guide CY6300X INC io AT A TER AraC ara ji C7C63x0x h Cypress Semiconductor Cy7C63x0x micrprocessor definitions Copyright c Slade Systems Inc 1997 Cypress Semiconductor Corp 12032 113th Ave NE Kirkland WA 98034 206 821 9202 206 820 8959 f oU US Q6 QU QU US QUU QU QU a a domo seno dua ac doe oc as deno dh dove doa pe gy a dono aab donde a pP NUR AINA INR SECURE IS IRR RR ORE I E SRI A TERR BOD RSI KIRA BIRR TERK ISLE ARE ER ER RE M8 8bit microprocessor registers accumulator Trace E index x A stack pointer dsp E program SP Bsp A program counter pc 16 bits 14 bit addressing H PC low per n PC high pch When PC is pushed on stack carry flag is stored in bit 14 zero flag is stored in bit 15 Program ROM 4096 bytes in 256 byte pages Program RAM 128 bytes Processor PORTs contain 16k ohm resistor pull up and slew control After reset Port 0 and Port 1 are set high dob S dens dong ai O NN EEA EE RS RK Ue ok DEOR OS DOR AK KK AR Rol olo RABBI
12. a trace on the bottom layer of the PC board If you desire to use ferrite beads you should cut the traces and install beads suitable to your needs Other items of interest Bulk capacitor bleeder resistor R5 A resistor is provided to bleed off the charge stored on the bulk capacitor This is provided to insure that charge is removed from the bulk capacitor and hence the board logic within a short period after the device is unplugged from the USB USB connector A B receptacle has been provided on the board so a detachable A B cable can be used with the device A footprint for an in line connector P2 to a permanently attached USB cable has been provided if you need to have a non removable USB cable Cypress Semiconductor Ver 0 993 Page 12 Cypress CY3640 USB Starter Kit User s Guide F Changing the functionality of the Cypress CY3640 USB Starter Kit The CY3640 USB Starter Kit is designed to allow you to add or change its functionality in a variety of ways in order to meet your needs You may easily e Add logic to the board itself e Change the functionality of the on board LEDs and the switch e Change the program stored inside the Cypress USB Controller e Use an external power source e Take signals off of or bring signals onto the board Changing the program in your device You can write your own code for your Cypress USB Controller The easiest way is to use the code provided as a base and change only those parts wh
13. count 8 ockckck ck ck ck ck kk ck ck kk kx Ax Assigned device address Status Control register l active write 0 and watch if bus dies set transmitter to k state sending resume to Auto ACK Datal SETUP OUT data packets Auto ACK Datal OUT data packets Port0 receive status l setup token received must be cleared to 1 out token received l in token received size count 2 two bytes of CRC Transmit configuration read and write Ver 0 993 Page 38 US US US US US US US US UJ UU UJ UU UJ UU UU Ww ei D pd E Ed Dd Dd Dd 424 3 ck ck ck kk r USB 550550595 USBEndPOTxRespond ndPlTxConfig U xCount O xCount 1 PxCount 2 TxCount3 TxEnable TxStall TxSequence PxRespond U U FU y ig iodo 920000000 Cypress CY3640 USB Starter Kit User s Guide 80 E 3 11 01 02 04 08 10 20 40 80 E S G E Ge EE E OODDDDDODSOSSZS CALAR aa Protocol union USBRqst s truct BYTE bReceipient X5 0 Device 1 Interface 2 Endpoint 3 Other 4 31 Reserved 1 Standard 1 Class 2 Vendor 3 Reserved O Host to Device 1 Device to Host BYTE bType BYTE bDirection BYTE bRast WORD wValue WORD wIndex WORD wLength 255 ELE 0x00 0x01 0x02 Clear Feature 0x00 0x01 0x02 Set Feature 0x80 0x81 0x82 Get Status 0x00 0x80 0x00 0x80 0x81 0x01 0x82 S
14. 0 USBEndPOFIFO 1 USBEndPOFIFO 2 USBEndPOFIFO 3 USBEndPOFIFO 4 USBEndPOFIFO 5 USBEndPOFIFO 6 USBEndPOFIFO 7 USBEndP1FIFO USBEndP1FIFO_O USBEndP1FIFO_1 USBEndP1FIFO_2 USBEndP1FIFO_3 USBEndP1FIFO_4 USBEndP1FIFO_5 USBEndP1FIFO_6 USBEndP1FIFO_7 IE BAEABADBREAA ALAR RE RR ABABA USBDeviceAddress USB port control USBControl USBControlBusActive USBControlResume host USBControlReserve2 USBControlAckStatusData USBControlAckOutData USBControlReserve5 USBControlReserve6 USBControlReserve7 USBEndPORxStatus USBEndPORxSetup write FIFOs USBEndPORxOut USBEndPORxIn USBEndPORxDataFlag USBEndPORxCount0 USBEndPORxCount 1 USBEndPORxCount2 USBEndPORxCount3 USBEndPOTxConfig USBEndPOTxCount0 USBEndPOTxCount 1 USBEndPOTxCount2 USBEndPOTxCount3 USBEndPOTxRxErr USBEndPOTxStall USBEndPOTxSequence Cypress Semiconductor eq Cypress CY3640 USB Starter Kit or or cr Ei cr cr G Ca gu Go Ex Ei caogcacgcaaegsa Ga ri ai RS gi a Ga Fa 30 31 32 33 34 35 36 37 38 39 3A 3B 70 70 71 72 73 74 75 76 qu 78 78 79 7A 7B JC 7D 7E TF KKKK u coca aces fer E m oE E Oya G E ser Ca Cic A G Ri 12 13 01 02 04 08 10 20 40 80 14 01h 02 04 08 10 20 40 80 10 01 02 04 08 10 20 40 0000000000 90009009000 000009009000 0006060 je 00000 0009000900 r User s Guide Will contain CRC if rx
15. 10 1 8 W carbon film resistor 150 Ohm 10 1 8 W carbon film resistor 10K Ohm 10 1 8 W carbon film resistor 50K Ohm 10 1 8 W carbon film resistor 0 1 uF 5 Low ESL 50 Vdc capacitor 4 7 uF 10 Tantalum 25 Vdc capacitor 0 1 uF 5 Low ESL 50 Vdc capacitor 0 1 uF 5 Low ESL 50 Vdc capacitor External Vcc Bulk capacitor Not populated External Vcc HF capacitor Not populated 40 pin boxed header straight 0 1 x 0 1 center USB B connector Ferrite bead Not populated Ferrite bead Not populated The USB Starter Kit demo board layout and schematic are shown on the next two pages Cypress Semiconductor Ver 0 993 Page 15 T 40 I LXSHS OLOSWHOO YA TIVOS OL LON V SIOO0 YA Aga LES DMG LDI YALAVLS ESA OV9EAD Peres VO SOf NVS 1S ISU N 1068 AHINHO NOISHC dod YOLONUNODINES SSGHdAO ALVA SIVAOHddV 2661 ISNODNVILXO NATHOSNTIS dOLV AWH STI00 Tv4 20 39A LIXA 20 Q A OOA LXE 3 20A 20A LXI 20A SSBRBRRBNENNSET BRONTE awe Ip SNILOG ASH W3dvsH did E aza u EEUZ lt s I ESBERFESBRRENSEHE SE a gt d el 99 Se Ir
16. Cypress CY 3640 USB Starter Kit User s Guide Cypress CY3640 USB Starter Kit User s Guide Contents of the CY3640 USB Starter Kit 4 ICD Ec 20 O 5 1 Insert the Cypress USB CD ROM uuuusssssnnnnnnnnnnnnnnsnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn san 5 2 Run SETUP EXE from the CD ROM conc nnnn tnter einn nnns 5 3 Plug the A end flat connector of the USB cable into the USB port of your PC 5 4 Plug the B end square connector of the USB cable into the B receptacle of the CY3640 USB Starter Kit MM 5 5 Insert the Cypress USB CD ROM if prompted to do SO 5 6 Run the Cypress USB Thermometer application 5 Uninstalling the Cypress USB Thermometer application sess 6 The Cypress USB Thermometer Application Options sos soon 7 Changing the display style from conventional thermometer display to a history of temperature ado OO 7 Changing the maximum and minimum temperature value displayed 8 Changing the user s name oooccccoccccconococnncnnnoconananonnncnnnnnnnnnnn nn nennen enhn ninh ninani nn waazimia 8 Changing the display mode from Centigrade to Fahrenheit 8 Changing the time between temperature sample periodS cccccccccnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnos 8 Simulating temperature measu
17. Cypress USB Thermometer entry The computer will display a graph showing the temperature reading over time Use the options described in the following sections to control various aspects of the USB thermometer NOTE if you cannot get the thermometer to work you may not be using the correct operating system See section Kfor more details Cypress Semiconductor Ver 0 993 Page 5 Cypress CY3640 USB Starter Kit User s Guide C Uninstalling the Cypress USB Thermometer application If you want to remove the Cypress USB Thermometer application from your system it may be uninstalled by selecting Cypress USB Thermometer in the Add Remove Programs section of the Control Panel Cypress Semiconductor Ver 0 993 Page 6 Cypress CY3640 USB Starter Kit User s Guide D The Cypress USB Thermometer Application Options Changing the display style from conventional thermometer display to a history of temperature The Thermometer application will display either the current temperature using a conventional thermometer symbol or a history of the temperature recorded during the last 64 sample periods See Figure C1 a 25 C Simulated x CYPRESS Marco s Temperature i 23 C Simul ES u SESJ CYPRESS IM arco s Temperature Conventional Temperature History Thermometer Display Display Figure C1 To change the display style click on the Options box in either the conventional thermometer display or th
18. DR lt a EJT c c Z mw NI Q BH Zar O SEBA ix S3 ES 184 zd CO Tar ne wo n 9265 284 vu Rms Bf eu E ta SB D TH e za a 0 SO a Kr os Zdl Idi 1SQ 50 e UND zr dA HiMOd er gt 26 12 80 qas naa NIAVOSNTIS dOl yx ALYA NOLLdTHOSS AJA SMOOTH NOISIATA AUVLATAdOUd SSTHdAO Page 16 T 40 T IHS ATOS OL LON ya SHOO VA Aga odds DMA LIM HHALAVLS ESA OVIEAD vEIS6 VO SO NYS 1S ISUld N 1066 WUINWO NOISHA dod MOLONGNOOINAS SSHHdAO ALVA STVAOUdAV OLLVINHHOS SNId WM and and 9 lad aSvO GSC IHIHS annowo O us wm l O O I E LA v E E e E y fi O O S 284 SS 2d 2r O O T I Ta O O ES a ALX MA 55A AWW 6 Nid ig O amp TD 204 1Xa 46 Nid SE Nid 2 E Nid au TE Nid 6 Nid 22 Nid Se Nid 2 Nid O a TZ Nld 12 Y 61 Nid JX 20 a Eld gld Tid O 2 Old SRI 2 8 8 8 5 8 O4 2 a 8 gt x C 281518181818 3188 9 l OF OF 2
19. IOButtonDebouncing Enable interrupts and return mov a gbSysInterruptMask ipret SysInterrupt peg OC E OT OO LOR D CI x Y uc c EE This section of code responds to activity on End Point 0 and determines what needs to be done LIC NUR EIER RNR RK A Kok Ce KON KM RU CAE RA RR eb SRR IGM AIR RR RER SAGA AOR RER ER AR AACE ROR AMOR TE SPAGE A A O MOR ECO ORL RER Mem Aoi Ach amh Ach RR OK TR REN CUIR WA EN USBEndPointOEvent Gfunc End Point zero USB event comm Default end point AS UK Ri AD ORE UR OLOR UC AAR RGA Uo oe UU A USBEndPointOEvent This code checks to see what type of packet was received Setup Out or In and jumps to the correct routine to decode the n Specifics After the code to which the jump points is through it jumps back to USBEventEPOEnd Save accumulator push a Is this a SETUP packet iord USBEndPORxStatus and a USBEndPORxSetup Check the setup bit jnz USBEventEPO SETUP Yes it s a setup branch Not a setup is it an OUT packet iord USBEndPORxStatus and a USBEndPORxOut jnz USBEventEPO OUT Not an OUT packet is it an IN packet iord USBEndPORxStatus jand a USBEndPORxIn jnz USBEventEPO IN USBEventEPO IN USBEventEPO OUT USBEventEPOEnd OK We re done with the packet Let s enable interrupts and return mov a gbSysInterruptMask ipret SysInterrupt done with EPO irq service routine USBEventEPOStall Cypress Semiconductor Ver 0
20. Individual labeled locations for Vss USB Vbus the positive supply of the USB and External Vcc are provided on either side of the sea of holes LED indicators Power and Enumeration The CY3640 includes two LEDs a red and a green one As configured when the CY3640 is shipped from the factory the LEDs are used to indicate that power is applied and that the USB host has enumerated the Cypress USB Thermometer device respectively The anode of each LED is connected to the USB Vbus positive supply through a current limiting resistor The cathode of each device is connected to three places to allow you to reconfigure them for your own purposes a jumper a pin on the 40 pin connector and a hole for installing a wire wrap pin The Power LED The Power LED as shipped from Cypress is used to indicate that power Vbus from the USB has been applied It is connected through a jumper JP1 and a current limiting resistor R4 directly between Vbus and Vss and will be lit whenever power is applied through the USB The user may remove JP1 if desired Cypress Semiconductor Ver 0 993 Page 10 Cypress CY3640 USB Starter Kit User s Guide The cathode of this LED is also connected to a pin on the 40 pin connector pin 8 and to an adjacent hole that may be used to install a wire wrap pin This allows the user to remove the factory installed jumper to Vss and use the LED for their own purposes Note Although it may be convenient to know when the
21. R RR UR ACER ROG UR AGO GEO UNO KA OR OR RARAS GO AA COUR EORR eto USBEventEPOSetupIsSetAddress Set device address mov a USBRqstMessage cmp a USBRqstSetAddress jz USBEventEP0SetupSetAddress Yes USBEventEPOSetupIsSetConfig Set device configuration mov a USBEndPOFIFO_1 cmp a USBRgstSetConfiguration jz USBEventEPOSetupSetConfig Yes Unsupported set request jmp USBEventEPOStall No Stall USBEventEPOSetupIsGetDescriptor mov a USBRqstMessage cmp a USBRqstGetDescriptor jz USBEventEP0SetupGetDescriptor Yes Unsupported get request jmp USBEventEPOStall No FSAI ALDARA AERA AAA AK ARABS AA RA BARR KK BK KAA RK BKK AKA RAI USBEventEP0SetupSetAddress func End point zero event SETUP to set address devnote Runs in interrupt enabled context comm The status token of the SetAddress is an IN So we send status manually PECIA Sa To A a is a a EDS POR OU E ODE S KO D DEN CROCO USBEventEPOSetupSetAddress Send ACK call USBSendACK Now that we have been acknowleged we actually set the address This is different from all other commands which execute first and then acknowlege Remember this inc gbUSBValidRqsts Set Address mov a USBRqstWordValueLo iowr USBDeviceAddress Done jmp USBEventEPOEnd DAA RR Aon RARE RAAB UOS CA AN RAAB AGH ARGUS OQ RUD ORO COO UR AS AA BGK KOK AGA AAS AGH Sp Cypress Semiconductor Ver
22. Sk S S S S S S S S S RARA User s Guide EndPOFIFO 3 KKKKKKKKKKKKKKK USBDescriptorTypeDevice equ 01h USBDescriptorTypeConfig equ 02h USBDescriptorTypeString equ 03h USBDescriptorTypelnterface equ 04h USBDescriptorTypeEndPoint equ 05h USBDescriptorTypeReserved06 equ 06h kk ck ck ck kk kk ke Se ke Se e S Se S Se Se e ke Se e ke ke ke e ke ke ke ke ke Sk Sk Sk Sk S ke Sk S S S KK KK KK USBRawProtocolSetup equ B4h USBRawProtocolIn equ 96h USBRawProtocolOut equ 87h USBRawProtocolPort0 equ C3h USBRawProtocolPortl equ D2h USBRawProtocolACK equ 4Bh USBRawProtocolNAK equ 5Ah Ver 0 993 Page 40 Cypress Semiconductor Cypress CY3640 USB Starter Kit User s Guide DALLAS ASM DS1620a asm DS1620 High Reolution Temperature Measurement Sensor include ds1620a inc E ThermPort eg u 00h SysPortO0 ThermMaskBits equ 07h ThermData equ 01h ThermClock equ 02h ThermReset equ 04h H gbThermProtocol egu 30h gbThermPortValue equ 31h H gbThermPortMirror equ 32h gbThermTempRead egu 33h gbThermTempRead2 equ 34h gbThermTempLast equ 78h USBEndP1FIFO gbThermTempLast2 equ 79h USBEndP1FIFO 1 SPAGE TAi a Rd EE a i a a a a SO A AGN Ate ThermInitialize func Initialize the thermometer to continuous mode ER ee o a e E KK UA a a Re RL RA ESR ThermInitialize Standalone mode mov a ThermConfigRead call ThermPortRead Check mode mov a gb
23. ThermPortValue and a ThermControlOneShot ThermControlCPUUse cmp a ThermControlCPUUse JZ ThermInitDone Set mode mov a gbThermPortValue and a ThermControlOneShot ThermControlCPUUse or a ThermControlCPUUse 08h set reserved bit mov gbThermPortValue a Write it out mov a ThermConfigWrite call ThermPortWrite Wait 10 milliseconds mov a 10 call SysDelayMS ThermInitDone Start conversion mov a ThermConvertStart mov gbThermProtocol a call ThermPortResetHigh call ThermPortProtocolWrite call ThermPortResetLow ret SPAGE ER AREER ARR ROC LOR RRA TARR ICE KAR BAA ASAS SS NAAA ThermReadTemperature func Read the current temperature RATE A A e A A A A a A e Arak ard ThermReadTemperature Cypress Semiconductor Ver 0 993 Page 41 Cypress CY3640 USB Starter Kit User s Guide Initialize results mov a 0 mov gbThermTempRead a mov gbThermTempRead2 a Read Temperature request mov a ThermTempRead mov gbThermProtocol a Get temperature call ThermPortResetHigh call ThermPortProtocolWrite call ThermPortReadTemperature call ThermPortResetLow Save results mov a gbThermTempRead mov gbThermTempLast a mov a gbThermTempRead2 mov gbThermTempLast2 a ret SPAGE A A CERE TAE KUNDE O RR UM NL ch ch Ac ACA ACC A RR NEAR a TAREA SE o ERA ThermPortResetHigh func EEA AREA TREE AE uo EOS BA EOS AR AA BASE AK AAR RAAB RER GROS UE CO ER EKA AKA
24. U Cypress Semiconductor Ver 0 993 Page 35 Cypress CY3640 USB Starter Kit User s Guide USBInterfaceDescription db 09h Length db 04h Type 4 interface db 00h Number of interfaces 0 based db 00h Alternate settings db 01h Number of endpoints 1 based 9 6 3 db 00h Class code 0 non specified 1 kb 2 mouse 3 joystick db 00h Subclass code 0 db 00h Protocol code 0 non specified db 05h Interface string index 0 non specified 1 2 3 E USBInterfaceDescriptionEnd p UOS Ro RA OO OR AR AM oe ol KARR Kol eo BABA PARA ARSS KEN PO RAS RASS Never used for EPO USBEndPointDescriptionInt db 07h Length db 05h Type 5 endpoint db 81h Address EP 1 0x80 IN 0 0UT db 03h Attribute 0 control 1 isochronous 2 bulk 3 interrupt db 08h 00h Max packet size db 0Ah Interval 10 ms USBEndPointDescriptionIntEnd IAEA AR RA AA OR RE OR AA USBStringLanguageDescription db 04h Length db 03h Type 3 string db 09h Language English db 01h Sub language US USBStringDescriptionl db 10h Length db 03h Type 3 string dsu Cypress USBStringDescription2 db 18h Length db 03h Type 3 string dsu Thermometer USBStringDescription3 If a SN is used this must be unique A for every device or the device may H not enumerate properly USBStringDescription4 ab 20h Length ab 03h Type 3 string dsu Get Temperature
25. USB is applying power during development The fact that JP1 is left connected to Vss makes the device not strictly compatible with the USB specification because it will draw approximately 20 mA whenever it is connected The USB specification limits power prior to the device being configured to 500 uA The Enumeration LED The Enumeration LED as shipped from Cypress is used to indicate that the USB Thermometer device has been enumerated The cathode of the LED is connected to P13 through a jumper JP2 which controls its path to Vss The cathode of this LED is also connected to a pin on the 40 pin connector pin 10 and to an adjacent hole that may be used to install a wire wrap pin This allows the user to remove the jumper to P13 and use the LED for their own purposes The switch SW1 SW1 as shipped on the Cypress USB Thermometer is used to select whether the Thermometer Windows application displays the temperature in Centigrade or Fahrenheit It is a momentary SPST One pole of the switch is connected to Vss The other pole is connected to Vcc Vbus through R4 to a pin on the 40 pin connector pin 6 to an adjacent hole that may be used for installing a wire wrap pin as well as to the GPIO P12 of the USB controller through a jumper JP3 This allows the user to remove the jumper to P12 and use SW1 for their own purposes The breadboard area Sea of holes Cypress has provided an area that will accept wire wrap pins and wire wrap
26. USBSendACK Status response to Status In is to send a zero byte packet mov a USBEndPOTxRespond USBEndPOTxSequence iowr USBEndPOTxConfig Enable interrupts mov a gbSysInterruptMask iowr SysInterrupt Wait for send complete jmp USBSendWaitForComplete DEVO CP PT OT Y E d USBSendWaitForComplete func Wait for send to complete on end point 0 A RG do O vege Aon ae Cypress Semiconductor Ver 0 993 Page 31 Cypress CY3640 USB Starter Kit User s Guide At some point either the 0 data will be ACK d or a SETUP H will come in Either event will cause the Enable Respond q to In Packets to be reset and we will fall out of the loop In either case an EPO IRQ will be generated 5 9 2 2 in Cyp A device spec if EPO irq is enabled USBSendWaitForComplete Poll the send complete bit This will be reset when the data has been sent to the host H and the host has ACK s or the host has sent another SETUP n which should terminate this activity in any case iord USBEndPOTxConfig and a USBEndPOTxRespond jz USBSendWaitComplete Check for OUT packet cancelling send A STATUS OUT should H terminate any pending IN s A Setup could also set the Out bit iord USBEndPORxStatus and a USBEndPORxOut jnz USBSendWaitComplete Cancelled Keep waiting jmp USBSendWaitForComplete USBSendWaitComplete ret SPAGE RR RER ee ay Dd MD MU Re re Mr Cd USBEventEPOVendorRgst func Vendor reque
27. _0 USBEventEPOSetupTargetDeviceOUT Target Device cmp a USBRastTargetDevice TE USBEventEPOSetupIsSetAddress Yes USBEventEPOSetupTargetInterfaceOUT cmp a USBRqstTargetInterface jz USBEventEPOStall Yes Oops We don t have an interface USBEventEPOSetupTargetEndpointOUT cmp a USBRgstTargetEndPoint j EPOStall Yes USBEventEPOSetupTargetDeviceIN cmp a USBRqstTargetDevice USBRqstTypeDirection jz USBEventEPOSetupGetDescriptor Yes USBEventEP0SetupTargetInterfacelN cmp a USBRgstTargetInterface USBRqstTypeDirection jz USBEventEPOStall Yes Oops We don t have an interface USBEventEP0SetupTargetEndpointIN cmp a USBRqstTargetEndPoint USBRqstTypeDirection Cypress Semiconductor Ver 0 993 Page 24 Cypress CY3640 USB Starter Kit User s Guide jz USBEventEPOStall Yes Vendor specific commands USBEventEPOSetupTargetVendorIN OUT Check request IN packet OK OUT packet ERR mov a USBEndPOFIFO 0 and a USBRqstTypeVendor USBRqstTargetEndPoint USBRqstTypeDirection cmp a USBRqstTypeVendor USBRqstTargetEndPoint USBRqstTypeDirection jz USBEventEPOVendorRqst Unsupported request jmp USBEventEPOStall Oops We don t support whatever request was made SPAGE E Qr d E fee feic fhis An dI OP EM d WB WA AA KA NA USBEventEPOSetupIsSet func End point event SETUP to set address devnote Runs in interrupt enabled context RAR AAR AAR AS
28. e equ 26h Buffer send data 0 1 line gbUSBSendBytes equ 27h Buffer bytes left to send gbUSBSendBuffer equ 28h Offset into current buffer gbSuspendCount equ 30h of msec bus has been IDLE General gbSysEnumerated equ 29h Device is enumerated LED management Qc bLEDBrightnessUpdate equ 2Bh Semaphore to reset brightness gbLEDBrightness equ 2Ch Current brightness LED ON equ 08h P13 is used to indicate Enumeration Button management gbButtonDebounce equ 2D h Debounce count down value gbButtonPushed equ 7Ah USBEndPlFIFO 2 toggles if button was clicked Button Pin equ 04h Pin the switch is on P12 SPAGE RAD JE RINK E ORO KON Code Segment ROM RR RR RR E a nn Rank Ann SAR E Vector Table org 00h jmp main Reset of some type jmp SysUnUsed 128us timer not used jmp SysTimer1024usEvent 1024us timer jmp USBEndPoint0Event EPO jmp SysUnUsed EP1 not used jmp SysUnUsed Reserved jmp SysGPIOEvent Button jmp SysUnUsed CExt not used SERE REA ARERR ARAL AAA RT RR BA RR RAE AD AR AERA AE RARE Unused event Do nothing restore machine to prior state Cypress Semiconductor Ver 0 993 Page 19 Cypress CY3640 USB Starter Kit User s Guide SL ge ete ens omae AO ri SysUnUsed push a mov a gbSysInterruptMask ipret SysInterrupt SPAGE AE EE E M E A A E E EE E E M M E E DE E main func Entry point after PowerOn WatchDog timeout or WakeUp
29. e temperature history display Checking the Show Time Line box will select the temperature history display Unchecking the Show Time Line box will select the conventional thermometer display Click on the OK box to complete your selection see Figure C2 Cypress Semiconductor Ver 0 993 Page 7 Cypress CY3640 USB Starter Kit User s Guide 2 e E ESSO 3 Heind User s Name Marco s Temperature Fahrenheit v Remember Settings Centigrade Show Time Line Sample Interval Seconds C Minutes J CYPRESS C Hours Cypress USB Thermometer 1 Ver 1 0 2 USB USB Options ma um 7 Cancel ok Figure C2 Changing the maximum and minimum temperature value displayed The Thermometer application can display temperatures between 0 C and 70 C 32 F and 158 F The user may set the temperature range display on the Options screen by entering the desired value in the appropriate Temperature Limits text box Changing the user s name The user may change the heading which appears at the top of the temperature display This is done on the Options screen by changing the text in the User s Name text box Changing the display mode from Centigrade to Fahrenheit The Thermometer application can display temperature in either Centigrade or Fahrenheit The display mode is selected in the Options screen by selecting either t
30. eol alg obo ae RK BADE F I O ports defined SysPort0 equ 00h GPIO data port O P00 P07 SysPortl equ 01h GPIO data port 1 P10 P13 SysPortOIntEnable equ 04h PortO Interrupt Enable SysPortlIntEnable equ 05h Portl Interrupt Enable SysPortOPullUp equ 08h PortO PullUp Resistor Enable 0 active SysPortlPullUp equ 09h Portl PullUp Resistor Enable 0 active General SysStatus equ FFh SysStatusRun equ 01h SysStatusReserved2 equ 02h nul SysStatusReserved3 equ 04h nul SysStatusSuspend equ 08h write only restart 256us SysStatusPowerOn equ 10h SysStatusUSBReset equ 20h SysStatusWDReset equ 40h SysStatusReserved7 equ 80h nul SysWatchDog equ 21h WatchDog controller SysTimerExternal equ 22h Timer also SysTimer equ 23h Timer read only 6MHZ lus resolution SysInterrupt equ 20h Global interrupt SysIntReserved0 equ 01h SysIntTimer128us equ 02h H SysIntTimer1024us equ 04h H SysIntUSBEndPO equ 08h SysIntUSBEndP1 equ 10h SysIntReserved5 equ 20h H SysIntGPIO equ 40h SysIntWakeUp equ 80h Cypress Semiconductor Ver 0 993 Page 37 Ouput ISink SysPort0ISinkPinO SysPort0ISinkPinl SysPort0ISinkPin2 SysPort0ISinkPin3 SysPort0ISinkPin4 SysPort0ISinkPin5 SysPort0ISinkPin6 SysPort0ISinkPin7 SysPort1ISinkPinO SysPortlISinkPinl SysPortlISinkPin2 SysPortlISinkPin3 USB FIFOs USBEndPOFIFO USBEndPOFIFO
31. er get here AAN APA EK AOR RER Aaa A EER ERER EREEREER REER ERREEN SysTimer1024usEvent func Timer interrupt event ocurring every 1 024 mSec using 6Mhz crystal A RE GS ERIERER SysTimerl024usEvent Save accumulator push a Clear watchdog timer Clearing it here effectively disables the timer iowr SysWatchDog Keep track of length of any IDLE conditions No bus activity Cypress Semiconductor Ver 0 993 Page 21 Cypress CY3640 USB Starter Kit User s Guide iord USBControl Read the USB Status and Control Reg and a 01h Check bit 0 cmp a 0h jz Inc_Counter Hmm No activity Branch and keep track of it iord USBControl Ah There was activity clear the bus activity bit and a 0feh iowr USBControl mov a 0 Clear the suspend counter mov gbSuspendCount a jmp Suspend_End Inc_Counter Monitor the IDLE count mov a gbSuspendCount Get of mSec we have been IDLE inc a Increment the count mov gbSuspendCount a cmp a 03h Has it been 3msec yet jnz Suspend_End Not yet branch mov a 0h Yes clear the suspend counter mov gbSuspendCount a iord SysStatus or a 08h Set the suspend bit to cause a suspend iowr SysStatus We will enter the suspend state during H the next instruction Suspend End Increment the 1024 usec counter and check for rollover inc gbSysTick1024us jnz STimerNol024usRoll No Clear rollover mov a 0 mov gbSysTick1024usRoll a STimerNol024usRoll Are
32. et Get Set Get Get Set Address Descriptor Descriptor Configuration Interface Interface Synch Frame E RR tents A AA OA OE eh Aan POS IO E LR a rei USB USBRqs USBRq US US US US US Rq Rq Rq Rq Rq UJ UJ UJ UJ UJ US US US US Rq Rq Rq Rq ww UJ UJ USBRqs USBRq z w US US US US US US US US US US US US Rq Rq Rq Rq Rq Rq Rq Rq Rq Rq Rq Rq Protocol tType stTypeDirection stTypeMask stTypeStandard stTypeClass stTypeVendor stTypeReserved stTargetDevice stTargetInterface stTargetEndPoint stTargetOther tMessage stGetStatus keup stClearFeature stReserved02 stSetFeature stReserved04 stSetAddress stGetDescriptor stSetDescriptor stGetConfiguration stSetConfiguration stGetInterface stSetInterface stSynchFrame UJ UJ UJ UJ vw u UJ UU UJ UJ UJ UJ W USBRq USBRqs stReserved0D tWordValueLo Cypress Semiconductor eq u USBEndPOFIFO 0 u 80h 60 00 20 40 60 SE6SESS O2DODDOS 00 01 02 03 seco Do Do a 00h E 01 02 03 04 05 06 07 08 09 0A OB 0c 0D gs ga G ga C O gs m E E QE G DODODODDOODOD P u USBEndPOFIFO 2 r l Device to Host 0 Host to Device USBEndPOFIFO 1 DLE field 0x01 Self powered 0x02 Remote Ver 0 993 Page 39 US BRqstWordVal LueHi Cypress CY3640 USB Starter Kit equ USB kk ck ck ck kk ke ke ke ke ke ke ke Sk e
33. from sleeping comm Never returns EEA KLARA E COEUR PRIOR ER RR ICA TOR E ADAG RICA ARDER DARA OR AA ALAS ALARA IATA ARICA AAR main This portion of Main is only executed after a RESET Power On or USB Setup data stack in high order RAM just below EPO FIFO It will grow down from here mov a 70h USBEndPOFIFO swap a dsp Initialize both Ports high mov a FFh iowr SysPort0 Port 0 Data reg iowr SysPortl Port 1 Data reg H 1 on P13 is needed to make sure enumerate LED is off E 1 on any port that needs to be an input Enable Pullups 0 enable mov a 0 iowr SysPort0PullUp mov a Button Pin iowr SysPortlPullUp 1 on P12 is needed to make sure GPIO interrupt H occurs on LOW to HIGH transistion This disables it s pull up Enable or disable interrupts on appropriate pins mov a 0 iowr SysPortOIntEnable All pins irq s are disabled on Port O0 mov a Button Pin iowr SysPortlIntEnable Enable P12 the button pin No interrupts will occur until the device is enumerated Then GPIO s will be enabled and we will allow P12 to generate interrupts Initialize timers mov a 0 mov gbSysTick1024us a mov gbSysTick1024usRoll a Initialize USB variables mov a 0 mov gbUSBValidRqsts a No valid requests yet mov gbUSBSendSequence a Start with a O mov gbSysEnumerated a Not enumerated Initialize LED mov a flag it for an update E set for maximum brightness a 1 mov gbLEDBrightnessUpdate a F bLEDBri
34. gbThermTempRead a jmp ThermPortTempReadClock redundant but good practice ThermPortTempReadClock ThermClock 1 mov a gbThermPortMirror or a ThermClock mov gbThermPortMirror a iowr ThermPort Next bit in mask push x pop a asl a push a pop x EEA AAA RADAR ERDAS ALAA RISA GOA RENA ARAR AK A ARAL AOA Finished pop a dec a jnz ThermPortTempReadLoop AR APA ha AA AUA CIRCO MRS COR Last bit ER O p MEER Tri state data pin for input mov a gbThermPortMirror or a ThermData iowr ThermPort ThermClock 0 mov a gbThermPortMirror and a ThermClock mov gbThermPortMirror a iowr ThermPort Read in data pin and check for 0 or 1 iord ThermPort and a ThermData jnz hermPortTempReadLastValuel ThermPortTempReadLastValueO0 jmp ThermPortTempReadLastClock ThermPortTempReadLastValuel Use bitmask mov a mov gbThermTempRead2 a jmp ThermPortTempReadLastClock redundant but good practice ThermPortTempReadLastClock ThermClock 1 Cypress Semiconductor Ver 0 993 Page 44 Cypress CY3640 USB Starter Kit User s Guide mov a gbThermPortMirror or a ThermClock mov gbThermPortMirror a iowr ThermPort ret SPAGE utto Eo e e a it o A EE od ThermPortRead8Bits func parm BYTE gbThermPortValue Return read byte Hoc d a ME AM E LEE ThermPortRead8Bits Setup bitmask mov a l push a pop x mov a 8 ThermPortValueReadLoop
35. ghtness a Initialized Button mov gbButtonPushed a Initial state of 0 no button pushed Initialize variables mov a 0 mov gbUSBSendBytes a No bytes to send in FIFO buffers mov gbSuspendCount a Reset bus activity to 0 mov gbButtonDebounce a We are not debouncing Set interrupt mask mov a SysIntTimerl024us SysIntUSBEndPO Cypress Semiconductor Ver 0 993 Page 20 Cypress CY3640 USB Starter Kit User s Guide mov gbSysInterruptMask a EE AR AA AA FA EA AAA KKK Ga ARRE RAR MainLoop Enable interrupts to current mask mov a gbSysInterruptMask iowr SysInterrupt A o a do nothing until we are enumerated mov a 0 cmp a gbSysEnumerated JZ MainLoop Not enumerated loop Ah We re enumerated lets do the rest of the loop Fe EQUUS ee ec Write a 0 to the LED on P13 to turn it on mov a LED ON iowr SysPortl Wait 10 milliseconds mov a 10 call SysDelayMS aa ao o o s Mad ai OE K OK UG Read temperature call ThermReadTemperature PR a eS Update brightness mov a 0 cmp a gbLEDBrightnessUpdate jz MainLoopNoLEDUpdate No branch Yes update the LED brightness Reset the LED update flag mov a 0h mov gbLEDBrightnessUpdate a Set new brightness mov a gbLEDBrightness iowr SysPortlISinkPin3 Fall through to here in any case MainLoopNoLEDUpdate Loop jmp MainLoop pi tay ae ee Ro ae ey aa a halt Oops We should nev
36. h 1 NA Brightness NA NA NA Status Read Thermometer OBh 3 Button Temp Button Sign Status Read Port 014h 2 NA Port NA NA Status 015h 1 Value Port NA NA Status 016h 2 NA Address NA NA Status 017h 1 Value Address NA NA Status 018h 3 2 Index NA NA NA Status Indexed to USBSendROMBufferBase Cypress Semiconductor Ver 0 993 Page 48 Cypress CY3640 USB Starter Kit User s Guide J References and Links Obtaining the latest version of the USB specification You may obtain the current version of the USB Specification Revision 1 0 on the Cypress CD ROM You may also obtain updates to the USB specification and other USB information and documents from the USB web site http www usb org Obtaining the latest assembly code for the Cypress USB Thermometer You may obtain the latest version of the assembly code for the Cypress USB Thermometer from the Cypress web site http www cypress com Obtaining the latest Cypress USB Thermometer driver You may obtain the latest version of the Cypress USB Thermometer application for the Cypress USB Thermometer from the Cypress web site http www cypress com Obtaining the latest Cypress USB Thermometer application You may obtain the latest version of the driver for the Cypress USB Thermometer from the Cypress web site http www cypress com Cypress Semiconductor Ver 0 993 Page 49 Cypress CY3640 USB Starter Kit User s Guide K Q amp A Errata and Gotchas e How can tell if my system s
37. he Fahrenheit or the Centigrade radio buttons box Changing the time between temperature sample periods The Thermometer application can sample the temperature at a variable rate determined by the user The user sets the sample rate on the Options screen by selecting the appropriate options in the Sample Interval area Sample intervals may be chosen between one per second to one every 30 hours Simulating temperature measurements The Temperature display program allows you to simulate temperature readings instead of actually measuring them You can select this by clicking on the USB Options box The USB Options screen will be displayed See Figure C3 Checking the Simulate Temperature box will cause the thermometer to enter a test mode in which a series of random temperature readings will be displayed Cypress Semiconductor Ver 0 993 Page 8 Cypress CY3640 USB Starter Kit User s Guide Not Present LED Brightness Check For Devi 0 eck For Device cup me v Simulate Temperature Figure C3 Testing to see if a Cypress USB Thermometer device is present If your Cypress USB Thermometer device is plugged in to the USB and you cannot get temperature measurements you may try to connect to it by clicking the Check For Device button on the USB Options screen See Figure C3 This screen is available by clicking the USB Options button on the Options screen The text above the button will indica
38. he serial port and perform self test e Insert your Cypress USB controller into the DIP adapter and choose the appropriate commands from the programmer software The programming software is actually quite simple however it provides all the necessary functions to program a USB controller such as blank check read program verify and security fuse programming The software is able to read and write BIN and HEX format files To erase the code programmed in the windowed USB controller devices use regular UV EPROM erasers available on the market Adding your own logic See Appendix D for a description of the items that you may change to modify your design Cypress Semiconductor Ver 0 993 Page 14 Cypress CY3640 USB Starter Kit User s Guide G Cypress CY3640 USB Starter Kit Schematic Bill of Materials Ut U2 P1 P2 swi DS1 DS2 xi JP1 JP2 JP3 R1 R2 R3 R4 R5 C1 C2 C3 C5 C6 C7 J1 J2 FB1 FB2 Cypress CY7C63001 USB controller Dallas Semiconductor DS1623 temperature sensor 2 pin header polarized 0 1 center right angle Not populated 5 pin header polarized 0 1 center vertical Not populated SPST Momentary switch 20 mA 2 2 Vdc Red LED 0 1 center 0 02 leads 20 mA 2 2 Vdc Green LED 0 1 center 0 02 leads 6 MHZ ceramic resonator 2 pin header 0 1 center with shunt 2 pin header 0 1 center with shunt 3 pin header 0 1 center with shunt 7 5K Ohm 1 1 8 W carbon film resistor 150 Ohm
39. ich are specific to your product The routines you will need to focus your changes on are in the file USB ASM They are e Main e SetConfig e 1024usec IRQ handling e Vendor Specific Setup Commands Assembling the code for your device You can assemble your code for the Cypress USB Controller with CYASM Cypress assembler See the Cypress CYASM documentation Both CYASM and its documentation are included in the USB Starter Kit CD ROM Programming your device After you have written and assembled your own USB controller firmware code you can program a new USB controller using the device programmer contained in the Cypress USB Starter Kit Please note that the device programmer only supports Cypress CY7C63X0X family of low speed USB controllers namely CY7C63000 CY7C63001 CY7C63100 CY7C63101 CY7C63200 and CY7C63201 Its components include e a device programmer with a 32 pin DIP adapter e a floppy disk with the programming software e a9 pin serial cable e a wall power adapter To program a new USB controller simply follow these steps Cypress Semiconductor Ver 0 993 Page 13 Cypress CY3640 USB Starter Kit User s Guide e Connect the device programmer to your PC s serial port using the serial cable e Turn it on by plugging the wall power adapter e Copy the programming software executable on the floppy disk to your PC s hard disk and run it At startup the software will detect the presence of the programmer connected to t
40. ingDescription2 USBSendROMBufferBase mov gbUSBSendBuffer a Descriptor size mov a 18h USBStringDescription2 mov gbUSBSendBytes a Check request size field call USBSendDescriptorCheckLength Send buffer call USBSendROMBuffer jmp USBEventEPOEnd USBEventEPOSetupGetDescriptorString3 cmp a 3 jnz USBEventEPOSetupGetDescriptorString4 No QUOND ADS Noc oc cea o dodo re d dene oen oe bu S ao RN Get String 3 Descriptor Event FREAK AAA ALAA ARS ARAL RRA ARAL AR RRA ARR AAA Descriptor pointer mov a USBStringDescription3 USBSendROMBufferBase mov gbUSBSendBuffer a Descriptor size mov a 24h USBStringDescription3 mov gbUSBSendBytes a Check request size field call USBSendDescriptorCheckLength Send buffer call USBSendROMBuffer jmp USBEventEPOEnd USBEventEP0SetupGetDescriptorString4 cmp a 4 jnz USBEventEP0SetupGetDescriptorString5 No EEA AAA BRA AA EK KAKA RK KDA BABA RAB O AAS alg ue olo Ade eo RAR Get String 4 Descriptor Event RU het Ren dd u ii is an AA ERRER Descriptor pointer mov a USBStringDescription4 USBSendROMBufferBase mov gbUSBSendBuffer a Descriptor size Cypress Semiconductor Ver 0 993 Page 28 PAGE mov mov a 20h Check request call USBSendDes Send buffer Cypress CY3640 USB Starter Kit User s Guide USBStringDescription4 gbUSBSendBytes a size field criptorCheckLength call jmp USBEve
41. ite igRead terRead terLoad eRead eg eg eg eg eg Temperature Low Fla eq eq eq eq eq sed eq eq eq eq eq u u u u u g feri eq eccogcgcagcgcgageaegeagaea 01h 02h 10h 80h 60h TLF AOh AA EE 22 01 02 Al A2 0c AC AO 41 A9 SO DO OO O 0000000 r r r FRA AREA OR KR ARRAS OE OASCOR UC KK COR EUR OXUK KR IRE AIR OR COUR RU AR COR RO OK KH NR OCURRE UR COR UR AAA A l data clock 0 Clock line signals start conversion Nonvolatile Memory Busy flag up to 10ms THF and TLF Temperature High Flag THF and ThermTempHighWrite OR ThermRead ThermTempLowWrite OR ThermRead ThermConfigWrite OR ThermRead 00h OR ThermRead undocumented Ver 0 993 Page 47 Cypress CY3640 USB Starter Kit User s Guide l Thermometer driver reference The Cypress driver is accessed through the Windows DeviceloControl API The following code and table illustrates its use Type OVERLAPPED Internal As Long InternalHigh As Long offset As Long OffsetHigh As Long hEvent As Long End Type Public gOverlapped As OVERLAPPED Public hgDrvrHnd As LONG Dim lIn as long lInSize as long lOut as long lOutSize as long 1Size as long Dim ltemp as long ltemp DeviceloControl hgDrvrHnd 4 amp lIn lInSize 10ut lOutSize 1Size gOverlapped Command Value Out Value Size Bytes lin lOut Function Value lin IOut MSB LSB MSB LSB Set LED Brightness OE
42. iver This can be confusing if you have already attached the device to the other host port in the same system and loaded the driver However this is normal Windows behavior Simply Browse to the Windows System directory where the device driver is located and Windows will find it and not ask you again e Hot Unplug problem with Windows98 Memphis Beta 2 If your system is running Memphis Beta 2 a hot unplug of the thermometer device will cause the operating system to crash blue screen Cypress is currently working on a solution to this problem You can work around this problem by performing a Refresh in the Device Manager under the Control Panel System icon prior to hot unplug This will effectively unload the USB thermometer driver please see next bullet e Device Manager Refresh unloads USB thermometer driver If you press the Refresh button on the Device Manager screen the USB thermometer driver will unload if it was loaded or reload if it was not loaded Cypress is currently working on a solution to this problem To work around this problem do not refresh the Device Manager If you must refresh the Device Manager a second refresh will reload the thermometer driver e Acold system boot will not automatically load the USB thermometer driver If the system is rebooted the USB thermometer driver will not automatically reload even if the thermometer device is plugged into the USB Cypress is currently working on a solu
43. meter device a Windows95 thermometer application and a USB Thermometer device driver Together these components allow the user to measure and display temperatures between 0 C and 70 C to an accuracy of 1 C In addition to being a useful USB device Cypress has designed the USB Starter Kit to serve as an easily customizable platform for USB device development using the Cypress CY7C63X0X family of USB controllers Features The CY3640 has the following features The Cypress USB Controller is socketed in a 20 pin socket It may be removed reprogrammed and replaced for easy development of new assembly code Cypress has supplied a bread board area sea of holes This area will accept wire wrap pins and wire wrap sockets This area will make it easy to develop additional logic on board A connector for use with standard 40 pin flat cable connectors has been provided All signals from the Cypress USB Controller which are useful for the development of external logic are available at pins on the connector The signal names are labeled on the top layer of the board Pin numbers on the connector are labeled on both the top and bottom layers of the board to make it easy to wire to the connector An identical set of signal vias is placed adjacent to the connector for easy wiring to the signals Connections to external power source There is a location for an external power supply connector but the connector is not supplied with the kit
44. n nnn nnn 48 J Pelerencos and LI AA 49 Obtaining the latest version of the USB specification nn 49 Obtaining the latest assembly code for the Cypress USB Thermometer 49 Obtaining the latest Cypress USB Thermometer driVer cccccccccccnccnnnnnnnnnnnnnncninnnnnnnnnnns 49 Obtaining the latest Cypress USB Thermometer applicatiON cooocionnnnnnnnnnnnnnnnnnnnnnos 49 K Q amp A Errata and Gotchas 2 22m Da 50 e How can I tell if my system supports the USB nn 50 System Properiies e rereeeeraaaaaaaaaaaaaaaaaaaaaaaaaa nennen 50 e Problem with system stability when a crystal is used with the Cypress CY7C63X0X family of USB ControllerS amics rita 51 e Memphis Windows98 Beta X is still a beta program ooooocccnnnncnnnnicocccccnnnconananannncnnnnnos 52 e Windows may ask for a USB device driver even if you have previously loaded it 52 e Hot Unplug problem with Windows98 Memphis Beta 2 52 e Device Manager Refresh unloads USB thermometer driver 52 e Acold system boot will not automatically load the USB thermometer driver 52 Cypress Semiconductor Ver 0 993 Page 3 Cypress CY3640 USB Starter Kit User s Guide A Contents of the CY3640 USB Starter Kit 1 Three CY7C63001 Cypress USB Controller devices One pre programmed windowed controller on the CY3640 USB Thermometer Demo board and two spare device
45. on The Cypress USB Thermometer application is the user interface program which displays the temperature measurement received from the Cypress USB Thermometer device on the USB Starter Kit PC board The SETUP EXE is located in the root directory of the Starter Kit CD ROM After you have run SETUP EXE the Cypress USB Thermometer Windows application will be properly installed in the default directory C Program Files Thermometer or a directory selected by you The setup program also installs an entry in the Programs section of your Start menu The Cypress USB Thermometer application may be uninstalled by selecting it in the Add Remove Programs section of the Control Panel Plug the A end flat connector of the USB cable into the USB port of your PC Plug the B end square connector of the USB cable into the B receptacle of the CY3640 USB Starter Kit The computer will notify you that it has found new hardware and is looking for a driver If it does not find a driver it will then ask you to supply a driver Insert the Cypress USB CD ROM if prompted to do so If your computer prompts you to supply a driver make sure that your Cypress USB CD ROM is inserted into your computer s CD ROM drive Your computer will now automatically install the Cypress USB driver from the CD ROM Run the Cypress USB Thermometer application When you want to run the Cypress USB Thermometer application use the Programs menu and select the
46. p ret x a Cypress CY3640 USB Starter Kit User s Guide Number of microseconds 0 65536 cycles 6Mhz or 166us cycle FER JCKOR KUKOKOR GR KCK COR SR OR EA KORR BR JARRY AGR OR COGOR OK ARBAB AB REA RR OLOR AA Data Segment SURE COE RR GO RAS UK Ue COEUR ARIAS SQ AA ORA E OR NOSE OR lo UO AES EN BBS ROO pO RE olg aeos ROM USBSendROMBufferBase USBDeviceDescription db 12h Length db 01h Type 1 device db 00h 01h Complies to USB Spec v1 00 db 00h Class code 0 db 00h SubClass code 0 db 00h Protocol 0 none 9 6 1 db 08h Max packet size for portO0 db B4h 04h Vendor ID 0x4B4 Cypress db 02h 00h Product ID 0x02 USB Thermometer db 09h 00h Device release v0 90 db 01h Manufacturer string descriptor index 0 none db 02h Product string descriptor index 0 none db 00h Serial number string descriptor index 0 none db 01h Number of possible configurations USBDeviceDescriptionEnd PRU a Kn ira USBConfigurationDescription 09h 02h 19h 00h 01h 01h 04h 80h 32h USBConfigurationDescri db db db db db db db db Tot r Length Type 2 config al data length 1 config 1 interface 1 endpoints Interface supported 1 Configuration value 1 Confituration string descriptor index 0 none Configuration 80h Bus powered Maximum power consumption in 2mA units ptionEnd FRIAR AGIA IRSE AA AGA ERA AGA AGA ACA AAS ANO U
47. r func Send a number of ROM bytes on end point 0 parm BYTE gbUSBSendBytes Number of bytes to send parm BYTE gbUSBSendBuffer Offset from ROM base of data to send comm assumes IN packets are ignored in the interrupt routine devnote Enables interrupts Ver 0 993 Page 29 Cypress CY3640 USB Starter Kit User s Guide AR ia USBSendROMBuffer Clear flag mov a 0h iowr USBEndPORxStatus Enable interrupts mov a gbSysInterruptMask and a SysIntUSBEndP0 iowr SysInterrupt Auto ACK OUT packet This would be a Status Out mov a USBControlAckStatusData iowr USBControl Initialize sequence mov a Oh mov gbUSBSendSequence a Send count mov a gbUSBSendBytes USendROMBufferLoop One 8 byte chunk or less left cmp a 08h jz USendROMBufferLoopDone exactly 8 bytes left branch jc USendROMBuf ferLoopDone less than 8 bytes left branch more than 8 bytes left fall through and loop A until there are 8 bytes or less Save count push a Send 8 byte chunk mov a 08h mov gbUSBSendBytes a call _USBSendROMBuffer Check for OUT packet cancelling send iord USBEndPORxStatus and a USBEndPORxOut Restore count pop a Handle exception OUT packet cancel send jnz USendROMBufferLoopExit Cancelled Save bytes left sub a 08h mov gbUSBSendBytes a jmp USendROMBufferLoop USendROMBufferLoopDone Send last 8 or less bytes call _USBSendROMBuffer USendROMBuf ferLoopExit
48. re request a value is sent indicating whether the button has been pushed The GPIO interrupt is triggered by pushing the button causing its level to change from High to Low A 100ms debounce was added to control the erroneous re occurrence of this logical state change for a period The 1024ms timer decrements the debounce to zero re enabling the button if at the end of the time out it has returned High Port Usage P0 0 Thermometer Data input output 1 Thermometer Clock output Thermometer Reset output Pl FON u BWND l Cypress Semiconductor Ver 0 993 Page 18 Cypress CY3640 USB Starter Kit User s Guide 2 Button 0 pushed input i 3 LED 0 0n output FRR RA RD ER BK KAR RA AA ERED eu o oko rotae RENNEN nie koe SEA Ais SPAGE Directives FillROM 0 Microprocessor definitions include 63x0x inc E ANS M E E d d OLI Data Segment RAM SA RO Km p qe TL Ae Doe gone dene ao doge pn AA AA AA Program Stack Qo bSysProgramStack equ 00h 00h 1Fh Stack 0x20h gbSysDataStack equ 50h 50h 6Fh Stack 0x20h gbSysFIFO equ 70h 70h 7Fh EPO and EP1 FIFO s Global Interrupt bSysInterruptMask equ 20h Holds the current interrupt mask Q System tickers bSysTick1024us equ 22h of lmSec ticks gbSysTick1024usRoll equ 24h of 256mSec ticks Qo USB management data gbUSBValidRqsts equ 25h Count of USB recognized requests P Used during debug gbUSBSendSequenc
49. rements iii nn nn nn nn nn nr rana rr nana 8 Testing to see if a Cypress USB Thermometer device is present nn 9 Changing the brightness of the Enumerated LED on the Cypress USB Thermometer device 9 Saving the current configuration of the Thermometer applicatioN lt ww wwwmwa 9 About the Cypress CY3640 USB Starter Kit sans 10 OST e 10 FC ALURES AAA ent 10 Otheritems or Interest ooo ete NENE e O o 12 Changing the functionality of the Cypress CY3640 USB Starter Kit 13 Changing the program in your device ono ncnnnnnonnnnn mumu anazini wizi awa 13 You can write your own code for your Cypress USB Controller nennen 13 Assembling the code for your device erre nn nnn nn nana 13 Programming your device s i eet er Ei E ca Ee Ee Hi Ee tet de ela 13 Adding your own logic nennen nennen nennen nne n zazuiwa 14 Cypress CY3640 USB Starter Kit Schematic sas nosso ssa 15 Bibo Materials rtr i ci ran 15 Cypress USB Controller micro code Assembly eene 18 USB ASMii iicet tdt 18 OY69300Xl ING deerunt ere tue A E cred Eier an 37 DALLAS ASM 2 ont ete Dette te bike 41 DALELEAS INQ ierit A Ea S 47 Cypress Semiconductor Ver 0 993 Page 2 Cypress CY3640 USB Starter Kit User s Guide l Thermometer driver PE OO eee eene enne nnn nnn nnn nnn nn
50. rmPortRead Save input mov gbThermProtocol a Initialize results mov mov Call Call Call Call ret a 0 gbThermPortValue a hermPortResetHigh hermPortProtocolWrite ThermPortRead8Bits hermPortReset Low E ii SA a ia a ThermPortProtocolWrite func parm BYTE gbThermProtocol Protocol value Ro PP E E GE PD E E AAA AAA ThermPortProtocolWrite mov push mov mov call pop mov ret PAGE a gbThermPortValue a a gbThermProtocol gbThermPortValue a ThermPortWrite8Bits a gbThermPortValue a E a ee Se ee a ee ThermPortReadTemperature func parm BYTE gbThermTempRead Returned read temperature low bits parm BYTE gbThermTempRead2 Returned read temperature high bit DE E Ed O Ro RE ea Aas UU ThermPortReadTemperature Setup bitmask mov a l push a pop x mov a 8 ThermPort TempReadLoop push a PS a Sa ore Tri state data pin for input mov a gbThermPortMirror or a ThermData Cypress Semiconductor Ver 0 993 Page 43 Cypress CY3640 USB Starter Kit User s Guide iowr ThermPort ThermClock 0 mov a gbThermPortMirror and a ThermClock mov gbThermPortMirror a iowr ThermPort Read in data pin and check for 0 or 1 iord ThermPort and a ThermData jnz hermPortTempReadValuel ThermPortTempReadValueO0 jmp ThermPortTempReadClock ThermPortTempReadValuel Use bitmask push x pop a or
51. rmPortValue ThermPortWriteValuel PortWriteValue0 hermData 0 a gbThermPortMirror a ThermData gbThermPortMirror a r ThermPort ThermPortWriteValueClock PortWriteValuel hermData 1 a gbThermPortMirror a ThermData gbThermPortMirror a r ThermPort ThermPortWriteValueClock PortWriteValueClock hermClock 0 a gbThermPortMirror a ThermClock gbThermPortMirror a r ThermPort ext bit in mask h x a a ha x hermClock 1 a gbThermPortMirror a ThermClock r ThermPort Value to write A A A A A A A Ach ACRA a r ck kk kk ek Se e Se e Se e e Se Se Se e ke ke e e ke e e KK aa redundant but good practice Ro AA AIRE RAR UR ARK AER AERA UK AR ARE RRR SS PE pop dec jnz ret Cypress inished a a ThermPortWriteLoop Semiconductor Ver 0 993 Page 46 DALLAS INC Cypress CY3640 USB Starter Kit User s Guide DS1620a inc DS1620 High Reolution Temperature Measurement Sensor r DS1620 Control register ThermControlOneShot 3 3 hermCont hermCont hermCont hermCont 3 3 3 3 3 DS1620 hermRead I 3 3 hermTemp ThermConv ThermConv hermTemp hermTemp hermTemp hermTemp hermConf hermConf ThermCoun ThermCoun hermSlop 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 Cypress Semiconductor rolCPUUse rolNVB rolDone rolFlags Protocol Read ertStart ertStop HighWrite LowWrite HighRead LowRead igWr
52. s one windowed and one OTP 2 One Cypress USB Programmer from HI LO Systems with a wall power adapter a serial cable and programming software on a floppy disk 3 One CY3640 USB Starter Kit printed circuit board One low speed unshielded USB A to B Cable 5 One Cypress USB Starter Kit CD ROM Software CYASM Cypress USB controller assembler USB Thermometer device assembly source code USB Thermometer Windows application program executable code USB Thermometer device driver Documentation Cypress USB controller family datasheets USB Thermometer User s Guide and Application Note Designing a USB Thermometer with the CY7C63001 USB Controller USB Thermometer PC board layout and schematics USB Specification v1 0 Cypress CYASM assembler manual Cypress USB related application notes Cypress databook 6 Printed documentation USB Starter Kit User s Guide USB Starter Kit Application Note Registration card Please fill it out and drop it in the mail gt Cypress Semiconductor Ver 0 993 Page 4 Cypress CY3640 USB Starter Kit User s Guide B Getting started Starting to use your Cypress USB thermometer is easy Just follow these simple steps 1 Insert the Cypress USB CD ROM The Cypress CD ROM contains the Cypress USB Thermometer application and driver files you will need Place it in the CD ROM drive you use to install your software Run SETUP EXE from the CD ROM This will install the Cypress USB Thermometer Windows applicati
53. sockets for development of logic and functionality on the board USB Vbus Vcc and Vss connections We have provided locations for connecting power and ground from the USB to your bread board area These locations will accept wire wrap pins External Vcc connections If you need to power your breadboard with an external supply a connector site P1 is supplied for that purpose Two capacitor locations are also provided adjacent to the connector for bypass C6 is a bulk bypass and C7 is for high frequency These capacitors are not populated with the CY3640 as shipped and you should use components appropriate to your needs The External Vcc supply is brought to the bread board area and connected to three locations labeled oddly enough Ext Vcc You may insert wire wrap pins in these locations to route to your breadboard area The temperature sensor U2 The temperature sensor device is socketed so it can be removed if you need to use the associated pins on the Cypress USB Controller for other logic on your breadboard Ferrite bead locations If noise is a problem in your environment locations for two ferrite beads FB1 and FB2 have been provided one for the Vcc supply from the USB and one for the Ground return to the Cypress Semiconductor Ver 0 993 Page 11 Cypress CY3640 USB Starter Kit User s Guide USB These beads should not be necessarily and are provided for exceptional noisy environments The locations are shorted by
54. st on end point zero devnote Runs in interrupt disabled context eR Se DI DE OO Oe OEE Or CO pee eR oer Or Cr ee ron ac USBEventEPOVendorRqst Save it push x Check Protocol mov a USBEndPOFIFO_1 USBEventEPOVendorRqstPing cmp a 0h jnz USBEventEPOVendorRqstReadROM No kk ck kk e e ke e e e Se e e ke e e e e ke ke ke e ke e ke KK KK KK S KK KK KK RARA Ping Event RAKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK jmp USBEventEPOVendorRqstFinish USBEventEPOVendorRqstReadROM cmp a 0lh jnz USBEventEPOVendorRqstReadRAM No A A A A A A A Read ROM Event ELSE LE ER mov a USBEndPOFIFO_2 index USBSendROMBufferBase mov USBEndPOFIFO_1 a jmp USBEventEPOVendorRqstFinish USBEventEPOVendorRqstReadRAM cmp a 02h jnz USBEventEPOVendorRqstWriteRAM No RRA EA AREA CHARA CARE AAA AREAL AL AR ALAA AS RA AEA Read RAM Event EA AA EA AT AA AAA ARN RASA RGA AGA A ON AM AA AA AA AR HGR AH A Cypress Semiconductor Ver 0 993 Page 32 Cypress CY3640 USB Starter Kit User s Guide mov a USBEndPOFIFO_2 push a pop x mov a x 0 mov USBEndPOFIFO 1 a jmp USBEventEPOVendorRqstFinish USBEventEPOVendorRqstWriteRAM cmp a 3 jnz USBEventEPOVendorRqstReadPort No PERAK Write CALAR RAM Event EEA E E A ne a USBEndPOFIFO 2 mov push pop mov mov jmp a x a USBEndPOFIFO 4 x 0 a USBEventEPOVendorRqstFinish USBEventEPOVendorRqstReadPort cmp jn
55. t and loops waiting for Setups which ultimately will the result in the device being enumerated Once the device has been enumerated on the USB the main loop waits 10ms polls the thermometer updates the LED and initializes end point 1 if appropriate USB Endpoint 0 is used to support Control Transfers and vendor specific requests End point 1 is also available for interrupt requests handling small packets of data good for mouse joystick keyboard thermometer etc However it is not used in this code Each control transfer interrupts the processor and the subsequent routines services it Thermometer A simple 9 bit temperature value is read from the thermometer every 10ms At startup the thermometer is initialized and placed into a continuous mode storing internally the current temperature Thereafter the temperature is read synchronously and returned into the USB end point one FIFO buffer LED The LED is controlled by P13 When P13 goes low the LED is turned on The LED indicates the status of the USB connection Once this device has logically been enumerated and configured to run on the serial bus the LED is illuminated The LED supports adjusting the brightness intensity by first setting the new brightens value default FFh High and then setting the brightness update field Button A momentary push button is used to indicate that the application s Celsius Fahrenheit display mode should be toggled With each GetTemperatu
56. te whether the Thermometer application is connected to the Cypress USB Thermometer device through the device driver If it is the Check For Device button will be disabled Changing the brightness of the Enumerated LED on the Cypress USB Thermometer device The brightness of the Enumeration LED on the Cypress USB Thermometer PC board may be set to one of sixteen levels The user can set the brightness level desired on the USB Options screen by changing the value of the LED Brightness box See Figure C3 This screen is available by clicking the USB Options button on the Options screen The values may be set from zero to fifteen with zero being the lowest setting Saving the current configuration of the Thermometer application The user can choose to automatically save the current configuration of the Thermometer application when they exit the program by checking the Remember Settings box The parameters saved include e Location on the desktop where the application screen will reside e User Name text e Centigrade or Fahrenheit mode e Temperature history or conventional thermometer display selection e Maximum and Minimum displayed temperature e Temperature sample rate e Simulate temperature selection status Cypress Semiconductor Ver 0 993 Page 9 Cypress CY3640 USB Starter Kit User s Guide E About the Cypress CY3640 USB Starter Kit Overview The Cypress CY3640 USB Starter Kit includes a fully functional USB thermo
57. tion to this problem There are two possible work arounds Once the system is up and running either 1 Press the Refresh button under the Device Manager please see previous bullet Or 2 Hot unplug replug the USB thermometer device The driver will automatically reload Cypress Semiconductor Ver 0 993 Page 52 Cypress CY3640 USB Starter Kit User s Guide Links to Other USB Documents Datasheets CY3650 CY3651 CY7C63000 63001 CY7C63100 63101 CY7C63200 63201 CY7C63410 63411 CY7C63412 63413 CY7C63510 63511 CY7C63512 63513 CY7C64011 64012 64013 CY7C64111 64112 64113 CY7C65013 65113 CY7C66011 66012 66013 CY7C66111 66112 66113 Application Notes USB Developer s Kit Universal Serial Bus Microcontroller Universal Serial Bus Microcontroller Universal Serial Bus Microcontroller Low Speed High I O 1 5 Mbps USB Controller Low Speed High I O 1 5 Mbps USB Controller Low Speed High I O 1 5 Mbps USB Controller Low Speed High I O 1 5 Mbps USB Controller High Speed USB 12 Mbps Peripheral Controller High Speed USB 12 Mbps Peripheral Controller 4 8 Downstream Port USB Hub High Speed USB 12 Mbps Controller with Hub High Speed USB 12 Mbps Controller with Hub Designing a Low Cost USB Mouse with the Cypress Semiconductor CY7C63000 USB Controller Designing a Low Cost Analog USB Joystick with the Cypress CY7C63200 USB Microcontroller USB Specification USB Specification Cypress Semiconductor Ver 0 993 Page 53
58. upports the USB In order to use the USB with the Windows operating system you need to have OSR2 1 ora more recent version of Windows such as Memphis Windows98 currently in Beta test You may determine the version of Windows you have through the System Properties Information to help you determine which version of the Windows operating system you have is also available from Microsoft http www microsoft com kb articles q 158 2 38 htm Identifying your operating system as OSR2 0 OSR2 1 or Memphis ORS 2 0 is Windows 95 version 4 00 950b OSR 2 1 is Windows 95 version 4 00 950b with the USB supplement installed Memphis is Windows 98 version 4 10 1423 or later System Properties The version of Windows you have installed can be found by clicking on the System icon in the Control Panel See Figure K1 and Figure K2 Bie Edit View Go Favorites Help il S Add New Date Time Hardware P a P nd Game Keyboard Controllers Multimedia Passwords Management Regional Telephony Settings 11 object s selected Provides system information ar Figure Ki Windows 95 Control Panel Cypress Semiconductor Ver 0 993 Page 50 Cypress CY3640 USB Starter Kit User s Guide Windows Version System Properties i Device Manager Hardware Profiles Performan e System Microsoft Memphis 4 10 1546 Beta 2 IE 4 0 4 71 1008 3 Registered to Marc Reinig System Solutions 2425420002000 78050 Comp
59. uter Genuinelntel Pentium r Processor 16 0MB RAM Figure K2 Windows System Properties You can determine whether the USB supplement has been installed by using the Add Remove Programs application which is also found on the control panel If the USB supplement is successfully installed you should be able to find it in the list of software that can be added or deleted from the Install Uninstall option within the Add Remove Programs screen e Problem with system stability when a crystal is used with the Cypress CY7C63X0X family of USB controllers For system stability considerations we highly recommend the use of ceramic resonator instead of crystal for the Cypress CY7C63X0X USB controllers Crystals do not satisfy the startup and suspend resume stability requirements of the CY7C63X0X USB controllers Cypress Semiconductor Ver 0 993 Page 51 Cypress CY3640 USB Starter Kit User s Guide e Memphis Windows98 Beta X is still a beta program Because Memphis is still changing as it moves through its prerelease phase releases subsequent to Beta 1 may not work well with the current product If this occurs Cypress will post new information assembly code drivers or Windows applications as appropriate e Windows may ask for a USB device driver even if you have previously loaded it If you attach a USB device to a USB host port to which you have not previously attached the device Windows may ask for the USB device dr
60. we counting down a button debounce mov a 0 cmp a gbButtonDebounce jz STimerNoDebounce Not debouncing branch Yes we re debouncing Let s see if we are timed out dec gbButtonDebounce mov a 0 cmp a gbButtonDebounce has debounce timed out jnz STimerNoDebounce No still debouncing branch The debounce timer has timed out Check if the button pin is at a 1 If not the button is either still bouncing or still pushed iord SysPortl check the port the button is on and a Button_Pin check the pin jnz STimerDebounceOver branch if it is not pushed mrr Reset debounce since the button is not yet released or is bouncing mov a 100 mov gbButtonDebounce a jnz STimerNoDebounce continue waiting for debounce to end STimerDebounceOver it s really ready Toggle the button state flag to let the Windows app know that H the button has been pushed mov azi xor gbButtonPushed a Debounce must be over STimerNoDebounce Enable interrupts and return mov a gbSysInterruptMask Cypress Semiconductor Ver 0 993 Page 22 Cypress CY3640 USB Starter Kit User s Guide ipret SysInterrupt SPAGE RE RA IAA RRA KOR BARR o e ko IR RGR ROR RA IR RR RGN ROR IER BER Ropa a RR AR SysGPIOEvent func General purpose port event comm Which pin F s ee ee ia el a ee SysGPIOEvent Save accumulator push a Reset debounce any time we are here mov a 100 mov gbButtonDebounce a SysGP
61. x mov a USBRqstWordValueLo USBEventEPOSetupGetDescriptorStringO0 cmp a 0h jnz USBEventEPOSetupGetDescriptorStringl A A A A A I IG RAS RR ARMS Get String Language s Descriptor Event POLO OT MI Ch ee OO Descriptor pointer No No mov a USBStringLanguageDescription USBSendROMBufferBase mov gbUSBSendBuffer a Descriptor size mov a 4h USBStringLanguag mov gbUSBSendBytes a Check request size field call USBSendDescriptorCheckLength Send buffer call USBSendROMBuffer jmp USBEventEPOEnd USBEventEP0SetupGetDescriptorStringl cmp a l jnz USBEventEPOSetupGetDescriptorString2 E ERRATA DP DP RC KO AER ALAR UXOR OO CERA RAR Get String 1 Descriptor Event EEA AA RD A UK OR AA Wo ob A oe RAR AREA ACH AB AUG ooo AO OROSIUS Cypress Semiconductor Ver 0 993 Page 27 eDescription No Cypress CY3640 USB Starter Kit User s Guide Descriptor pointer mov a USBStringDescriptionl USBSendROMBufferBase mov gbUSBSendBuffer a Descriptor size mov a 10h USBStringDescriptionl mov gbUSBSendBytes a Check request size field call USBSendDescriptorCheckLength Send buffer call USBSendROMBuffer jmp USBEventEPOEnd USBEventEP0SetupGetDescriptorString2 cmp a 2 jnz USBEventEPOSetupGetDescriptorString3 No A ACR Tea Ak ae TR TR DR N Get String 2 Descriptor Event fo RA AORN RTI ROR RAK A UWA KAWA A AR AMAA SAR OC A Descriptor pointer mov a USBStr
62. z a 04h USBEvent PE Fe RS TN UTR DO e EPOVendorRqastWritePort No kk ck ck kk Sk kk Sk kk ke Sk e ke Sk Sk S S Sk RARA Read Port Event EBSA DAA AA RA AS KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK mov a USBEndPOFIFO_2 cmp a 0h jnz USBEventEPOVendorRqstReadPortl USBEventEPOVendorRqstReadPort0 iord SysPort0 jmp USBEventEPOVendorRqstReadPortsDone USBEventEPOVendorRgqstReadPortl iord SysPortl jmp USBEventEPOVendorRqstReadPortsDone redundant but good practice USBEventEPOVendorRqstReadPortsDone mov USBEndPOFIFO 1 a jmp USBEventEPOVendorRqstFinish USBEventEPOVendorRqstWritePort cmp a 05h jnz USBEventEPOStall No Hd kc erie Write Port ION mov cmp jnz a USBEn a 0 USBEvent USBEventEPOVend mov iowr jmp a USBEn SysPort0 USBEvent USBEventEPOVend mov iowr jmp a USBEn SysPortl USBEvent USBEventEPOVend jmp USBEvent USBEventEPOVend RAKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK Event RAKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK dPOFIFO_2 7 EP0VendorRgstReadPort1 orRqstWritePort0 dPOFIFO 4 EPOVendorRqstWritePortsDone orRqstWritePortl dPOFIFO 4 EPOVendorRqstWritePortsDone redundant but good practice orRqstWritePortsDone EPOVendorRqstFinish redundant but good practice orRqstFinish Protocol ACK Cypress Semiconductor Ver 0 993 Page 33 mov mov Cypress CY3640 USB Starter

Download Pdf Manuals

image

Related Search

Related Contents

ダウンロード版  Web Portal Manual  Vigo VG15373 Installation Guide  Estudo, Projeto e - Universidade Federal de Minas Gerais  Zanussi ZRT 344 FX  TABLE DES MATIÈRES  Documentation technique  Quel cinéma voulons-nous pour les 25 ans à venir    manual - Durham Electronics  

Copyright © All rights reserved.
Failed to retrieve file