| Electronic Components Datasheet Search |
|
AN1796 Datasheet(PDF) 15 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1796 Datasheet(HTML) 15 Page - STMicroelectronics |
|
15 / 17 page ![]() 15/17 FIELD UPDATES FOR FLASH BASED ST7 APPLICATIONS USING A PC COMM PORT BYTECOUNT. GETBINARY is called twice more to retrieve the high and low bytes of the 16 bit load address, which is stored in variable LOADADDRESS. At label B002 a code loop is formed that will read all of the data bytes from the character stream and store them in the linear buffer FLASHBUFFER. At label B003 the checksum is read form the character stream and stored as variable CHECKSUM. This program does not make use of the checksum but it is made available here for any future enhancements. Now the subroutine RAMCODE is called. The label RAMCODE is actually the 40 byte block of RAM where the flash writing routine was copied from flash at power-up initialization. We will now examine the code at label FLASHPROGRAMMER. First, the x pointer is cleared and the flash programming latches are enabled. Label FP004 is the top of the program loop. The test for the normal exit condition from the loop is at the top of the loop. When the pointer is equal to the byte count then execution transfers to label FP005. Be- fore the loop is exited, each byte in the linear FLASHBUFFER is written to its proper load ad- dress. The low byte of the destination address is also checked to see if it has crossed any 32 byte sector boundary (any change in the upper 11 address bits). This check is necessary be- cause of the hardware of the flash programming latch. The latch only has five address lines and thus the upper 11 address lines must not change during a single write sequence or writing will “wrap around” and start overwriting earlier data. If the load address is about to cross a 32 byte sector line then the program must fall out of the loop and activate the flash programming sequence with the bytes it has transferred so far. At label FP006 the program waits until the hardware programming of the flash is complete and then transfers back to label LATCHEN- ABLE where transfer continues until the pointer is equal to the BYTECOUNT, at which point a programming pulse is applied to complete the programming of the last of the bytes from the S- Records line. The subroutine will then return back to the main program at label WAITFORCR where the program will wait to receive the carriage return which terminates the S-Records line and then jump back to label B001. Back at B001 we are ready to receive and handle any additional S1 records until, eventually, an S9 record is received. This will cause execution to transfer to label GOTS9 where the pro- gram will read and discard characters until the carriage return that terminates the S9 record is recognized. At that point the program forces a cold reset to occur by starting the watchdog timer and then falling into an endless loop at label GOTS9A until the watchdog times out and forces a hardware reset. The cold reset is needed to “lock up” the flash memory array against any further writes. The ST7 does not include a “reset” instruction so the watchdog was used to force the situation. |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |