Home
Rabbit 4000 Microprocessor Designer`s Handbook
Contents
1. Rabbit 40000 Microprocessor Designer s Handbook 019 0156 e 060901 C The latest revision of this manual is available on the Rabbit Semiconductor Web site www rabbit com for free unregistered download ta Rabbit 4000 Microprocessor Designer s Handbook Part Number 019 0156 e 060901 C Printed in U S A 2006 Rabbit Semiconductor Inc e All rights reserved No part of the contents of this manual may be reproduced or transmitted in any form or by any means without the express written permission of Rabbit Semiconductor Permission is granted to make one or more copies as long as the copyright page contained therein is included These copies of the manuals may not be let or sold for any reason without the express written permission of Rabbit Semiconductor Rabbit Semiconductor reserves the right to make changes and improvements to its products without providing notice Trademarks Rabbit and Dynamic C are registered trademarks of Rabbit Semiconductor Semiconductor Chapter E TE 1 1 1 Summary of Design Conventions neseser ee ee RA GR nri nn tr GR EH ES Re Gee GE Re ee ee ee ee ee AR Re GR ee 1 Chapter 2 Rabbit Hardware Design Overview se ee ee Ge ee ee AA ee ee ee 3 Dil BES AS EE 3 2 1 1 Rabbit Programming Connect 4 2 12 Memory GAS e a Ee ke Ge ee E AE 4 2153 Oscillator Cry ER EE OE ja OE EE OE fn 4 2 2 Operating VOMA SES EE AE va ER EE N tabita ER 5 2 9 POW EF CONSUM le EE ET EE EE AE MEE fa
2. ss se ee Re GR Re RA Re RA 21 Tle System ID N dk ie APIE EE N NO N ER EE TE 22 1 1 1 Definitionof SysIDBloek Li iii i pv Ge ke EE Spes Ge bee he fee 22 7 1 2 Reading the System ID Block 000 se ee ee Re ee Re RA ee GR AA anni RR ee ee GR ee Re RA ee 24 7 1 2 1 Determining the Existence of the System ID Block mm ee Re ee ee GR Re ee ee ee 25 7 1 3 Writing the System ID Block 27 1 2 User Block De tails ER AE a RE OR ER NE RE N EN 27 PAR BOOt Block ISSUES RR RE OE EO SEENEN OE 27 7 42 Reserved Flash Space ea ees seed ese eed ep N see sees toe b een De Se ee Es ee Ge ea ees Gees ee Ee 28 7 2 3 Reading the User Bloek ii EER Geist GE RS EER selva E E ava cag tag ees REED ER GES Ge Ee ed GE Sep nes 29 724 Writing the User BOCK eis ia sers Ee SE Eg Eko Ge Se Ee Hades ek eds Ee eege an Ee Re hekel Ee Ra 31 Rabbit 4000 Designer s Handbook rabbit com iii Chapter 8 BIOS Support for Program Clonng esse se se ee ee GR ee ee RA GR Re ee ee ee 33 AE Overview oft Cloning seese eion na a a OE IE 33 8 2 Creating a Clone RR ET EER OE N EE EE 34 8 2 1 Steps to Enable and Set Up Cloning nn ek ee ee ee ee nn Ge Re nr nr nn tan ee ge ee ee 34 8 2 2 Steps to Perform ol ed GT RE EE OE EE BPL 34 8 2 3 LED UGO EE OO EE ER OE N 34 8 3 Cloning QUESTIONS RE EE a Fa an p a SI aa Sa E RENEE SEKE EE 35 8 3 1 MAG GE SERE EE EE AE EE OE SS 35 8 3 2 Different Flash Mb Ys LE ER OO 35 8 3 3 Different Memory SIZES ER AO OE OE N EE OE
3. SIAE 4 Size of System ID block in bytes 1 X 10h SIZE l och H Size of User block in bytes 1 X SIZE 5 Offset in bytes of User block location from start 1 OAh of this block S SIZE 5 CRC value of System ID block when this field 1 e 08h 0000h SIZE 06h 6 Marker should 55h AAh 55h AAh 55h AAh 1 X 26 rabbit com The System Identification and User Blocks 7 1 3 Writing the System ID Block The WriteFlash function does not allow writing to the System ID block If the System ID block needs to be rewritten a utility to do so is available for download from the Rabbit website www rabbitsemiconductor com downloads files Write idblock zip or contact Rabbit Semiconductor s Technical Support 7 2 User Block Details Starting with the System ID block version 3 two contiguous copies of the combined ID User blocks are used or in the case of the version 5 ID block two contiguous copies of the User block are used Only one image contains valid data at any time When data is written to a mirrored User block the currently invalid User block image is updated first and then validated by changing its marker 5 byte from 0x00 to OxAA This marker is located in the user block itself in version 5 ID blocks where the mirrored user blocks are separate from the Svstem ID Block and in version 5 and prior ID blocks where the User block and System ID blocks are combined the marker byte is located in the System ID Bl
4. a system will have two oscillator crystals e A 32 768 kHz crystal oscillator to drive the batterv backable timer e A crystal that has a frequency that is a multiple of 614 4 kHz or a multiple of 1 8432 MHz Typical val ues are 7 3728 11 0592 14 7456 22 1184 and 29 4912 MHz These crystal frequencies except 614 4 kHz and 1 8432 MHz allow generation of standard baud rates up to at least 115 200 bps The clock frequency can be doubled by an on chip clock doubler but the doubler should not be used to achieve frequencies higher than about 60 MHz on a 3 3 V system A quartz crystal should be used for the 32 768 kHz oscillator For the main oscillator a ceramic resonator that is accurate to 0 5 will usually be adequate and less expensive than a quartz crystal for lower frequencies 4 rabbit com Rabbit Hardware Design Overview 2 2 Operating Voltages The operating voltage in Rabbit 4000 based systems will usually be 1 8 V 10 for the processor core and 3 3 V 10 for the I O The VO ring can also be run at 1 8 V 10 The maximum computation per watt is obtained in the range of 3 0 V to 3 6 V The highest clock speed requires 3 3 V The maximum clock speed with a 3 3 V supplv is 54 MHz 26 7264 x 2 but it will usuallv be convenient to use a 14 7456 MHz crystal doubling the frequency to 29 4912 MHz Good computa tional performance but not the absolute maximum can be implemented for a 3 3 V system by using an 11 0592 crystal and doubl
5. Address offset in User block to read from numbytes Number of bytes to copy RETURN VALUE 0 Successful 1 Invalid address or range 2 No valid System ID block found LIBRARY IDBLOCK LIB Rabbit 4000 Designer s Handbook rabbit com 29 readUserBlockArrav int readUserBlockArray void dests unsigned numbytes int numdests unsigned addr DESCRIPTION Reads a number of bytes from the User block on the primary flash to a set of buffers in root memory This function is usually used as the inverse function of writeUserBlockArray This function was introduced in Dynamic C version 7 30 PARAMETERS dests Pointer to array of destinations to copy data to numbytes Array of numbers of bytes to be written to each destination numdests Number of destinations addr Address offset in User block to read from RETURN VALUE 0 Success 1 Invalid address or range 2 No valid System ID block found block version 3 or later LIBRARY IDBLOCK LIB 30 rabbit com The System Identification and User Blocks 7 2 4 Writing the User Block writeUserBlock int writeUserBlock unsigned addr void source unsigned numbytes DESCRIPTION Rabbit based boards are released with System ID blocks located on the primary flash Version 2 and later of this ID block has a pointer to a User block that can be used for storing calibration con stants passwords and other non volatile data This block is protected from normal writes
6. RAM having at least 128 KB to the Rabbit 4000 using CS1 OE1 and WE1 e Connect a flash memory that is on the approved list and has at least 128 KB of storage to the Rabbit 4000 using CSO OEO and WEO e Install a crystal oscillator with a frequency of 32 768 kHz to drive the battery backable clock Battery backing is optional but the clock is used in the cold boot sequence to generate a known baud rate of 2400 bps e Install a crystal or oscillator for the main processor clock that is a multiple of 614 4 kHz or better a multiple of 1 8432 MHz e Do not use pin PB1 in your design if cloning is to be used e Be sure unused inputs are not floating As shown in Figure 1 1 the Rabbit programming cable connects a PC serial port to the programming con nector of the target system Dynamic C or the Rabbit Field Utility RFU runs as an application on the PC and can cold boot the Rabbit 4000 based target system with no pre existing program installed in the target A USB to RS232 converter may also be used instead of a PC serial port Rabbit 4000 based targets may also be programmed and debugged remotely over a local network or even the Internet using a RabbitLink card Rabbit 4000 Designer s Handbook rabbit com 1 Figure 1 1 The Rabbit 4000 Microprocessor and Dynamic C PC Hosts Dynamic C Rappit Programming Rabbit Cable Microprocessor Level Conversion AS PC Serial Programming Port C
7. begin 8 2 3 LED Patterns While cloning is in progress the LED on the Cloning board will toggle on and off every 1 1 5 seconds When cloning completes the LED stays on If any error occurs the LED will start blinking guickly Older versions of cloning used different LED patterns but the Rabbit 4000 is only supported by versions that use the pattern described here 22 rabbit com BIOS Support for Program Cloning 8 3 Cloning Questions The following subsections answer questions about different aspects of cloning 8 3 1 MAC Address Some Ethernet enabled boards do not have the EEPROM with the MAC address These boards can still be used as a clone because the MAC address is in the svstem ID block and this structure is shipped on the board and is not overwritten bv cloning unless CL INCLUDE ID BLOCKS is set to one If vou have a custom designed board that does not have the EEPROM or the svstem ID block vou mav download a program at http www rabbit com support feature downloads html to write the svstem ID block which contains the MAC address to vour board To purchase a MAC address go to http standards ieee org regauth oui index shtml 8 3 2 Different Flash Types Since the BIOS supports a variety of flash types the flash EPROM on the two controllers do not have to be identical Cloning works between master and clone controllers that have different type flash chips because the master copies its own universal flash driver to th
8. cable with an active circuit board in its middle The circuit board converts RS 232 voltage levels used bv the PC serial port to CMOS voltage levels used bv the Rabbit 4000 The level converter is powered from the power supplv voltage present on the Rabbit 4000 program ming connector Plugging the programming cable into the Rabbit programming connector results in pull ing the Rabbit 4000 SMODEO and SMODEI startup mode lines high This causes the Rabbit 4000 to enter the cold boot mode after reset Rabbit 4000 Designer s Handbook rabbit com 13 When the programming cable connects a PC serial port to the target controller board the PC running Dynamic C is connected to the Rabbit 4000 as shown in the table below Table 4 1 Programming Port Connections PC Serial Port Signal Rabbit 4000 Signal DTR output RESET input reset system DSR input ie general purpose TX serial output RXA serial input port A RX serial input TXA serial output port A When Dynamic C cold boots the Rabbit 4000 based target system it assumes that no program is already installed on the target The flash memory on the target system may be blank or it may contain any data The cold boot capability permits the use of soldered in flash memory on the target Soldered in memory eliminates sockets boot blocks and PROM programming devices 4 1 How the Cold Boot Mode Works In Detail Cold boot works by receiving triplets of bytes that c
9. filled each field and whether that field is absolutely required by Dynamic C for normal operation Much of the ID block data is useful but not critical Table 7 1 The System ID Block Otrser from ste S Filled as start of bytes Description of Version Required block 00h 2 ID block version number 1 X 02h 2 Product ID 1 X 04h 2 Vendor ID 2 06h 7 Timestamp Y Y MM D H M S 1 ODh 4 Flash ID 2 lih 2 Flash size in 1000h pages 2 13h 2 Flash sector size in bvtes 2 15h 2 Number of sectors in flash 2 17h 2 Flash access time nanoseconds 4 19h 4 Flash ID 2nd flash 2 1Dh 2 Flash size in 1000h pages 2nd flash 2 1Fh 2 Flash sector size 2nd flash in bvtes 2 Rabbit 4000 Designer s Handbook rabbit com 25 Table 7 1 The System ID Block Continued Offsetfrom A Size see Filled as start of Description S Required bvtes of Version block 21h 2 Number of sectors in 2nd flash 2 23h 2 Flash access time in nanoseconds for the 2nd 4 flash 25h 4 RAM ID 2 29h 2 RAM size in 1000h pages 2 2Bh 2 RAM access time in nanoseconds 4 2Dh 2 CPU ID 3 2Fh 4 Crystal frequency Hertz 2 33h 6 Media Access Control MAC address 1 x 39h 24 Serial number as a null terminated string 51h 30 Product name as a null terminated string Version 5 System ID block member structure a 27 SysIDBlockType2 a 8Ah N Reserved variable size
10. of 19200 The divisor is stored at address 0x3FO2 for later use by the BIOS and the programming port is set to 57600 baud 5 The PC now bumps the baud rate on the serial port being used to 57600 baud Rabbit 4000 Designer s Handbook rabbit com 15 6 The initial loader then reads 7 bytes from the serial port First a 4 byte address field the physical address to place the secondary loader followed by a 2 byte length field the number of bytes in the sec ondary loader The 7th byte is a checksum simple summation of the previous 6 bytes Whether or not the checksum matched it is echoed back as an acknowledgement 7 The data segment is then mapped to the given physical location using the DATASEG register The data segment boundary will also be set to 0x6000 so the secondary loader will always be located at the same place in logical space regardless of where it physically resides 8 The initial loader finally enters a loop where it receives the specified number of bytes that compose the secondary loader program pilot bin sent by the PC and writes those bytes starting at 0x6000 logical The first byte sent this way MUST be OxCC as an indicator to the initial loader This byte will be stored as 0x00 nop instead of OxCC A 2 byte checksum will be sent after the secondary loader has been received using the 8 bit Fletcher Algorithm see RFC1145 for details such that the load can be verified After all of the bytes are received a
11. rad 5 24 Through Hole Technologies be EES ee oe EE Dee deg Ee Ge GREG p a REG Gees ed EG ER Dek ER EEN 6 2 29 Moisture a RE RE AE OE BI OE HE HE AE 6 Chapter 3 Core Design and rip Mer Lit 7 Del STT 7 3 2 Floating ie ER Ee EE E Ghee nih aa RE ae a als 8 3 3 Basic Memory DESID EES ese Ee ne De e Ge EG oe ee bee ee Ge ese sege ED We A gee eee ie 9 3 3 1 Memory ACCESS Time ii Ee SE EE SE es ERGE be Ge ERG GEGEE DR Ge GER ees DEE Sek EE Ge SE GE GEED ap 10 3 3 2 Interfacing External I O with Rabbit 4000 Designs esse see ce se ee ee ee ee ee Re Ge ee RA Re 10 3 4 PC Board Layout and Memory Line Permutation 0 esse ee ee ee GR ee ee ee Re ee ee ee Re RA ee 11 3 5 PC Board Layout and Electromagnetic Interference sms ee ee ee Re Ge RARR GR AR Re Re ee Re ee ee Re ee 11 3 5 1 Rabbit 4000 Low EMI Features disseron bene pit idi BB canes Sand seed ct enge KEES ee se Reed byge eie eed o eie ge Ese Kees 1 Chapter 4 How Dynamic C Cold Boots the Target System 13 4 1 How the Cold Boot Mode Works In Deal 14 4 2 Program Loading Process Chemie sees dee seke dee G SES See Be RS sk ese se Be se ek eksiris rini ee Ee Ak Pe bee see hoek De 15 4 2 1 Program Loading Process Details nn ne RA nn GR AR Re nn 15 Chapter 5 Rabbit Memory Organization Ses ee see Re ERG Ee kast a kapa rag ee Eed Ge 17 Chapter 6 Th Rabbit BIOS asses ske Ak oes n here egen eege Deeg kamar isa ees 19 Chapter 7 The System Identification and User Blocks
12. sector size flash For example some flash types have a single sector as big as 128K bytes at the bottom Writing to any part of the sector generally requires erasing the whole sector so a write to store data in that sector would have to save the contents of the whole sector in RAM modify the section to be changed and write the whole sector back This is obviously impractical Although Rabbit Semiconductor don t currently sell products with this type of flash there is no guarantee that future flash market conditions won t require that such flash types be used Other board designers may have to deal with the same flash market issues The User block is implemented in a way that preserves forward binary compatibility with a wide range of flash devices Rabbit 4000 Designer s Handbook rabbit com 21 7 1 System ID Block Details The BIOS will read the System ID block during startup If the BIOS does not find an ID block it sets all fields to zero in the data structure SysIDBlock The user may access the information contained in the System ID block by accessing SysIDBlock 7 1 1 Definition of SysIDBlock The following global data structures are defined in IDBLOCK LIB and are loaded from the flash device during BIOS startup Users can access this struct in RAM if they need information from it The reserved field will expand and or shrink to compensate for the change in size Items marked are essential for proper functioning of t
13. single I O instruction by using code such as push ip Save interrupt state ipset 3 interrupts off ioe ld a hl typical VO instruction pop ip reenable interrupts NOTE Short chip selects and self timed chip selects only take place during memory reads During writes the chip selects behave normally For a detailed description of the chip select features please see the Rabbit 4000 Microprocessor User s Manual 26 rabbit com Low Power Design and Support 9 1 2 Reducing Clock Speed It is important to know that the lowest speed crystal will not always give the lowest power consumption This is because when the crystal is divided internally the short chip select option can be used to reduce the chip select duty cycle of the flash memory or fast RAM greatly reducing the static current consumption associated with some memories Some applications such as a control loop may require a continuous amount of computational power Other applications such as slow data logging or a portable test instrument may spend long periods with low computational requirements interspersed with short periods of high computational load At a given operating voltage the clock speed should be reduced as much as possible to obtain the minimum power consumption that is acceptable 9 1 3 Preferred Crystal Configuration The preferred configuration for a Rabbit 4000 based system is to use an external crystal or resonator that has a frequency 1 the maxim
14. with enough desiccant to main tain their contents below 20 relative humidity for up to 12 months from the date of seal A reversible Humidity Indicator Card is enclosed to monitor the internal humidity level The loaded bag is then sealed under a partial vacuum The caution label IPC JEDEC J STD 020 LEVEL 3 included with each bag out lines storage handling and bake requirements The requirements outlined on the label only apply to components that will be exposed to SMT processing This means that completed board level products that will not be subjected to the solder reflow processing do not have to be baked or sealed in special moisture barrier bags 6 rabbit com Rabbit Hardware Design Overview Semiconductor 3 Core Design and Components Core designs can be developed around the Rabbit 4000 microprocessor A core design includes memorv the microprocessor oscillator crystals the Rabbit 4000 standard programming port and in some cases a power controller and power supplv Although modern designs usuallv use at least four laver printed circuit boards two sided boards are a viable option with the Rabbit 4000 especiallv if the clock speed is not high and the I O is intended to operate at 3 3 V factors that reduce edge speed and electromagnetic radiation Schematics illustrating the use of the Rabbit 4000 microprocessor are available online via links in the man uals for the products that are using the Rabbit 4000 Each board lev
15. writeMode 1 and byte writing mode as used by the Mosel Vitelic V29 series FlashInfo writeMode 2 Large and or nonuniform sector flash with byte writing mode as used by the AMD AM29F00X series have Flashinfo writeMode gt 0x10 The writ eMode value is the Sector Data table entry with the sector map that is appropriate for the flash New flash devices may require new writeMode and SectorData table entries to be defined At the time of this writing the defined values for _FlashInfo writeMode are documented in Table 10 1 All other values of the writ eMode field 44 rabbit com Supported Flash Memories are currently undefined although they may be defined by Rabbit Semiconductor as new flash devices are used Table 10 1 Defined Flash Write Modes vame ol Description _Flashinfo writeMode p 1 For small sector sector erase 0x30 byte write 2 For small sector sector write 3 For small page page erase 0x50 bvte write 4 For small sector sector erase 0x20 byte write gt Ox10 For large sector sector erase 0x30 byte write 10 2 2 Flash Driver Functions This section describes InitFlashDriver and WriteFlash the two functions that must be rewritten if you are writing your own flash driver Replace these two functions in the library that imple ments the Rabbit flash driver FLASHWR LIB _InitFlashDriver This function is called from the BIOS A bitmap of quadrants map
16. 2 Send the following seguence of triplets 80 OE 20 sets status pin low 80 OE 30 sets status pin high 80 OE 20 sets status pin low again 3 Wait for approximately 4 second and then repeat starting at step 1 While the test is running an oscilloscope can be used to observe the results The scope can be triggered bv the reset line going high It should be possible to observe the data characters being transmitted on the RXA pin of the processor or the programming connector The status pin can also be observed at the processor or programming connector Each byte transmitted has 8 data bits preceded by a start bit which is low and fol lowed by a stop bit which is high viewed at the processor or programming connector The data bits are high for 1 and low for 0 The cold boot mode and the triplets sent are described in Section 4 1 on page 14 Each triplet consists of a 2 byte address and a 1 byte data value The data value is stored in the address specified The uppermost bit of the 16 bit address is set to one to specify an internal I O write The remaining 15 bits specify the address If the write is to memory then the uppermost bit must be zero and the write must be to the first 32 KB of the memory space The user should see the 9 bytes transmitted at 2400 bps or 416 us per bit The status bit will initially toggle fairly rapidly during the transmission of the first triplet because the default setting of the status bit is to go low on the f
17. 7 41 20 6 14 7456 191 47 23 7 3 1 0 16 5888 215 53 26 8 18 4320 239 59 29 9 4 20 2752 b 65 32 10 22 1184 G 71 35 11 5 2 23 9616 S 71 38 12 25 8048 83 41 13 6 27 6480 89 44 14 29 4912 95 47 15 7 3 1 36 8640 119 59 19 9 4 44 2368 H 143 71 23 11 5 2 51 6096 k 167 83 27 13 6 58 9824 ki 191 95 31 15 7 3 Baud rate is not available at given frequency Baud rate is availabe with further BIOS modification Rabbit 4000 Designer s Handbook rabbit com The default eguation for the divisor is inr _ CPU frequency in Hz eee 32 x baud rate l If the divisor is not an integer value that baud rate is not available for that frequency identified by a in the table If the divisor is above 255 that baud rate is not available without further BIOS modification identified by a in the table To allow that baud rate you need to clock the desired serial port via timer A1 by default they run off the peripheral clock 2 then scale down timer A to make the serial port divi sor fall below 256 Timer A can be clocked by the peripheral clock PCLK in addition to the default which is the peripheral clock 2 PCLK 2 Furthermore the asvnchronous serial port data rate can be 8x the clock in addition to the default of 16x the clock Therefore in addition to the equation above the following eguations may be used to find the asvnchronous divisor for a given clock freque
18. N ESE 35 8 34 D sign ie ele en EE EE ER EE OE AE 35 Chapter 9 Low Power Design and Support ss ke EG Ee GN ie ee see eee 37 9 1 Details of the Rabbit 4000 Low Power Features 38 9 1 1 Special Chip Select Featur 8 issie esse seks boei en tab EE Ee ee ke Ee SE EERE 38 0 1 2 Reducin Clock Speed AE EE EE N Ed EE EG 39 9 1 3 Preferred Crystal Configuration sens ennennnnen inn Gee nn Ge RA GR GR Re SR ee Ge ee ee ee ee ee ee 39 9 2 To Further Decrease Power Consaumption cece see see se ee Se Se ee ee Ge ee Gee RA nn GRA GR SR Re Re ee ee ee ee 40 9 2 1 What To Do When There is Nothing To Do 40 KE EE IE ENE RE OE EE e 40 9 2 3 External 32 KZ Oscillator N EE EE NE RE EE OE E 41 9 2 4 Conformal Coating of 32 768 kHz Oscillator Circuit ese ese see se Ge ee ER RR Re Re Re ee ee ee ee 41 9 2 5 Software Support for Sleepy Mode 41 92 6 Baud Rates in Sleepy Mode iss GARDE Ee sth Ge EER DE ees Ee ER Gegee ee N Ee Ges Re eb bees Re GED eg oe Ee es Oe eed 42 9 2 7 Debugging YAN a Fis Sa cases EE EE OR N 42 Chapter 10 Supported Flash Memories eggergieng egreeee degen dd 43 10 1 Supporting Other Flash Devices ss ee ee ee ee Ge ee ee Re nn n nn Ge nn nn rna ee ee ee ee RA tn nt 43 10 2 Writing Your Own Flash Driver ese esse ese es ee se ese see see See See ee Ge Be ee Be Ee Se Ee Ee de pen See sta see ee bee eed eg 44 10 2 1 Required Information for Flash Memor 44 10 2 2 Flash Driver FUNGHONS asses esel EERSTE
19. N Ee 45 Chapter 11 Troubleshooting Tips for New Rabbit Based Systems seen 47 PS RK Ee 47 11 2 Diagnostico JESUS 3s EE g OE ab ba EEE EE SEE 47 11 2 1 Program to Transmit Diagnostic Tests ees see ee see em e ee ee ee Ge Ge RA GR RA GR Re Re ee ee ee ee 47 11 2 2 Diagnostic Test 1 Toggle the Status Dm 49 11 22 1 Using seriallOsexe ii ii Ge ER EE PD e b EG Bee DY Ge eed eed 49 11 2 3 Dia nosti Test RR EE AE EE EE OE EE 50 Appendix A Supported Rabbit 4000 Baud Rates 2 0 eee se ee se ee ee AR Re ee ee ed ee 53 Notice RRE 55 dek EE EE OE EE N N N EE EE EE 57 iv rabbit com Table of Contents Semiconductor 1 Introduction This manual is intended for the engineer designing a svstem using the Rabbit 4000 microprocessor and Rabbit s Dvnamic C development environment It explains how to develop a svstem that is based on the Rabbit 4000 and can be programmed with Dvnamic C With Rabbit 4000 microprocessors and Dynamic C many traditional tools and concepts are obsolete Complicated and fragile in circuit emulators are unnecessarv EPROM burners are not needed Rabbit 4000 microprocessors and Dvnamic C work together without elaborate hardware aids provided that the designer observes certain design conventions For all topics covered in this manual further information is available in the Rabbit 4000 Microprocessor User s Manual 1 1 Summary of Design Conventions e Include a programming connector e Connect a static
20. a frequency of 32 768 kHz to drive the battery backable real time clock RTC the watchdog timer WDT and the Periodic Interrupt e Install a crystal or oscillator for the main processor clock that is a multiple of 614 4 kHz or better a multiple of 1 8432 MHz These preferred clock frequencies make possible the generation of standard serial baud rates Common crystal frequencies to use are 7 3728 MHz 11 0592 MHz 14 7456 MHz 22 1184 MHz 29 4912 MHz or double these frequencies NOTE The internal clock doubler can double these oscillations for a higher operating fre quency e Digital I O line PB1 should not be used in the design if cloning is to be used PB1 should be pulled up with 50K or so pull up resistor if cloning is used See BIOS Support for Program Cloning on page 21 for more information on cloning Rabbit 4000 Designer s Handbook rabbit com 3 2 1 1 Rabbit Programming Connector The user mav be concerned that the requirement for a programming connector places added cost overhead on the design The overhead is verv small less than 0 25 for components and board space that could be eliminated if the programming connector were not made a part of the system The programming connector can also be used for a varietv of other purposes including user applications A device attached to the programming connector has complete control over the svstem because it can per form a hardware reset and load new software If this deg
21. ame time To avoid excessive power consumption floating inputs should not be included in a design except that some inputs may float briefly during power on sequencing Most unused inputs on the Rabbit 4000 can be made into outputs by proper software initialization to remove the floating property Pull up resistors will be needed on a few inputs that cannot be programmed as outputs An alter native to a pull up resistor is to tie an unused output to the unused inputs If pull up or pull down resis tors are required they should be made as large as possible if the circuit in question has a substantial part of its duty cycle with current flowing through the resistor 8 rabbit com Core Design and Components 3 3 Basic Memory Design Normally CSO and OEO and WEO should be connected to a flash memory that holds the startup code that executes at address zero When the processor exits reset with SMODE1 SMODEO set to 0 0 it will attempt to start executing instructions at the start of the memory connected to CSO OEO and WEO For Dynamic C to work out of the box the basic RAM memory must be connected to CS1 OE1 and WEI ICSI has a special property that makes it the preferred chip select for battery backed RAM The BIOS defined macro CS1 ALWAYS ON may be redefined in the BIOS to 1 which will set a bit in the MMIDR register that forces CS1 to stay enabled low This capability can be used to counter a problem encoun tered when th
22. ary loader pilot BIOS to RAM at 57600 baud 3 Run the secondary loader and load the BIOS and user program to flash after compiling them to a file optionally negotiating with the Pilot BIOS to increase the baud rate to 115200 or higher so the loading can happen quickly 4 Run the BIOS Then run and debug the user program at the baud rate selected in Dynamic C NOTE Step 4 is combined with step 3 when using 4 K or greater sector flash 4 2 1 Program Loading Process Details When Dynamic C starts to compile a program the following sequence of events takes place 1 The serial port is opened at 2400 baud with the DTR line high and after a 500 ms delay the DTR line is lowered This pulses the reset line on the target low the programming cable inverts the DTR line placing the target into bootstrap mode 2 A group of triplets defined in the file COLDLOAD BIN consisting of 2 address bytes and a data byte are sent to the target The first few bytes sent are sent to I O addresses to set up the MMU and MIU and do system initialization The MMU is set up so that RAM is mapped to 0x00000 and flash is mapped to 0x80000 3 The remaining triplets place a small initial loader program at memory location 0x00000 The last triplet sent is 0x80 0x24 0x80 which tells the CPU to ignore the SMODE pins and start running code at address 0x00000 4 The initial loader measures the crystal speed to determine what divisor is needed to set a baud rate
23. bit of the high address byte first byte of a received triplet that is loaded to register D is set If bit 7 of the high address byte is set then the data byte last byte of the triplet is written to VO space when received If the bit is clear then the data byte gets written to memory Boot mode is terminated by storing 80h to I O register 24h which causes an instruction fetch to begin at address zero Wait states are automatically inserted during the fetching of bytes 3 5 and 7 to wait for the serial or paral lel port ready The wait states continue indefinitely until the serial port is ready This will cause the proces sor to be in the middle of an instruction fetch until the next character is ready While the processor is in this state the chip select but not the output enable will be enabled if the memory mapping registers are such as to normally enable the chip select for the boot ROM address The chip select will stay low for extended periods while the processor is waiting for the serial or parallel port data to be ready 4 2 Program Loading Process Overview On start up Dynamic C first uses the PC s DTR line on the serial port to assert the Rabbit 4000 RESET line and put the processor in cold boot mode Next Dynamic C uses a four stage process to load a user pro gram 1 Load an initial loader cold loader to RAM via triplets sent at 2400 baud from the PC to a target in cold boot mode 2 Run the initial loader and load a second
24. ck from the flash instead of getting the information from SysIDBlock call _readIDBlock _readIDBlock int readIDBlock int flash bitmap DESCRIPTION Attempts to read the system ID block from the highest flash quadrant and save it in the system ID block structure It performs a CRC check on the block to verify that the block is valid If an error occurs SysIDBlock tableVersion is set to zero Starting with Dynamic C version 8 this function supports combined System ID User blocks sizes of sizeof SysIDBlock and from 4KB to 64KB inclusive in 4KB steps Prior versions of DynamicC only supported mirrored combined block sizes of sizeof SysIDBlock 8KB 16KB and 24KB or unmirrored combined System ID User blocks sizes of sizeof SysID Block and from 4KB to 32KB inclusive in 4KB steps PARAMETER flash bitmap Bitmap of memory quadrants mapped to primary flash Examples 0x01 quadrant 0 only 0x03 quadrants 0 and 1 OxOC quadrants 2 and 3 RETURN VALUE 0 Successful 1 Error reading from flash 2 ID block missing 3 ID block invalid failed CRC check LIBRARY IDBLOCK LIB 24 rabbit com The System Identification and User Blocks 7 1 2 1 Determining the Existence of the System ID Block In Dynamic C versions prior to 7 20 and for ID block versions 1 and 2 the following sequence of events is used by readIDBlock to determine if an ID block is present 1 The 16 bytes at the top of the primary flash a
25. d If you do not need the User block and are not concerned with foward binary compatibility the MAX USERBLOCK SIZE macro value could be safely lowered protecting the sector containing the ID block to as little as 0x4000 16 KB but only if the Sys tem ID block is rewritten to set the User block size to zero i e no run time flash writes can occur such as to the User block or to a flash file system Reducing the MAX_USERBLOCK_SIZE macro value will only increase available xmem code space not root code space which is generally in shorter supply To increase available xmem code space the following general procedure should be followed 1 Determine that binary forward compatibility with large sector flash types as described above is not an issue This means that the application will only ever run on target boards equipped with small sector flash i e uniform sectors of a size no larger than 4 KB 2 Determine the application s minimum User block size requirement If the application does not write to the User block this size is zero 3 If the target board has factory calibration constants stored in the User block add the size reserved for these constants Consult your hardware manual for the reserved size required Add the size of the System ID block which is 132 bytes for versions 2 through 4 Round this total size up to the next higher 4 KB block boundary If using mirrored combined version 3 or 4 ID User blocks double the siz
26. d to a single target board or for multiple target boards the MAX USERBLOCK SIZE macro value defined in RabbitBios c must not be lower than the amount of flash reguired for the System ID User blocks on the target board with the largest reguirement Note that in the case of mirrored combined ID User blocks version 3 and up the amount of flash that must be reserved is double the size of one combined ID User block image For example if a target board has mir rored combined ID User blocks and the size of one image is 16 KB 0x4000 bytes then the minimum value defined for the MAX USERBLOCK SIZE macro is 32 KB 0x8000 bytes If the MAX USERBLOCK SIZE macro value is less than the actual size used for a target board s ID User blocks both Dvnamic C and the RFU will fail to load to flash the part of an application that extends into the ID User blocks area This is a limitation of the pilot BIOS to allow the RFU towrite alarge USE 2NDFLASH CODE bin file to a two flash board the pilot BIOS does the flash writing on behalf of both Dvnamic C and the RFU All of the default MAX USERBLOCK SIZE reserved space is not necessarily needed by the Svs tem ID and User blocks but reserving this much space maximizes forward binary compatibility should a product switch to any of various huge non uniform sector flash types Some of these types have sectors of 8 KB 8 KB and 16 KB at the top and the mirrored design of the User block reguires that these 3 sectors be use
27. ds the entire user program along with other user selected portions of flash memory to the clone where the boot program receives it and stores it in RAM then copies it to flash Optionally the cloned program can begin running on the slave For more details on cloning see Technical Note 207 Rabbit Cloning Board available at rabbit com Rabbit 4000 Designer s Handbook rabbit com 21 8 2 Creating a Clone Before cloning can occur the master controller must be readied Once this is done any number of clones may be created from the same master 8 2 1 Steps to Enable and Set Up Cloning The step by step instructions to enable and set up cloning on the master are in Technical Note 207 In brief the steps break down to attaching the programming cable running Dynamic C making any desired changes to the cloning macros and then compiling the BIOS and user program to the master The only cloning macro that must be changed is ENABLE CLONING since the default condition is that cloning is disabled 8 2 2 Steps to Perform Cloning Once cloning is enabled and set up on the master controller detach the programming cable and attach the cloning board to the master and the clone Make sure the master end of the cloning board is connected to the master controller the cloning board is not reversible and that pin 1 lines up correctly on both ends Once this is done reset the master by pressing Reset on the cloning board The cloning process will
28. e Calculate the number of 4 KB blocks required for the total size oN DN A Edit the write idblock c utility to set the required number of 4 KB blocks and write a new ID block onto the target board 9 Repeat the previous steps for every board which is to be programmed with the application s compiled using the updated MAX USERBLOCK SIZE macro value 28 rabbit com The System Identification and User Blocks 10 Edit the RabbitBios c file to update the MAX USERBLOCK SIZE macro value Note that it is especially difficult to effectively reduce the MAX USERBLOCK SIZE macro value below 0x4000 16 KB for the BL20xx or BL21xx board families which have their combined ID User blocks size hard coded in the FLASHWR LIB and IDBLOCK LIB libraries because their stored calibration constants are in a nonstandard place For this reason Rabbit strongly recom mends not attempting to make System ID User block changes on these board families 7 2 3 Reading the User Block readUserBlock int readUserBlock void dest unsigned addr unsigned numbytes DESCRIPTION Reads a number of bytes from the User block on the primary flash to a buffer in root memory NOTE portions of the User block may be used by the BIOS for your board to store values such as calibration constants See the manual for your particular board for more information before overwriting any part of the User block PARAMETERS dest Pointer to destination to copy data to addr
29. e chip select line is passed through a device that is used to place the chip in standby by rais ing CS1 when the power is switched over to battery backup The battery switchover device typically has a propagation delay that may be 20 ns or more This is enough to require the insertion of wait states for RAM access in some cases By forcing CS1 low the propagation delay is not a factor because the RAM will always be selected and will be controlled by OE1 and WE1 If this is done the RAM will consume more power while not battery backed than it would if it were run with dynamic chip select and a wait state If this special feature is used to speed up access time for battery backed RAM then no other memory chips should be connected to OE1 and WE1 Table 3 1 Typical Interface between the Rabbit 4000 and Memory Primary Flash SRAM Secondary Flash ICSO OEO and WEO CS1 OE1 and WE1 ICS2 OEO and WEO Rabbit 4000 Designer s Handbook rabbit com 9 3 3 1 Memory Access Time Memory access time depends on the clock speed and the capacitive loading of the address and data lines Wait states can be specified by programming to accommodate slow memories for a given clock speed Wait states should be avoided with memory that holds programs because there is a significant slowing of the execution speed Wait states are far more important in the instruction memory than in the data memory since the great majority of accesses are inst
30. e clone The flash driver determines the particulars of the flash chip that it is driving 8 3 3 Different Memory Sizes It is recommended that the cloning master and slave both have the same RAM and flash sizes 8 3 4 Design Restrictions Digital VO line PB1 should not be used in the design if cloning is to be used Rabbit 4000 Designer s Handbook rabbit com 23 24 rabbit com BIOS Support for Program Cloning Semiconductor 9 Low Power Design and Support With the Rabbit 4000 microprocessor it is possible to design svstems that perform their tasks with verv low power consumption The Rabbit has several features that contribute to low power consumption Thev are summarized here and explained in greater detail in the following section e Special chip select features minimize power consumption by external memories e The Rabbit core operates at 1 8 V e The VO ring can operate 3 3 or 1 8 V e The main crystal oscillator may be divided by 2 4 6 or 8 e When the main crystal oscillator is divided by 4 6 or 8 the short chip select option is available e The 32 kHz oscillator may be used instead of the main oscillator this is sleepy mode The 32 kHz oscil lator may be divided by 2 4 8 or 16 this is ultra sleepy mode The self timed chip select option is avail able in both sleepy and ultra sleepy modes Before looking at the Rabbit 4000 low power features in greater detail please note that some of the power consump
31. e power consumed by CMOS leakage increases with higher temperatures NOTE Periodic interrupts are automatically disabled when the processor is placed in sleepy mode Debug is not directly supported in sleepy modes Please see Section 9 2 7 on page 30 for more information 28 rabbit com Low Power Design and Support 9 2 3 External 32 kHz Oscillator Unlike the Rabbit 2000 the Rabbit 4000 has no internal 32 kHz oscillator Instead there is a clock input The recommended external crvstal oscillator circuit and the associated batterv backup circuit are discussed in Technical Note 235 available on our website www rabbit com 9 2 4 Conformal Coating of 32 768 kHz Oscillator Circuit The 32 768 kHz oscillator circuit consumes microampere level currents The circuit also has verv high input impedance thus making it susceptible to noise moisture and environmental contaminants To avoid leakage due to moisture and ionic contamination it is recommended that the oscillator circuit be conformal coated This is simplified if all components are kept on the same side of the board as the processor Feedthroughs that pass through the board and are connected to the oscillator circuit should be covered with solder mask that will serve as a conformal coating for the back side of the board from the processor Please see Technical Note 303 Conformal Coating and Technical Note 235 External 32 768 kHz Oscillator Circuits on the Rabbit Semiconductor
32. econds and are normally used by Dynamic C routines to measure time intervals or to wait for a certain time or date updateTimers reads the real time clock and then computes new values for the Dynamic C time variables The normal method of updating these variables is the periodic interrupt that takes place 2048 times per second NOTE In ultra sleepy modes calling updateTimers is not recommended Rabbit 4000 Designer s Handbook rabbit com 29 Functions are provided to power down the Realtek Ethernet chip as well By calling the pd powerup and pd powerdown functions the Realtek chip can be placed in and awakened from its own power down mode Note that no TCP IP or Ethernet functions should be called while the Realtek is powered down 9 2 6 Baud Rates in Sleepy Mode The available baud rates in sleepy mode are 1024 1024 2 1024 3 1024 4 etc Baud rate mismatches of up to 5 may be tolerated The baud rate 113 77 is available as 1024 9 and may be useful for communicat ing with other systems operating at 110 bps a 3 4 mismatch In addition the standard PC compatible UART 16450 with a baud rate divider of 113 generates a baud rate of 1019 bps a 0 5 mismatch with 1024 bps If there is a large baud rate mismatch the serial port can usually detect that a character has been sent to it but can not read the exact character 9 2 7 Debugging in Sleepy Mode Debugging is not supported in sleepy modes However running with no pollin
33. el or core module product has a user manual with an appendix labeled Schematics Go to www rabbit com and select Product Documenta tion from the Support tab this will take you to a list of links for available user manuals 3 1 Clocks The Rabbit 4000 has input pins for both the fast clock and the 32 768 kHz clock The fast clock drives the Rabbit 4000 CPU and peripheral clocks whereas the 32 768 kHz clock is used for the batterv backable clock also known as the real time clock the watchdog timer the periodic interrupt timer and the asvn chronous cold boot function Rabbit 4000 Designer s Handbook rabbit com 7 Figure 3 1 Main Oscillator Circuit NC7SZU04 L e Ki CLKIEN FDV303N SR ii 29 49 MHz The 32 768 kHz oscillator is slow to start oscillating after power on For this reason a wait loop in the BIOS waits until this oscillator is oscillating regularly before continuing the startup procedure The startup delay may be as much as 5 seconds but will usually be about 200 ms Crystals with low series resistance R lt 35 kO will start faster For more information on the 32 768 kHz oscillator please see Technical Note 235 External 32 768 kHz Oscillator Circuits This document is available on our website www rabbit com 3 2 Floating Inputs Floating inputs or inputs that are not solidly either high or low can draw current because both N and P FETs can turn on at the s
34. ent the address Instead of typing in all the addresses you can use some special comments They are case sensitive and must be at the begin ning of the line with no space between the semicolon and the first letter of the special comment Address nnnn Triplet The first special comment tells the program to start at address nnnn and increment the address for each transmitted data byte The second special comment disables the automatic address mode and directs the program to send exactly what is in the file The triplets shown in 3 may be rewritten as Address 0000 21 01 00 1d hl 1 06 10 ld b 16 7E ld a hl 29 add hl hl 10 FC djnz loop C3 00 00 jp 0 Triplet Rabbit 4000 Designer s Handbook rabbit com 35 36 rabbit com Troubleshooting Tips for New Rabbit Based Systems Semiconductor Appendix A Supported Rabbit 4000 Baud Rates This table contains divisors to put into TATXR registers All frequencies that allow 57600 baud up to 30MHz are shown as well as a few higher frequencies All of the divisors listed here were calculated with the default equation given on the next page Crystal 2400 9600 19200 57600 115200 230400 460800 Freq MHz baud baud baud baud baud baud baud 1 8432 23 5 2 0 a 3 6864 47 11 5 1 0 5 5296 71 17 8 2 7 3728 95 23 11 3 1 0 9 2160 119 29 14 4 11 0592 143 35 17 5 2 12 9024 16
35. extension diag with Dynamic C or any simple text editor if you would like to examine the triplets that are sent to the target Also serialIO exe has the option of sending the triplets a line at a time so vou can see the triplets in the one line window next to the Transmit button before thev are sent NOTE Connecting the programming cable to the programming connector pulls both SMODE pins high On reset this allows a cold boot from asvnchronous serial port A The reset mav be applied bv pushing the reset button on the target board or bv checking then unchecking the box labeled DTR when using serialIO exe In the following pages two diagnostic programs are looked at in some detail The first one is short and very simple a toggle of the status line Information regarding how to check the results of the diagnostic are given The second diagnostic program checks the processor RAM interface This example provides more detail in terms of how the triplets were derived After reading through these examples vou will be able to write diagnostic programs suited for vour unique board design 32 rabbit com Troubleshooting Tips for New Rabbit Based Svstems 11 2 2 Diagnostic Test 1 Toggle the Status Pin This test toggles the status pin 1 Apply the reset for at least 14 second and then release the reset This enables the cold boot mode for asvnchronous serial port A if the programming cable is connected to the target s programming connec tor
36. g Alt F9 will avoid the loss of target communications when execution enters sections of code using sleepy mode and debug com munications will resume when the normal operation mode is reenabled 30 rabbit com Low Power Design and Support Semiconductor 10 Supported Flash Memories There are manv flash memories that have been qualified for use with the Rabbit 4000 microprocessor Both small and large sector flash devices are supported To incorporate a large sectored flash into an end product the best strategv is have a small sectored development board The list of supported flash memories is in Technical Note 226 Supported Flash Memories This docu ment is available online www rabbit com support techNotes whitePapers shtml TN226 also contains information concerning the limitations of the supported flash tvpes 10 1 Supporting Other Flash Devices If a user wishes to use a flash memory not listed in TN226 but still uses the same standard 8 bit JEDEC write sequences as one of the supported flash devices the existing Dvnamic C flash libraries mav be able to support it simplv bv modifving a few values Not all flash devices can be supported and the degree of support will varv depending on the flash characteristics There are two modifications to be made depending on the version of Dvnamic C that vou are using Step through the list below and perform each action that corresponds to vour flash tvpe 1 The flash device
37. h driver is running you lose access to most of the application code and to all of its con stants See the Rabbit 3000 Designer s Handbook for more details 10 2 1 Required Information for Flash Memorv Below is the data structure used by the flash driver to hold the required information about the installed flash memorv The InitFlashDriver function is called earlv in the BIOS to fill this structure before any accesses to the flash struct char flashXPC XPC required to access flash via XMEM int sectorSize byte size of one flash memory sector int numSectors number of sectors on flash int flashSize size of flash in 4 KB blocks char writeMode write method used by the flash void eraseChipPtr pointer to erase chip function in RAM eraseChipPtr is currently unused void writePtr ptr to write flash sector function RAM Flashinfo The field 1ashXPC contains the XPC required to access the first flash physical memory location via XMEM address E000h The pointer writePtr should point to a function in RAM to avoid accessing the flash memory while working with it You will probably be required to copy the function from flash to a RAM buffer in the flash initialization sequence The field writ eMode specifies the method that a particular flash device uses to write data Currently two common small sector write modes are defined sector writing mode as used by the SST SST29 and Atmel AT29 series FlashInfo
38. he System ID block and certain features e g TCP IP needs the MAC address Items marked as are desirable for future compatibility typedef struct SysIDBlockType2 uint8 flashMBC Memory Bank Configurations uint8 flash2MBC uint8 ramMBC uint32 devSpecLoc Count of additional memory devices immediately preceding this block uint32 macrosLoc Start of the macro table for additional board configuration options uint32 driversLoc offset to preloaded drivers start from ID block start positive is below ID block uint32 ioDescLoc offset to I O descriptions start from ID block start positive is below ID block uint32 ioPermLoc offset to User mode I O permissions start from ID block start positive is below ID block uint32 persBlockLoc offset to persistent storage block area start from ID block start positive is below ID block uint16 userBlockSiz2 size of v 5 new style mirrored User block image uint16 idBlockCRC2 CRC of SysIDBlockType2 type with idBlockCRC2 member reset to zero and base CRC value of SysIDBlock idBlockCRC SvsIDBlockTvpe2 tvpedef struct int tableVersion version number for this table layout int productID Rabbit part int vendorID 1 Rabbit char timestamp 7 XXIMID H M S long flashID Manufacturer ID Product ID 1st flash int flashType Write method int flashSize in 1000h pages int sectorSize size of flash sector in b
39. if the operation was successful a 3 if a time out occurred during the wait or a 4 if an attempt was made to write over the System ID block 46 rabbit com Supported Flash Memories Semiconductor 11 Troubleshooting Tips for New Rabbit Based Svstems If the Rabbit design conventions were followed and Dvnamic C cannot establish target communications with the Rabbit 4000 based system there are a number of initial checks and some diagnostic tests that can help isolate the problem 11 1 Initial Checks Perform the first two checks with the RESET line tied to ground For the 128 pin LQFP package the RESET line is pin 46 1 With a voltmeter check for Vpp and Ground including Vparr on the appropriate pins 2 With an oscilloscope check the 32 768 kHz oscillator on CLK32K pin 49 Make sure that it is oscillat ing and that the frequency is correct 3 With an oscilloscope check the main system oscillator by observing the signal CLK pin 2 With the reset held high and no existing program in the flash memory attached to the processor this signal should have a frequency one eighth of the main crystal or oscillator frequency 11 2 Diagnostic Tests The cold boot mode may be used to communicate with the target system without using Dynamic C As discussed in Section 4 1 in cold boot mode triplets may be received by serial port A or the slave port To load and run the diagnostic programs the easiest method is to use the programm
40. ing IMPULS us sas GE EE SE GREG Ee RE eisai 8 tal aa H Calibration constants L se Re RR ER mezza 21 EE 10 37 hardware Test EE GE EE EE ER pp 4 ceramic resonator e sseerenennnnzzznnenzznnnanznenzznnnn anna 4 And SR tap tii e EE 3 l RO saristi INETTUPLS osse tna 16 41 46 Short Mode Li kiseb 38 CLK pin 2 Lee GR RA GR ern ne RR ee 47 M clock EE 41 AA EE Ge Ee 1 7 11 38 MAC address EER Ee 23 26 35 common crystal frequencies co se ee ee 3 MAX USERBLOCK SIZE rn 28 SES EE RE N 5 10 memory leede sat SE aan 3 4 33 ACCESS EE 10 ERGE ee ee GE 37 40 DEE 28 cold DOO uu eee 13 14 48 line permutation En UH conformal coating ui ee ee ee 41 iS OE AO e 17 ER AR EE RE eves 3 MMU MIU En 15 crystal oscillator ee Re ee ee GR ee ena 3 O 32 kHz crystal oscillator external logic 41 CS1 ALWAYS ON ee se se ee Ee Ee EER ER Ee EER ER ee 9 operating voltages oes se ee ge Ge ee ee 5 39 D OSCI Ee OO iro 3 4 7 47 output enable iese ern ke Ee EER Re Eed ene EDE ee 3 DATASEG register sesse ee se se ee ee ee ee ee 16 P debug Mode is BE EE GEES Es ese EE deet 16 40 design CONVENTIONS esse see ee ke ee ee RR ee ee 3 Periodic interrupt L ss ees ee ee ee ee ee 40 41 memory chips EE Ad EE RE 4 power consumption PAT DE ira MR TA 5 37 oscillator Crystals Lee ee ee ee Re ee ee ena 4 programming cable iese sesse ee 1 3 13 15 16 48 programming cable Connector Low 4 programmi
41. ing cable and a specialized terminal emulator program over asynchronous serial port A To use the slave port requires more setup than the serial port method and it is not considered here Since each board design is unique it is not possible to give a one size fits all solution for diagnosing board problems However using the cold boot mode allows a high degree of flexibility Any sequence of triplets may be sent to the target 11 2 1 Program to Transmit Diagnostic Tests The file SerialIO_1 zip is available for download at www rabbitsemiconductor com support downloads The zip file contains the specialized terminal emulator program serialIO exe and several diagnostic programs The diagnostic programs test a variety of functionality and allow the user to simulate some of the behavior of the Dynamic C download process Rabbit 4000 Designer s Handbook rabbit com 31 After extracting the files double click on serialIO exe to display the following screen none Receive mm Serial 1 0 20010420 Ioj x Help Baud al Parity a SCH Channel DSR 2400 None bi Le 1C2C3C4 DIR ATS JT Break CTS Transmit Repeat File Tx Method TxMode oad f Ad 2 A All atOnce CRT LF Ajl atOnce C ASCII E ji L Repeat Delay i Click on Help at the top left hand side of the screen for directions for using this program A diagnostic program is a group of triplets Xou can open the provided diagnostic programs those files with the
42. ing the frequency to 22 1184 MHz Such a system will operate with 70 ns mem ories A 29 4912 MHz system will require memories with 55 ns access time A table of timing specifica tion is in the Rabbit 4000 Microprocessor User s Manual 2 3 Power Consumption Various mechanisms contribute to the current consumption of the Rabbit 4000 processor while it is operat ing including current that is proportional to the voltage alone leakage current and dependent on both voltage and frequency switching and crossover current Table 2 1 shows typical current draw as a function of the main clock frequency The values shown do not include any current consumed by external oscillators or memory It is assumed that approximately 30 pF is connected to each address line NOTE VDDCORE 1 8 V 10 VDDIO 3 3 V 10 TA 40 C to 85 C Table 2 1 Preliminary Current vs Clock Frequency Frequency MHz _ core mA I IO mA I Total mA 7 3728 4 10 14 14 7456 6 11 17 29 4912 10 12 22 58 9824 18 15 33 Rabbit 4000 Designer s Handbook rabbit com 5 2 4 Through Hole Technology Most design advice given for the Rabbit 4000 assumes the use of surface mount technology However it is possible to use the older through hole technology and develop a Rabbit 4000 system One can use a Rabbit 4000 based Core Module a small circuit board with a complete Rabbit 4000 core that includes memory and oscillators Another p
43. irst byte of an opcode fetch While the triplets are being read instructions are being executed from the small cold boot program within the microprocessor The status line will go low after the first trip let has been read It will go high after the second triplet is read and return to low after the third triplet is read The status line will stay low until the sequence starts again If this test fails to function it may be that the programming connector is connected improperly or the proper pull up resistors are not installed on the SMODE lines Other possibilities are that one of the oscil lators is not working or is operating at the wrong frequency or the reset could be failing 11 2 2 1 Using seriallO exe This test is available as StatusTg1 Diag one of the diagnostic samples downloaded in ser io rab20 zip Rabbit 4000 Designer s Handbook rabbit com 33 11 2 3 Diagnostic Test 2 The following program checks the processor RAM interface for an SRAM device connected to CS1 OE1 WEL The test toggles the first 16 address lines All of the data lines must be connected to the SRAM and functioning or the program will not execute correctiv A series of triplets are sent to the Rabbit via one of the bootstrap ports to set up the necessarv control regis ters and write several instructions to RAM Finallv the bootstrap termination code is sent and the program begins executing instructions in RAM starting at address 0x00 The following s
44. is subject please see Technical Note 221 PC Board Lavout Suggestion for the Rabbit 3000 Microprocessor This docu ment is available at www rabbit com docs app Tech notes shtml 3 5 1 Rabbit 4000 Low EMI Features The Rabbit 4000 has powerful built in features to minimize EMI They are noted here For details please see The Rabbit 4000 Microprocessor User s Manual e Separate power pins exist for core and I O rings e The I O bus can be separate from the memory bus e The external processor bus cycles are not all the same length e The external processor bus does not require running the clock around the PCB e The clock spectrum spreader option modulates the clock frequency e Some gated internal clocks are enabled only when needed e An internal clock doubler allows the external crystal oscillator to operate at 1 2 frequency Rabbit 4000 Designer s Handbook rabbit com 11 12 rabbit com Core Design and Components Semiconductor 4 How Dvnamic C Cold Boots the Target Svstem Dvnamic C assumes that target controller boards using the Rabbit 4000 CPU have no pre installed firm ware It takes advantage of the Rabbit 4000 s bootstrap cold boot mode which allows memory and I O writes to take place over the programming port Figure 4 1 Rabbit Programming Port Circuit Board with Rabbit 4000 Processor Programming RABBIT 4000 Header Programming Header Pinout The Rabbit programming cable is a smart
45. llows ID A 4 User A 4 ID B 4 User B Ordinarilv only one of the ID User blocks images is valid at a time and the valid ID User blocks image alternates between A and B at each call to the writeUserBlock function If both A and B images are simulta neously marked valid the A topmost image is taken to be correct Version 5 ID blocks can be config ured as described above and can also be configured so that the User block is mirrored and the System ID block is not If a version 5 ID block is configured so that only the User block is mirrored the images will be ID User A User B If Dynamic C does not find a System ID block on a device the compiler will assume that it is a BL1810 Jackrabbit board It is recommended that board designers include System ID blocks in their products with unused fields zeroed out to maximize future compatibility The System ID block has information about the location of the User block The User block is for storage of calibration constants and other persistent data the user wishes to keep in flash It is strongly recommended that the User block using writeUserBlock or the Flash File System be used for storage of persis tent data Writing to arbitrary flash addresses at run time is possible using WriteFlash or WriteFlash2 but could lead to compatibility problems if the code were to be used on a different type of flash such as a huge non uniform
46. ncv Timer A clocked by PCLK 2 serial data rate 16 x clock CPU frequency in Hz divor 16 x 2 x baud rate Timer A clocked by PCLK serial data rate 16 x clock CPU frequency in Hz 1 CN 16 x baud rate Timer A clocked by PCLK 2 serial data rate 8 x clock CPU frequency in Hz divisor 8 x 2 x baud rate Timer A clocked by PCLK serial data rate 8 x clock CPU frequency in Hz 1 divisor 8 x baud rate 38 rabbit com Supported Rabbit 4000 Baud Rates Semiconductor Notice to Users RABBIT PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPO NENTS IN LIFE SUPPORT DEVICES OR SYSTEMS UNLESS A SPECIFIC WRIT TEN AGREEMENT SIGNED BY A CORPORATE OFFICER OF DIGI INTERNATIONAL IS ENTERED INTO BETWEEN THE CUSTOMER AND DIGI INTERNATIONAL No complex software or hardware svstem is perfect Bugs are alwavs present in a svstem of any size and microprocessor systems are subject to failure due to aging defects elec trical upsets and various other causes In order to prevent danger to life or propertv it is the responsibilitv of the svstem designers who are our customers to incorporate redun dant protective mechanisms appropriate to the risk involved Even with the best practices human error and improbable coincidences can still conspire to result in damaging or dan gerous svstem failures Our products cannot be made perfect or near perfect without caus ing them to cost so much as to preclude anv prac
47. ncy When the chip select and output enable are held enabled and all other signals are held at fixed levels In situations where the microprocessor is operating at slow freguencies such as 2 048 kHz the memory cycle is about 488 us and the memory chip spends most of its time with the chip enable and the output enable on The current draw during a long read cycle is not specified in most data sheets The Hynix HY62KF08401C SRAM according to the data sheet typically draws 5mA MHz when it is operating When performing reads at 2 048 kHz we ve found that this SRAM consumes about 14 mA At the same frequency with the short chip select enabled the SRAM consumes about 23 uA a substantial reduction in power consumption As shown both special chip select modes i e short chip select and self timed chip select reduce memory current consumption since the processor spends most of its time performing reads i e instruction fetches The self timed chip select feature is available in sleepy and ultra sleepy mode i e when the processor is running off the 32 kHz oscillator or when the oscillator is divided by 2 4 8 or 16 The short chip select feature may be used when the main oscillator is divided by 4 6 or 8 This division can be done regardless of whether the clock doubler is on or off Currently interrupts must be disabled when both the short chip select feature is enabled and an I O instruction is used Interrupts can be disabled for a
48. nd the checksum has been sent program exe cution jumps to 0x6000 9 The secondary loader does a wrap around test to determine how much RAM is available and reads the flash and CPU IDs This information is made available for transmittal to Dynamic C when requested 10 The secondary loader now enters a finite state machine FSM that is used to implement the Dynamic C Target Communications protocol Dynamic C requests the CPU ID flash ID RAM size and 19200 baud rate divisor to define internally defined constants and macros Dynamic C uses the flash ID to lookup flash parameters that are sent back to the secondary loader so that it can initialize flash write erase routines At this stage the compiler can request the baud rate be increased to a higher value The secondary loader is now ready to load a BIOS and user program 11 Dynamic C now compiles the BIOS and user programs Both are compiled to a file then the file is loaded to the target using the Pilot BIOS FSM After the loading is complete Dynamic C using the Pilot BIOS FSM tells the Pilot BIOS to map flash to 0x00000 map RAM to 0x80000 and start pro gram execution at 0x0000 thereby running the compiled BIOS 12 1f the Pilot BIOS detects a RAM compile or small sector flash that uses sector write mode Dynamic C uses a slightly different loading procedure The BIOS will be compiled as normal and loaded using the Pilot BIOS After the BIOS is loaded Dynamic C will tell the Pilo
49. needs to be added to the list of known flash tvpes This table can be found bv search ing for the label FlashData in the file LIB BIOSLIB FLASHWR LIB The format is described in the file and consists of the flash ID code the sector size in bytes the total number of sectors and the flash write mode See Section 10 2 1 and the comments above the FlashData table in FLASHWR LIB for more information 2 The same information that was added to the FlashData table needs to be added to the FLASH INI file in the main directory where Dynamic C was installed for use by the compiler and pilot BIOS See the top of the file for more information Rabbit 4000 Designer s Handbook rabbit com 43 10 2 Writing Your Own Flash Driver To use a flash memory that is not listed in TN226 and that does not use the same standard 8 bit JEDEC write seguences as one of the supported flash memories in addition to making the reguired changes listed in Section 10 1 two functions need to be rewritten InitFlashDriverand WriteFlash They are in the library that implements the flash driver FLASHWR LIB If you are using separate I amp D space please note the following restrictions e The flash driver cannot run in the xmem window for two reasons First the driver uses the xmem win dow Second it would require the use of load physical instructions 1 dp which always write 2 bytes and a flash unlock seguence reguires 1 byte writes e While the flas
50. ng cable connector LL eee 4 diagnostic tests eee Re ee ee GR ee en 47 ERA EES EE 15 R Dynamic C start sequence e ee ee ee 15 RAM Rabbit 4000 Designer s Handbook rabbit com 57 wrap around test oe eee ee se ee ee ee ee ee ee ee 16 Realtek Ethernet chip Lee nn 42 TOS OU EE RE EE EG N AE ER E 16 48 S serial port A eier SE EE ei Ge gee Gis 3 sleepy mode ge eko oi ER Ee ctaneee dl d E dai CG 41 SMODE PINS iii ves see see ees ie ke es ee sg be Ee ses 15 48 Surface mount men ee ee RA ee Re RA ee ee 6 System ID block en 21 TEAM B i ae ee ORDE 24 SIZES OF RA EE eee le 24 aie GE EN RA 27 T target communications protocol sees se 16 through hole wie ni 6 EE 15 49 troubleshooting tips L senser GR Re ee ee 47 U User DIGOR iii ee a 21 iS TA EE AD N 29 AE EE AE OR EE EE ORE ET 24 nie AR EER E 31 W Walt SUALES EE DEE RR Ee ee Ee eet 10 15 RE UE 3 write method eee ee ee ee see ee ee ee ee ee ee RR Ee 16 44 58 rabbit com Index
51. nly once in every 12 clocks 9 2 2 Sleepy Mode Power consumption is dramatically decreased in sleepy mode The VDD core current consumption is often reduced to the region of 22 uA 3 3 V and 32 768 kHz The Rabbit 4000 executes about 6 instructions per millisecond at this low clock speed Generally when the speed is reduced to this extent the Rabbit will be in a tight polling loop looking for an event that will wake it up The clock speed is increased to wake up the Rabbit In sleepy mode most of the power is consumed by memory e the processor core e recommended external 32 kHz crystal oscillator circuit Using the flash memory SST39LF020 45 4C WH and a self timed 106 ns chip select the memory con sumed 22 u A at 32 kHz and 1 4 pA at 2 kHz For a current list of supported flash please see Technical Note 226 Supported Flash Devices This document is available at http www rabbit com docs app tech notes shtml The supported flash devices will give approximately the same values as the flash device that was used for testing The processor core consumes between 3 and 50 uA at 3 3 V as the frequency is throttled from 2 kHz to 32 kHz and about 40 as much at 1 8 V The crystal oscillator circuit consumes 17 uA at 3 3 V This drops rapidly to about 2 u A at 1 8 V Additional power consumption in sleepy mode may come from a low power reset controller which may consume about 8 uA and CMOS leakage which may consume several uA Th
52. ock Next the previ ously valid image is invalidated by changing its marker 5 byte from OxAA to 0x00 Finally the newly invalidated image is updated In this way there is only a short period of time in which both images are marked valid and at no time are both data blocks marked invalid If a power failure occurs at any time dur ing the User block update the BIOS will still find a valid ID block and the valid User block will contain data from the last completed update transaction In addition to making data more secure this redundancy allows even very large sector flash types to be used without requiring a large RAM buffer to temporarily store the contents of a sector since sectors must be erased before they can be written In Dynamic C 7 20 and later the possibility of mirrored combined ID User blocks requires that multiple locations in flash must be checked for a valid ID block In versions 7 20 through 7 3x the sequence described above in Section 7 1 2 1 is used to check not only the top of the primary flash but also 8KB 16KB and 24KB below the top and an error is returned only if no valid ID block is found at any of these locations Note the implication here that mirrored combined ID User blocks are limited to one of 8KB 16KB or 24KB in size Dynamic C versions 8 and later check more locations in flash from the top down at each lower 4KB boundary to 64KB below the top This allows Dynamic C 8 and up to recognize a com bined ID User bl
53. ocks size that is any multiple of 4KB up to a maximum of 64KB If the version of the System ID block doesn t support the User block or no System ID block is present then the 8 KB starting 16 KB from the top of the primary flash are designated the User block area How ever to prevent errors arising from incompatible large sector configurations this will only work if the flash type is small sector Rabbit manufactured boards with large sector flash will have valid System ID and User blocks so this should not be a problem on Rabbit based boards 7 2 1 Boot Block Issues The System ID and User block implementations have been designed to accommodate huge non uniform sector flash types but it is necessary to use T type parts with such flash types so that the smaller boot block sectors at the top can be used for the blocks B parts have smaller boot block sectors at the bottom No code is included with Dynamic C to lock boot blocks and users should not lock boot blocks unless they are sure they will never write to the blocks after the System ID block is written If a boot block lock is irreversible we strongly recommend never locking it Rabbit 4000 Designer s Handbook rabbit com 27 7 2 2 Reserved Flash Space The macro MAX USERBLOCK SIZE default 0x8000 in the BIOS tells the Dynamic C compiler how much flash at the top of the primary flash is excluded from use by the compiler for xmem functions For any application whether compile
54. ogical and physical memory a thorough description of separate I amp D space and some useful details on customizing interrupts As soon as this chapter becomes available it will be included in the manual and posted on the Rabbit web site www rabbit com Rabbit 4000 Designer s Handbook rabbit com 17 18 rabbit com Rabbit Memory Organization Semiconductor 6 The Rabbit BIOS This chapter is not currently available Complete and accurate information regarding the Rabbit BIOS will be made available in this manual as soon as possible and will be posted on the Rabbit website www rabbit com Rabbit 4000 Designer s Handbook rabbit com 19 20 rabbit com The Rabbit BIOS Semiconductor 7 The Svstem Identification and User Blocks The BIOS supports a Svstem Identification block and a User block These blocks are placed at the top of the primarv flash memorv Identification information for each device can be placed in the Svstem ID block for access bv the BIOS flash driver and users This block contains specific part numbers for the flash and RAM devices installed the product s serial number Media Access Control MAC address if an Ethernet device and so on The earliest version of the Svstem ID for Rabbit 4000 products is version 4 which isa mirrored images tvpe When mirrored there are two combined ID User blocks images placed contiguously at the top of the pri marv flash from the top down as fo
55. onnector Dvnamic C programming uses serial port A for software development However it is possible for the user s application to also use serial port A with the restriction that debugging is not available 2 rabbit com Introduction Semiconductor 2 Rabbit Hardware Design Overview Because of the glueless nature of the external interfaces especiallv the memorv interface it is easv to design hardware in a Rabbit 4000 based svstem More details on hardware design are given in the Rabbit 4000 Microprocessor User e Manual 2 1 Design Conventions e Include a standard Rabbit Semiconductor programming cable The standard 10 pin programming con nector provides a connection to serial port A and allows the PC to reset and cold boot the target system e Connect a static RAM having at least 128 KB to the processor using CS1 OE1 and WEI It is useful if the PC board footprint can also accommodate a RAM large enough to hold all the code anticipated Although code residing in some flash memory can be debugged debugging and program download is faster to RAM e Connect a flash memory that is on the approved list and has at least 128 KB of storage to the processor using CSO OEO and WEQ Non approved memories can be used but it may be necessary to modify several files Some systems designed to have their program reloaded by an external agent on each pow erup may not need any flash memory e Install a crystal oscillator with
56. onsist of a high address byte followed by a low address byte followed by a data byte and writing the data byte to either memory or I O space Cold boot mode is entered by having one or both of the SMODE pins pulled high when the Rabbit is reset The pin settings determine the source of the incoming triplets SMODEI 0 SMODEO 1 cold boot from slave port SMODEI 1 SMODEO 0 cold boot from clocked serial port A SMODEI 1 SMODEO 1 cold boot from asynchronous serial port A at 2400 bps SMODEI 0 SMODEO 0 start normal execution at address zero The SMODE pins can be used as general input pins once the cold boot is complete On entering cold boot mode the microprocessor starts executing a 12 byte program contained in an inter nal ROM The program contains the following code origin zero 00 ld 1 n n 0c0h for serial port A n 020h for parallel slave port 02 ioi ld d hi get address most significant byte 04 ioi ld e hi get least significant bvte 06 ioi ld a hi getdata 08 ioi or nop if the high bit of the MSB of the address is 1 i e d 7 1 then ioi else nop 09 ld de A store in memory or I O 10 jr 0 jump back to zero note wait states inserted at bytes 3 5 and 7 waiting for serial port or parallel port ready 14 rabbit com How Dynamic C Cold Boots the Target System The function of the boot ROM program depends on the settings of the pins SMODEO and SMODEI and on whether the high
57. ossibilitv is to solder the Rabbit 4000 processors bv hand to the circuit board This is not difficult and is satisfactorv for low production volumes if the right technigue is used 2 5 Moisture Sensitivitv Surface mount processing of plastic packaged components such as Rabbit microprocessors tvpicallv involves subjecting the package bodv to high temperatures and various chemicals such as solder fluxes and cleaning fluids during solder wave and reflow operations The plastic molding compounds used for IC packaging encapsulation is hvgroscopic that is it readilv absorbs moisture The amount of moisture absorbed by the package is proportional to the storage environment and the amount of time the package is exposed to the humiditv in the environment During the solder reflow process the package is heated rap idly and any moisture present in the package will vaporize rapidly generating excessive internal pressures to various interfaces in the package The vapors escaping from the package mav cause cracks or delamina tion of the package These cracks can propagate through the package or along the lead frame thus expos ing the die to ionic contaminants and increasing the potential for circuit failures The damage to the package may or may not be visible to the naked eye This condition is common to all plastic surface mount components and is not unique to Rabbit microprocessors Rabbit microprocessors are shipped to customers in moisture barrier bags
58. ources unsigned numbytes int numsources DESCRIPTION Rabbit based boards are released with Svstem ID blocks located on the primarv flash Version 2 and later of this ID block has a pointer to a User block that can be used for storing calibration con stants passwords and other non volatile data The User block is protected from normal write to the flash device and can only be accessed through this function or writeUserBlock This function writes a set of scattered data from root memorv to the User block If the data to be written is in contiguous bytes using the function writeUserBlock is sufficient Use of writeUserBlockArray isrecommended when the data to be written is in noncontiguous bytes as may be the case for something like network configuration data See the Rabbit Micro processor Designer s Handbook for more information about the Svstem ID and User blocks This function was introduced in Dvnamic C version 7 30 Backwards Compatibilitv If the Svstem ID block on the board doesn t support the User block or no Svstem ID block is present then the 8K bytes starting 16K bytes from the top of the primary flash are designated User block area This only works if the flash type is small sector Rabbit manufactured boards with large sector flash will have valid Svstem ID and User blocks so is nota problem on Rabbit based boards If users create boards with large sector flash thev must install Svstem ID blocks version 3 or grea
59. ped to flash is passed to it in HL The bitmap is defined as 0x01 corresponds to the 1st quadrant 0x02 corresponds to the 2nd quadrant 0x04 corresponds to the 3rdquadrant 0x08 corresponds to the 4th quadrant OxOC corresponds to the topmost two quadrants _InitFlashDriver needs to perform the following actions 1 Load Flashinfo flashxXPC with the proper XPC value to access flash memory address 00000h via XMEM address E000h The quadrant number for the start of flash memory is passed to the function in HL and can be used to determine the XPC value if desired For example if your flash is located in the third memory quadrant the physical address of the first flash memory location is 80000h 80000h EOOOh 72000h so the value placed into _FlashInfo XPC should be 72h Load Flashinfo sectorsSize with the flash sector size in bytes Load Flashinfo numSectors with the number of sectors on the flash Load Flashinfo flashSize with the number of sectors on the flash Q BW N Flashinfo writePtr should be loaded with the memory location in RAM of the function that will perform that action The function will need to be copied from flash to RAM at this time as well 6 This function should return zero if successful or 1 if an error occurs Rabbit 4000 Designer s Handbook rabbit com 45 _WriteFlash This function is called from the BIOS the user will normally call higher level flash writing functions as well as from seve
60. ral libraries and should be written to conform to the following requirements The number of bytes to be written should be passed in BC A fixed 4096 byte block of XMEM is used for the flash buffer It can be accessed via macros located at the top of FLASHWR LIB These macros include FLASH BUF PHYS the unsigned long physical address of the buffer FLASH BUF XPC and FLASH BUF ADDR the logical address of the buffer via the XMEM window and FLASH BUF 0015 and FLASH BUF 1619 the physical address of the buffer broken down to be used with the LDP opcodes It should assume that the flash address to be written to is passed as an XMEM address in A DE The amount of data being written typically an entire sector must fit within one physical sector on the flash device and must be aligned on a sector boundarv for devices using sector write mode It should check to see whether the sector being written contains the Svstem ID or User blocks If so it should exit with an error code see below Otherwise it should perform the actual write operation required by the particular flash used Interrupts should be tumed off set the interrupt level to 3 whenever writes are occurring to the flash Interrupts should not be turned back on until the write is complete an interrupt may attempt to access a function in flash while the write is occurring and fail It should not return until the write operation is finished on the chip It should return a zero in HL
61. re read into a local buffer If a 256 KB flash is installed the 16 bytes starting at address Ox3FFFO will be read The last six bytes of the local buffer are checked for an alternating sequence of 0x55 OxAA 0x55 OxAA 0x55 OxAA If this is not found the block does not exist and an error 2 is returned 3 The ID block size SIZE is determined from the first 4 bytes of the 16 byte buffer A block of bytes containing all fields from the start of the SysIDBlock struct up to but not including the reserved field is read from flash at address 0x40000 SIZE essentially filling the SysIDBlock struct except for the reserved field since the top 16 bytes have been read earlier The CRC field is saved in a local variable then set to 0x0000 A CRC check is then calculated for the entire ID block except the reserved field and compared to the saved value If they do not match the block is considered invalid and an error 3 is returned The CRC field is then restored The reserved field is avoided in the CRC check since its size may vary depending on the size of the ID block Determining the existence of a valid mirrored ID block may be slightly more complicated requiring the above sequence of events to be repeated at several locations below the top of the primary flash See Sec tion 7 2 below for complete details Not all fields are filled in different versions of the ID block The table below lists the first ID block version that
62. ree of control is not desired for a particular situa tion then certain pins can be left unconnected in the connecting cable limiting the functionalitv of the connector to serial communications Rabbit Semiconductor develops products and software that assume the presence of the programming connector 2 1 2 Memorv Chips Most svstems have one static RAM chip and one or two flash memorv chips but more memorv chips can be used when appropriate Static RAM chips are available in 128K x 8 256K x 8 and 512K x 8 sizes They are all available in 3 V versions Suggested flash memory chips between 128K x 8 and 512K x 8 are given in Chapter 10 Supported Flash Memories That chapter also includes instructions for writing your own flash driver The list of supported flash memories is in Technical Note 226 Supported Flash Memo ries Dynamic C and a PC are not necessary for the production programming of flash memory since the flash memory can be copied from one controller to another by cloning This is done by connecting the system to be programmed to the same type of system that is already programmed This connection is made with the Rabbit Cloning Board The cloning board connects to the programming ports of both systems A push of a button starts the transfer of the program and an LED displays the progress of the transfer Please visit www rabbit com store index shtml to purchase the Rabbit Cloning Board 2 1 3 Oscillator Crvstals Generallv
63. ruction fetches Going from 0 to 1 wait states is about the same as reducing the clock speed by 30 Going from 0 to 2 wait states is worth approximately a 45 reduction in clock speed A table of memory access times reguired for various clock speeds is given in the Rabbit 4000 Microprocessor User e Manual 3 3 2 Interfacing External VO with Rabbit 4000 Designs The Rabbit 4000 provides on chip facilities for glueless interfacing to many types of external I O peripher als The processor provides a common I O read and I O write strobe in addition to eight user configurable VO strobes that can be used as read write read write or chip select signals The Rabbit 4000 also provides the option of enabling a completely separate bus for VO accesses The Auxiliary VO Bus which uses many of the same pins used by Parallel Port A and the Slave Port provides 8 data lines and 6 to 8 address lines that are active onlv during I O operations Bv connecting I O devices to the auxiliarv bus the fast memorv bus is relieved of capacitive loading that would otherwise slow down memorv accesses For core modules based on the Rabbit 4000 fewer pins are required to exit the core module since the slave port and the VO bus can share the same pins and the memorv bus no longer needs to exit the module to provide I O capabil itv As far as external I O timing is concerned the Rabbit 4000 provides e half a clock cycle of address and chip select hold time for I O write opera
64. t BIOS to start it and the rest of the program will be loaded through the compiled BIOS 13 Once the compiled BIOS starts up it runs some initialization code This includes setting up the serial port for the debug baud rate set in the Communications tab in Options Project Options setting up serial interrupts and starting the BIOS FSM Dynamic C sets a breakpoint at the beginning of main and runs the program up to the breakpoint The board has been programmed and Dynamic C is now in debug mode 14 If the programming cable is removed and the target board is reset the user s program will start running automatically because the BIOS will check the SMODE pins to determine whether to run the user application or enter the debug kernel 16 rabbit com How Dynamic C Cold Boots the Target System Semiconductor 5 Rabbit Memorv Organization This chapter is not currently available Complete and accurate information regarding the memory organi zation of the Rabbit 4000 will be made available in this manual as soon as possible The memory management chapter of the Rabbit 4000 Microprocessor User s Manual is an appropriate starting place for readers wanting to gain an understanding of this topic In addition the Rabbit 3000 Designer s Handbook describes the Rabbit s 8 bit memory mode While it does not contain information on the 16 bit memorv mode of the Rabbit 4000 or the use of far pointers it does contain general information about l
65. teps illustrate one way to create a diagnostic program 1 Write a test program in assembly main tasm boot ld hl 1 ld b 16 loop ld a hi add hl hl shift left djnz loop 16 steps jp 0 continue test endasm 2 Compile the program using Dynamic C and open the Assembly window The disassembled code looks like this 7 Dynamic C Dist 7 30P File Edit Compile Run Inspect Options Window Help Deel Seal NEE Edit Compile Disassembled Code 1c46 0610 ld b 10 1c48 7E ld a hl 1c49 29 add hl hl lcda 10FC dinz 1c48 le4c C30000 jp AF aA ali 34 rabbit com Troubleshooting Tips for New Rabbit Based Svstems 3 The opcodes and their data are in the 2nd column of the Assembly window Since we want each triplet loaded to RAM beginning at address zero create the following seguence of triplets code to be loaded in SRAM 00 00 21 00 01 01 00 02 00 00 03 06 00 04 10 00 05 7E 00 06 29 00 07 10 00 08 FC 00 09 C3 00 0A 00 00 OB 00 4 The code to be loaded in SRAM must be flanked by triplets to configure internal peripherals and a trip let to exit the cold boot upon completion 80 14 05 7 MBOCR Map SRAM on CS1 OE1 WE1 to Bank 0 80 09 51 ready watchdog for disable 80 09 54 disable watchdog timer code to be loaded in SRAM goes here 80 24 80 Terminate boot strap start executing code at address zero The program serialIO exe has the ability to automatically increm
66. ter to use this function or modifv this function PARAMETERS addr Address offset in the User block to write to sources Array of pointer to sources to copy data from numbvtes Arrav of number of bytes to copy for each source The sum of the lengths in this arrav must not exceed 32767 bytes or an error will be returned numsources Number of data sources RETURN VALUE 0 Successful 1 Invalid address or range 2 No valid User block found block version 3 or later 3 Flash writing error LIBRARY IDBLOCK LIB 32 rabbit com The System Identification and User Blocks Semiconductor 8 BIOS Support for Program Cloning The BIOS supports copving designated portions of flash memorv from one controller the master to another the clone The Rabbit Cloning Board connects to the programming port of the master and to the programming port of the clone This simple circuit can easilv be incorporated into test fixtures for fast pro duction Figure 8 1 Cloning Board RXA GND Kg CLKA i Connect Connect to Master s to Clone s Programming Port Programming Port 8 1 Overview of Cloning If the cloning board is connected to the master the signal CLKA is held low This is detected in the BIOS after the reset ends invoking the cloning support of the BIOS If cloning has been enabled in the master s BIOS it will cold boot the target system by resetting it and downloading a primary boot program The master then sen
67. tical use thus our products reflect our reasonable commercial efforts All Rabbit products are functionally tested Although our tests are comprehensive and carefullv constructed 100 test coverage of every possible defect is not practical Our products are specified for operation under certain environmental and electrical conditions Our specifications are based on analysis and sample testing Individual units are not usu ally tested under all environmental and electrical conditions Individual components may be specified for different environmental or electrical conditions than our assembly con taining the components In this case we have gualified the components through analysis and testing to operate successfully in the particular circumstances in which they are used Rabbit 4000 Designer s Handbook rabbit com 39 40 rabbit com Semiconductor A E access tiMES oo eee ee ee Re Re ee ee ee 5 9 10 25 26 EI WEE 11 B F baud TALENT 1 3 4 EC IA EE N EN ES ER 8 37 diVISOF ee ese ee see ee ee ee ee Ee Re Re ee Ee ee Re ee ee ee ee ee 15 54 finite state machine 1 sseeeenennnnnezzznntennnnanzznnna 16 AE En ee Ee 42 TIENI WANG Lia tl ea ee Ee 13 binary compatibility L 28 flash BIOS EE A 19 CUSTOM dilVel skin resin bar ipin i ajk 44 Walt LOOP RE EE EE EEN 8 Supported devices oo ee se ee ee ee ee Ge ee 43 POOT 5 La ta 27 write method dl 16 bo tROM EE NE 14 Fletcher algorithm eee 16 c float
68. tion in an embedded system is unaffected by the clever design features of the microprocessor As shown in the table below the current and thus power consumption of a microprocessor based system generally consists of a part that is independent of frequency and a part that depends on frequency Table 9 1 Factors affecting power consumption in the Rabbit 4000 microprocessor Current Consumption Current Consumption Independent of Frequency Dependent on Frequency Current leakage CMOS logic switching state Special circuits e g pull up resistors Circuits that continuously draw power a Ordinary CMOS logic uses power when it is switching from one state to another The power drawn while switching is used to charge capacitance or is used when both N and P field effect transmitters FETs are simultaneously on for a brief period during a transition Rabbit 4000 Designer s Handbook rabbit com 25 9 1 Details of the Rabbit 4000 Low Power Features This section goes into more detail about the Rabbit 4000 low power features 9 1 1 Special Chip Select Features Unlike competitive processors the Rabbit 4000 has two special chip select features designed to minimize power consumption by external memories This is significant because if not handled well external memo ries can easily become the dominant power consumers at low clock freguencies Primarily because most memory chips draw substantial current at zero fregue
69. tions and e zero clock cycles of address and chip select hold times for VO read operations These can both be increased to a full clock of hold time These hold times are true if an VO device is inter faced to the common memory and I O bus However if an I O peripheral is interfaced to the Auxiliary VO bus address hold time is no longer an issue as the address does not change until the next external I O oper ation For more information on I O timing please refer to the Rabbit 40009 Microprocessor User s Manual Some I O peripherals such as LCD controllers and Compact Flash devices require address and chip select hold times for both read and write operations If the peripheral is interfaced to the Auxiliary I O bus address hold time is not an issue If chip select hold time is required an unused auxiliary I O address line can be used to generate the chip select In situations where I O peripherals are interfaced to the common memory and I O bus address and chip select hold times can be extended under software control or with minor hardware changes Please refer to Technical Note 227 Interfacing External I O with Rabbit 2000 3000 Designs for additional information This document is available online at www rabbit com docs app_tech_notes shtml 10 rabbit com Core Design and Components 3 4 PC Board Layout and Memory Line Permutation To use the PC board real estate efficiently it is recommended that the address and data lines to memor
70. to the flash device and can only be accessed through this function This function writes a number of bytes from root memory to the User block NOTE Portions of the User block may be used by the BIOS for your board to store values such as calibration constants See the manual for your particular board for more information before overwriting any part of the User block Backwards Compatibility If the version of the System ID block doesn t support the User block or no System ID block is present then the 8 KB starting 16 KB from the top of the primary flash are designated the User block area However to prevent errors arising from incompatible large sector configurations this will only work if the flash type is small sector Rabbit manufactured boards with large sector flash will have valid System and User ID blocks so this should not be problem on Rabbit based boards If users create boards with large sector flash they must install System ID block version 3 or great er to use this function or modify this function PARAMETERS addr Address offset in User block to write to source Pointer to destination to copy data from numbytes Number of bytes to copy RETURN VALUE 0 Successful 1 Invalid address or range 2 No valid User block found block version 3 or later 3 Flash writing error LIBRARY IDBLOCK LIB Rabbit 4000 Designer s Handbook rabbit com 31 writeUserBlockArrav int writeUserBlockArrav unsigned addr void s
71. um internal clock frequency The oscillator frequency can be doubled and or divided by 2 4 6 or 8 giving a variety of operating speeds from the same crystal frequency In addition the 32 768 kHz oscillator that drives the battery backable clock can be used as the main processor clock To save the substantial power consumed by the fast oscillator it can be turned off and the processor can run entirely off the 32 768 kHz oscillator at 32 768 kHz or at 32 768 kHz divided by 2 4 8 or 16 This mode of operation sleepy mode has a clock speed in the range of 2 kHz to 32 kHz and a VDD_ core current consumption in the range of 14 to 22 uA depending on frequency and voltage Figure 9 1 Rabbit 4000 Clock Distribution E External 32 kHz 16 8 4 2 1 SE Crystal Oscillator evices NOTE Peripherals can not be clocked slower than the CPU To watchdog timer and time date clock Rabbit 4000 Designer s Handbook rabbit com 27 9 2 To Further Decrease Power Consumption In addition to the low power features of the Rabbit 4000 microprocessor other considerations can reduce power consumption by the system 9 2 1 What To Do When There is Nothing To Do For the very lowest power consumption the processor can execute a long string of mul instructions with the DE and BC registers set to zero Few if any internal registers change during the execution of a string of mul zero by zero and a memory cycle takes place o
72. website for more information www rabbit com support techNotes_whitePapers shtml 9 2 5 Software Support for Sleepy Mode In sleepy mode the microprocessor executes instructions too slowly to support most interrupts Data will probably be lost if interrupt driven communication is attempted The serial ports can function but cannot generate standard baud rates when the system clock is running at 32 768 kHz or below The 48 bit battery backable clock continues to operate without interruption Usually the programmer will want to reduce power consumption to a minimum for a fixed time period or until some external event takes place On entering sleepy mode by calling use32kHzOsc the peri odic interrupt is completely disabled the system clock is switched to 32 768 kHz and the main oscillator is powered down The device may be run even slower by dividing the 32kHz oscillator by 2 4 8 or 16 with the set 32kHzDivider call When the 32kHz oscillator is divided these slower modes are called ultra sleepy modes On exiting sleepy mode by calling useMainOsc the main oscillator is powered up a time delay is inserted to be sure that it has resumed regular oscillation and then the system clock is switched back to the main oscillator At this point the periodic interrupt is reenabled While in sleepy mode the user may call updateTimers periodically to keep Dynamic C time vari ables updated These time variables keep track of seconds and millis
73. y be permuted to minimize the use of PC board resources By permuting the lines the need to have lines cross over each other on the PC board is reduced saving feed through s and space For static RAM address and data lines can be permuted freely meaning that the address lines from the processor can be connected in any order to the address lines of the RAM and the same applies for the data lines For example if the RAM has 15 address lines and 8 data lines it makes no difference if A15 from the processor connects to A8 on the RAM and vice versa Similarly D8 on the processor could connect to D3 on the RAM The only restriction is that all 8 processor data lines must connect to the 8 RAM data lines If several different types of RAM can be accommodated in the same PC board footprint then the upper address lines that are unused if a smaller RAM is installed must be kept in order For example if the same footprint can accept either a 128K x 8 RAM with 17 address lines ora 512K x 8 RAM with 19 address lines then address lines A18 and A19 can be interchanged with each other but not exchanged with AQO A17 Permuting lines does make a difference with flash memorv and must be avoided in practical svstems 3 5 PC Board Lavout and Electromagnetic Interference Most design failures are related to the lavout of the PC board A good lavout results when the effects of electromagnetic interference EMI are considered For detailed information regarding th
74. ytes int numSectors number of sectors int flashSpeed innanoseconds long flash2ID Manufacturer ID Product ID 2nd flash int flash2Type Write method 2nd flash int flash2Size in 1000h pages 2nd flash int sector2Size byte size of 2nd flash s sectors 22 rabbit com The System Identification and User Blocks int int long int int int long char char char num2Sectors flash2Speed ramID ramSize ramSpeed CpuID crystalFreq macAddr 6 serialNumber 24 productName 30 number of sectors in nanoseconds 2nd flash Rabbit part in 1000h pages in nanoseconds CPU type ID in Hertz Media Access Control MAC address six device serial number NULL terminated string Begin new version 5 System ID block member structure SysIDBlockType2 idBlock2 End new version 5 System ID block member structure char long unsigned userBlockSize reserved 1 idBlockSize unsigned userBlockLoc int char idBlockCRC marker 6 SysIDBlock idblock reserved for later use size can grow number of bytes in the Sys IDBlock struct User block size in bytes right below ID block offset in bytes of start of User block from this one CRC of this block when this field is set to 0 should be 0x55 OxAA 0x55 OxAA 0x55 OxAA Rabbit 4000 Designer s Handbook rabbit com 23 7 1 2 Reading the System ID Block To read the ID blo
Download Pdf Manuals
Related Search
Related Contents
TRONZADORAS Manual - Oblamatik LG N1A1 User's Manual EU Careers Mode d`emploi de l`inscription en ligne UM1843 User manual - STMicroelectronics Manuale T5 Multitester Panasonic WV-SP509 CAD File Volvo Brochure Wheel Loader L60H L70H L90H Italian Copyright © All rights reserved.
Failed to retrieve file