Part Number Hot Search : 
T4700M CWTF4 U8310A URS120 T1800C 14014 JAN2N JAN2N
Product Description
Full Text Search
 

To Download AN2430 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  january 2007 rev 3 1/24 AN2430 application note str75x systemmemory boot mode introduction this application note describes the features of the systemmemory boot mode developed for str75x flash microcontrollers providing all the basic functionality to support the programming of the embedded flash. as well as the general features, this document also covers the specific features of the uart boot mode. note: the bootloader feature is unavailable on some devices soldered on development tools (starter kits or evaluation boards). please refer to section 4 on page 22 for further information. www.st.com
contents AN2430 2/24 contents 1 general description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1 entering systemmemory boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 hardware requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 using systemmemory boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 command description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.4.1 get command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.4.2 read memory command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.4.3 go command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.4.4 write memory command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.5 erase command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.6 write protection command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.7 write unprotection command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.4.8 readout permanent protect command . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.4.9 readout temporary unprotect command . . . . . . . . . . . . . . . . . . . . . . . 15 1.4.10 readout permanent unprotect command . . . . . . . . . . . . . . . . . . . . . . . 16 1.5 exiting systemmemory boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.6 systemmemory code program flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2 uart systemmemory boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.1 uart systemmemory code sequence . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.2 choosing the uart baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.2.1 minimum baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.2.2 the maximum baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.2.3 higher baud rate deviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3 conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4 bootloader availability limitati ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
AN2430 general description 3/24 1 general description the str75x is usually woken up in systemme mory boot mode when the flash is still not programmed in the manufacturing line environment. in this case the system boot is performed from systemmemory sector in the flash bank0. this mode allows initialization of the flash programming via a serial interface and the use of the internal free running oscillator. 1.1 entering systemmemory boot mode the str75x enters the systemmemory boot mode if the boot pins are configured as follows: boot0 = 1 boot1= 0 the value of the boot pin is latched on the 4th rising edge of ck_sys after reset. after reset, the str75x cpu begins execution of the systemmemory code which resides in the systemmemory sector. table 1. str75x device configuration in systemmemory boot mode 1.2 hardware requirements the hardware required to put the str75x into systemmemory boot mode consists of any circuitry, switch, or jumper capable of holding the boot0 pin high and the boot1 pin low during reset. to connect to the str75x during systemmemory boot mode, a rs232 serial interface must be directly linked to uart0 pins. for more details, refer to the str75x hardware development getting started application note (an2419). feature/peripheral state comment instruction set thumb save code space with 16-bit instructions cpu mode supervisor full access with irq enabled and fiqs disabled input clock internal freeosc allow a frequency in a range of 2 to 10mhz uart0_rx pin input uart0 receive uart0_tx pin output uart0 transmit uart0 registers default only configured for uart boot
general description AN2430 4/24 1.3 using systemmemory boot mode the systemmemory boot mode is executed from ram and uses the last 4k of 16k ram, i.e. from 0x40003000 to 0x40003fff. so when downloading code to ram, the user has to consider only the 12k ram (from 0x40000000 to 0x40002fff). after the serial link initialization sequence (see the following chapters) the systemmemory code waits for the user to run some commands. the supported commands are listed in the table below. table 2. allowed commands command command code command description get 0x01 get the systemmemory version and the number of times the readout protection is disabled/enabled. read memory 0x11 read until 256 bytes of memory starting from an address specified by the user go 0x21 jump to an address specified by the user to execute a loaded code write memory 0x31 write until 256 bytes to the ram or the flash starting from an address specified by the user erase 0x43 erase from one to all the flash sectors write protection 0x63 permanently enable the write protection for the needed sectors write unprotection 0x71 temporarily disable th e write protection for all flash sectors readout permanent protect 0x82 permanently enable the the readout protection readout temporary unprotect 0x91 temporarily disable the readout protection readout permanent unprotect 0x92 permanently disable the readout protection
AN2430 general description 5/24 1.4 command description 1.4.1 get command description: this command allows the user to get the version of the bootloader, the number of times the readout protection is both disabled and enabled. when the bootloader receives the get command, it transmits four bytes to the user: the first byte contains the version, the second contains the number of times the readout protection is disabled, the third contains the number of times it?s enabled and finally the ack byte. figure 1. get command flowchart start gc received byte no == 0x01? send nack byte send the version of the bootloader send the number of times the readout send ack byte end of gc send the number of times the readout protection is disabled protection is enabled
general description AN2430 6/24 1.4.2 read memory command description: this command allows the user to read the memory (ram, flash and registers). when the bootloader receives the read memory command, it transmits the ack byte. after the transmission of the ack byte, the bootloader waits for an address (4 bytes, byte 1 is the msb and byte 4 is lsb of the address), checks this address, if the address is valid, it transmits an ack byte otherwise it transmits a nack byte (0x3f) and exits from the command. when the address is valid, the bootloader waits for the number of bytes to be transmitted (n bytes) and then returns to the user the needed data ((n + 1) bytes) starting from the received address. figure 2. read memory flowchart start rm received byte no == 0x11? send ack byte receive the start address (4 bytes) send ack byte receive the number of bytes to be read end of rm valid address? no send nack byte send data to the user (1 byte)
AN2430 general description 7/24 1.4.3 go command description: this command allows the user to execute the downloaded code or any other code by making a branch to an address specified by the user. when the bootloader receives the go command, it transmits the ack byte. after the transmission of the ack byte, the bootloader waits for an address (4 bytes, byte 1 is the msb and byte 4 is lsb of the address), checks this address, if the address is valid, it transmits an ack byte otherwise it returns a nack byte (0x3f) and exits from the command. when the address is valid, the program counter of the cpu jumps automatically to this address. therefore, the systemmemory boot mode is exited. note: during systemmemory mode, the cpu is in thumb state. figure 3. go command flowchart start go received byte no == 0x21? send ack byte receive the start address (4 bytes) send ack byte jump to start address end of go valid address? no send nack byte exit systemmemory boot mode
general description AN2430 8/24 1.4.4 write memory command description: this command allows the user to write data to any address memory (ram, flash or registers). when the bootloader receives the write memory command, it transmits to the user the ack byte. after the transmission of the ack byte, the bootloader waits for an address (4 bytes, byte 1 is the msb and byte 4 is lsb of the address), checks this address, if the address is valid, it transmits an ack byte otherwise it returns a nack byte (0x3f) and exits from the command. when the address is valid, the bootloader: gets a byte which describes the amount of data to be received (n bytes), receives the user data ((n + 1) bytes), programs the user data to memory starting from the received address, finally, at the end of the command, the bootloader transmits the ack byte if the write operation is completed successfully otherwise a nack byte (0x3f) is returned and the command is exited.
AN2430 general description 9/24 figure 4. write memory command flowchart start wm received byte no == 0x31? send ack byte receive the start address (4 bytes) send ack byte end of wm valid address? no send nack byte receive the number of bytes to be written write the received data to ram ram address? no send ack byte from the start address write the received data to flash from the start address write error? no (1 byte)
general description AN2430 10/24 1.4.5 erase command description: this command allows the user to erase from one to all the sectors of the flash memory. when the bootloader receives the sector erase command, it transmits the ack byte. after the transmission of the ack byte, the bootloader waits for the number of bytes to be received (number of sectors to be erased) and then receives from the user the flash sectors codes. finally, at the end of the command, the bootloader transmits the ack byte if the erase is completed successfully otherwise a nack byte (0x3f) is returned and the command is exited. the erase command procedure is as follows: 1. receive one byte which contains the number (n) of sectors to be erased.here, n can be a value from 0 to 9, 2. receive (n + 1) bytes, each byte contains a sector code. below all the str75x sector codes. table 3. sector codes flash sector sector code bank 0 sector 0 0x00 bank 0 sector 1 0x01 bank 0 sector 2 0x02 bank 0 sector 3 0x03 bank 0 sector 4 0x04 bank 0 sector 5 0x05 bank 0 sector 6 0x06 bank 0 sector 7 0x07 bank 1 sector 0 0x10 bank 1 sector 1 0x11
AN2430 general description 11/24 figure 5. erase command flowchart start er erase error? no send ack byte send ack byte receive the number of sectors end of er send nack byte to be erased (1 byte) receive the sector codes erase the correspondent sectors received byte == 0x43? ye s
general description AN2430 12/24 1.4.6 write protection command description: this command allows the user to permanently enable the write protection for one, many or all flash sectors. when the bootloader receives the write protection command, it transmits the ack byte to the user. after the transmission of the ack byte, the bootloader waits for the number of bytes to be received (sectors to be protected) and then re ceives from the user the flash sectors codes. finally, at the end of the command, the bootloader transmits the ack byte if the write protection is enabled successfully otherwise a nack byte (0x3f) is returned and the command is exited. the write protection command procedure is as follows: 1. receive one byte which contains the number (n) of sectors to be write protected. here, n can be a value from 0 to 9, 2. receive (n + 1) bytes, each byte contains a sector code. refer to table 3 on page 10 for the str75x sector codes. figure 6. write protection command flowchart start pr protection error? no send ack byte send ack byte receive the number of sectors end of pr send nack byte to be write protected (1 byte) receive the sectors codes protect the correspondent sectors received byte == 0x63? ye s
AN2430 general description 13/24 1.4.7 write unprotection command description: this command allows the user to temporarily disable the write protection for all the flash sectors. when the bootloader receives the write unprotection command, it transmits to the user the ack byte. after the transmission of the ack byte, the bootloader disables the write protection for all the flash sectors. finally, at the end of the command, the bootloader transmits the ack byte if the unprotection is completed successfully otherwise a nack byte (0x3f) is returned to the user and the command is exited. figure 7. write unprotection command flowchart start un received byte no == 0x71? send ack byte disable the write protection for all send ack byte end of un unprotection error? send nack byte the flash sectors ye s
general description AN2430 14/24 1.4.8 readout permanent protect command description: this command allows the user to permanently enable the readout protection for the entire flash. when the bootloader receives the readout permanent protect command, it transmits to the user the ack byte. after the transmission of the ack byte, the bootloader permanently enables the readout protection for the entire flash. finally, at the end of the command, the bootloader transmits the ack byte if the readout protection is completed successfully otherwise a nack byte (0x3f) is returned to the user and the command is exited. note: when the readout protection is enabled only the following commands are available: ? the get command, ? the readout temporary unprotect command, ? the readout permanent unprotect command. when the readout protection is enabled, in order to boot from the systemmemory it is mandatory to reset to ground the pin njrst. figure 8. readout permanent protect command flowchart start rop_prm received byte no == 0x82? send ack byte permanently enable the readout send ack byte end of rop_prm protection error? send nack byte protection for the entire flash ye s
AN2430 general description 15/24 1.4.9 readout tempor ary unprotect command description: this command allows the user to temporarily disable the readout protection for the entire flash. when the bootloader receives the readout temporary unprotect command, it transmits the ack byte. after the transmission of the ack byte, the bootloader erases all the flash sectors then temporarily disables the readout protection for the entire flash. if an error occurs during the erase operation the command is exited and the readout protection remains enabled. finally, at the end of the command, the bootloader transmits the ack byte if the readout unprotection is completed successfully otherwise a nack byte (0x3f) is returned to the user and the command is exited. figure 9. readout temporary unprotect command flowchart start rou_tmp received byte no == 0x91? send ack byte temporarily disable the readout send ack byte end of rou_tmp protection error? send nack byte protection for the entire flash ye s erase all the flash sectors erase error? ye s
general description AN2430 16/24 1.4.10 readout permanent unprotect command description: this command allows the user to permanently disable the readout protection for the entire flash. when the bootloader receives the readout permanent unprotect command, it transmits the ack byte to the user. after the transmission of the ack byte, the bootloader erases all flash sectors then permanently disables the readout protection for the entire flash. if an error occurs during the erase operation the command is exited and the readout protection remains enabled. finally, at the end of the command, the bootloader transmits the ack byte if the readout unprotection is completed successfully otherwise a nack byte (0x3f) is returned to the user and the command is exited. figure 10. readout permanent unprotect command flowchart start rou_prm received byte no == 0x92? send ack byte permanently disable the readout send ack byte end of rou_prm protection error? send nack byte protectionfor the entire flash ye s erase all the flash sectors erase error? ye s
AN2430 general description 17/24 1.5 exiting systemmemory boot mode systemmemory boot mode must be exited in order to execute a program in a normal user mode. the str75x may exit this mode by applying a hardware reset . at the time of reset, the boot pins (boot0 and boot1) must be set at the proper levels to enter the desired user mode. following the reset, the str75x cpu begins executing code from location 0x00000000. table 4. mode pin vs. memory mapping 1.6 systemmemory code program flow figure 11. systemmemory code program flow boot1 boot0 boot mode aliasing note 0 0 embedded flash embedded flash sector b0f0 mapped at 0h all flash sectors accessible except systemmemory sector 1 0 embedded sram embedded sram mapped at 0h - 0 1 systemmemory systemmemory mapped at 0h - 1 1 external smi smi bank 0 mapped at 0h - start falling edge on uart0 rx? no start timer base no stop timer base initialize uart0 send acknowledge wait for a command done falling edge on uart0 rx ? clear the bit 22 of the flash control register (remap)
general description AN2430 18/24 figure 11 shows the program flow of the systemmemory code. a few points worth noting are: not all the commands are available when readout protection is active, for more details about the allowed commands please refer the section readout permanent protect command . the uart interface is only initia lized if uart boot mode is detected. note: the str75x timer base (tb) is used to automatically detect the serial baud rate. once initialized the uart configuration is 8-bits , no parity , and 1 stop bit .
AN2430 uart systemmemory boot mode 19/24 2 uart systemmemory boot mode 2.1 uart systemmemory code sequence after systemmemory mode is entered and the str75x is configured as described above, the systemmemory code begins to scan the rxd0 line, waiting to receive a 0x7f data. (one start bit, 0x7f data bits, and one stop bit). the duration of this data byte is measured using the timer base. the count value of the timer is then used to calculate the corresponding baud rate factor with respect to the current system clock. next, the code initializes the serial interface accordingly, and sets up pin txd0 to an alternate function, push-pull output. using this calculated baud rate, an acknowledge byte is returned to the host which signals that the str75x is ready to receive user commands. note: the acknowledge byte is 0x75 for the str75x devices. 2.2 choosing the uart baud rate the calculation of the serial baudrate for uart0, from the length of the first byte that is received, allows the operation of the str75x systemmemory bootloader within a wide range of baud rates. however, the upper and lower limits have to be kept, in order to ensure proper data transfer. baud rate divider = f cpu / (16 * str75x baud rate) the str75x uses the timer base to measure the length of the initial byte. the quantization uncertainty of this measurement implies the first deviation from the theoretical baud rate. the next deviation is implied by the computation of the baud rate divider reload value from the timer contents. the formula below shows the association: tb_cnt / 8 = 1 bit time in f cpu (8 bit times the first byte) baud rate divider = tb_cnt / 8 / 16 = tb_cnt / 128 for a correct data transfer from the host to the str75x, the maximum deviation between the internal initialized baud rate for uart0 and the real baud rate of the host should be below 2.5%. the deviation (f b , in percent) between the host baud rate and str75x baud rate can be calculated via the formula below: f b = abs( (str75x baud rate - host baud rate) / str75x baud rate) * 100% f b <= 2.5% note: function (f b ) does not consider the tolerances of os cillators and other devices supporting the serial communication. this baud rate deviation is a non linear fu nction depending on the cpu clock and the baud rate of the host. the maximum of the function (f b ) increases with the host baud rate. this is due to the smaller baud rate pre-scale factors, and the implied higher quantization error. 2.2.1 minimum baud rate b low is the minimum baud rate determined by the maximum count capacity of timer base when measuring the first byte. this will be direct ly related to system clock frequency. using the maximum tb_cnt value of 65535 in the equations above we end up with a minimum
uart systemmemory boot mode AN2430 20/24 baud rate of 1220 at f cpu = 10mhz. the lowest standard baud rate for this case would be 2400. baud rates below b low would cause tb to overflow. if this occurs, it would not be possible to properly initialize the uart0. 2.2.2 the maximum baud rate b high is the highest baud rate in which the devi ation still does not exceed the limit. all baud rates between b low and b high are below the deviation limit. using the minimum tb_cnt value of 1in the equations above we end up with a maximum baud rate of 125000 at f cpu = 2mhz. the highest standard baud rate for this case would be 115000. 2.2.3 higher baud rate deviations a baud rate may be used as long as the actual deviation does not exceed the limit. certain lower baud rates may violate the deviation limit, while an even higher baud rates stays very well below it. this relationship depends on the host interface.
AN2430 conclusion 21/24 3 conclusion the str75x systemmemory loader provides a convenient method for downloading user code into on chip memories for a variety of applications. the uart interface provides an easy and inexpensive, readily available serial link for desktop users.
bootloader availability limitations AN2430 22/24 4 bootloader availability limitations the bootloader feature is unavailable on some devices soldered on development tools (starter kits or evaluation boards). please check the date code written on the device. this date code consists of 3 digits and is located as shown in figure 12 below. if the device soldered on the board displays a date code below 636, the bootloader feature is not activated. note: if available, the bootloader version number (currently at v1.1) can be obtained through the use of the get command. refer to section 1.4.1 on page 5 for further details. st wants to highlight that this issue only impacts devices soldered on a development tool with the affected date codes. any sample ordered separately from st (or its distributors) has the bootloader feature enabled (even if date code is below 636). to those affected by this issue, st offers the following recommendations: use str750 samples ordered separately (for example for building application prototypes) to test the bootloader functionality. use the free sample service from www.st.com . from the home page, type the correct order code in the "search part #" field. from the results page, click the green "samples" button and follow the procedure. if the "samples" button is not available, the stock is in the process of being renewed and can be checked again at a later date. for further options or information, please contact your local distributor or st sales office. figure 12. datecode marking on device a b cd e f g hi j l a areas h and i on the device marking represent the date code in the following manner: h : year (y) i : week (ww)
AN2430 revision history 23/24 5 revision history date revision changes 27-sep-2006 1 initial release 1-dec-2006 2 section 4: bootloader availability limitations on page 22 added 08-jan-2007 3 all references to gpio0.4 pin removed section 1.7 removed
AN2430 24/24 please read carefully: information in this document is provided solely in connection with st products. stmicroelectronics nv and its subsidiaries (?st ?) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described he rein at any time, without notice. all st products are sold pursuant to st?s terms and conditions of sale. purchasers are solely responsible for the choice, selection and use of the st products and services described herein, and st as sumes no liability whatsoever relating to the choice, selection or use of the st products and services described herein. no license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. i f any part of this document refers to any third party products or services it shall not be deemed a license grant by st for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoev er of such third party products or services or any intellectual property contained therein. unless otherwise set forth in st?s terms and conditions of sale st disclaims any express or implied warranty with respect to the use and/or sale of st products including without limitation implied warranties of merchantability, fitness for a parti cular purpose (and their equivalents under the laws of any jurisdiction), or infringement of any patent, copyright or other intellectual property right. unless expressly approved in writing by an authorized st representative, st products are not recommended, authorized or warranted for use in milita ry, air craft, space, life saving, or life sustaining applications, nor in products or systems where failure or malfunction may result in personal injury, death, or severe property or environmental damage. st products which are not specified as "automotive grade" may only be used in automotive applications at user?s own risk. resale of st products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by st for the st product or service described herein and shall not create or extend in any manner whatsoev er, any liability of st. st and the st logo are trademarks or registered trademarks of st in various countries. information in this document supersedes and replaces all information previously supplied. the st logo is a registered trademark of stmicroelectronics. all other names are the property of their respective owners. ? 2007 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia - belgium - brazil - canada - china - czech republic - finland - france - germany - hong kong - india - israel - ital y - japan - malaysia - malta - morocco - singapore - spain - sweden - switzerland - united kingdom - united states of america www.st.com


▲Up To Search▲   

 
Price & Availability of AN2430

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X