Professional Documents
Culture Documents
Procedure _V1.30
Smart Machine Smart Decision
1 Summary
This document describes the procedure of downloading code to SIM900 series modules from PC
side via serial port.
2 Procedure
Every time when SIM900 series module is powered on, the system will start from BOOT ROM.
The summary figure of program downloading procedure is as following:
SIM900
PC side series
module
1.Check synchronization byte (within
startup 50ms)
2.Download Intel HEX file
3.Reset download serial port baud rate (0x07)
4.Set flow control method (0x05)
5.Read FLASH Manufacturer information
(0x16)
6.Set FLASH erase area (0x09)
7.Erase FLASH (0x03)
Erase one block, return 0x38[1]
Note
1. Here the setting of the module and the PC side download serial port are both as following:
115200bps, 8 bit, No parity bit, 1 stop bit, no flow control.
If command process Download HEX file is successful, then PC side could reset module download
serial port baud rate:
PC side will send command Reset download serial port baud rate to the module with old baud rate
(115200bps), if the module decides this baud rate is effective, it will send change successful
response to PC side immediately with old baud rate.
After that, module download port will be actively changed to this new baud rate, the possible baud
rate settings are: 9600,19200, 38400, 57600,115200,230400,460800921600.
(The setting of serial port will not be changed, it is: 8 bit, No parity bit, 1 stop bit, no flow control.)
Refer to the following figure for command process:
When the command process Reset download serial port baud rate is finished, PC side will send
command Set flow control method to set flow control method, here it is set to 0, which means no
flow control. Refer to the following figure for command process:
SIM900
PC side series
module
When the command process Set flow control method is successfulPC side may send command
Read FLASH manufacturer information to read FLASH information, and set FLASH parameters.
Refer to the following figure for command process:
SIM900
PC side series
module
Read FLASH manufacture information
0x16,0x00,0x00,0x00,0x90
Start address:
0x90000000
Return header
(constant platform)
0x16
Return FLASH information
0x20,0x00,0xC0,0x88,0xFF,0xFF,0xFF,0xFF
Configure FLASH according to the return Different FLASH return
FLASH information, different information.
0x40,0x00,0x7F,0x00,0x08,0x08,0x00,0x01,0x00, Here is ST 64M FLASH
0x02,0x02,0x02,0x02,0x03,0x02 Different FLASH return
dif f e r e nt inf or ma tio n .
Return FLASH size according to the configuration Here is ST 64M FLASH
0x00,0x00,0x80,0x00
Different FLASH return
different information.
Here is ST 64M FLASH
Erase size:0x00269900
(base on the reality)
Start address:
0x90000000
Return header (base on the reality)
0x09
When PC side sends command FLASH ERASE, module will return 0x03 immediately;
After that, module will perform actual erase work to the FLASH area; Every time a FLASH block is
erased, module will send an '8' to PC side, until all blocks are erased completely.
When erase is finished, module sends character '0' to PC side to show erase successful.
It can go to the next procedure.
Note:
1. The time consuming to erase FLASH is different according to different area size. For example:
To erase an area of 2.4M may cost about 30 seconds.
Refer to the following figure for command process:
When PC side finishes command process Set Download Code Information, the length information
of the command Download Code Segment Data can be setthe maximal value of this length is
2048 (0x800). The length should be even number, it cannot be odd number. Refer to Figure 2-12.
Every time when the command process Set Download Code Segment is finished, it should
Download Code Segment Data.
Now PC side only needs to send data of the designated length which is set by command Set
Download Code Segment.
When module receives designated length and return (0x2E,0x30)it means receiving code segment
data successful.
Refer to Figure 2-12 for command process.
Note:
1. For one round of download procedure, the sum of all data length designated in "Download
Code Segment Data" command should equal to the actual download data size. Downloaded data
will be saved in FLASH area sequentially during "Download Code Segment Data" process.
After downloaded file data, PC side send compare download information instruction, and send
download start address(32bit,LE), checksum(32bit,LE), file size (32bit,LE) to the module.
When module received this instruction, it will return the newly generated checksum (32bit,LE) by
the file it received to PC side. If two results are identical (0x30), that means successfully download,
otherwise, download failed.
Refer to the following figure for command process:
After PC side send Compare download information command, executing SET FLASH ERASE
AREA and FLASH ERASE commands in turn to accomplish erasing checksum correctness flag
bit in FLASH area. PC side uses command SET FLASH ERASE AREA to set target start address
of FLASH ERASE area (32bit,LE) and erase size (32bit,LE).
When module receives this command, it will return 0x09 immediately to confirm setting successful.
Refer to the following figure for command process:
When PC side sends command FLASH ERASE, module return 0x03 immediately;
After that, module will perform actual erase work to the FLASH area;Every time a FLASH block is
erased, module will send an 8 to PC side, until all blocks are erased completely.
When erase is finished, module sends character '0' to PC side to show erase successful.
It can go to the next procedure. Refer to the following figure for command process:
Every time when command process Download Code Segment Setting is finished, it needs to
Download Code Segment Data with the length designated by the command Download Code
Segment Setting.
When the module receives the data with the specified length, it will return (0x2E,0x30), that means
receiving code segment data successful. Refer to Figure 2-12 for command process:
PC side sends Compare download information command, then execute SET FLASH ERASE
AREA and FLASH ERASE procedure in turn to accomplish erasing checksum correctness flag
bit.
PC side uses SET FLASH ERASE AREA command to set target start address of FLASH ERASE
area (32bit,LE) and erase size(32bit,LE).
When module receives this command, it will return 0x09 immediately to confirm setting successful.
Refer to the following figure for command process:
When PC side sends FLASH ERASE command, the module will return 0x03 immediately;
Then, the module performs actual erase work; once a block of FLASH is erased, the module will
return a successful byte (character '8') to PC side until all blocks are erased.
After erasing all blocks, the module will return a byte (character '0') to indicate successful erasing.
It can go to the next procedure. Refer to the following figure for command process:
Refer to the following figure: When PC side finishes command process Set Download Code
Information, the length information of the command Download Code Segment Data can be set
the typical value of this length is 2048 (0x800).
Every time when the command process Set Download Code Segment Setting is finished, it should
Download Code Segment Data.
Now PC side only needs to send data of the designated length which is set by command Set
Download Code Segment.
When module receives designated length and return (0x2E,0x30)it means receiving code segment
data successful. Refer to Figure 2-21 for command process:
Reset instruction can be sent after PC side accomplished write update successful flag. About
10seconds later, the module will reset itself, Refer to the following figure:
Reset module, if the synchronization byte (0x16) is not received within 50 ms, module will go into
normal procedure and start to run the newly downloaded program.
SIM900 Series modules download procedure_V1.30 17 2012.09.28
Smart Machine Smart Decision
3 Command
Downloading code from PC side to SIM900 series module needs a series of commands interaction through serial port; Command always started from PC side, and the
module response the corresponding command; Refer to the following commands:
Contact us:
Shanghai SIMCom Wireless Solutions Ltd.
Add: Building ASIM Technology BuildingNo.633Jinzhong RoadChangning
District, Shanghai,P. R. China 200335
Tel: +86 21 3235 3300
Fax: +86 21 3235 3020
URL: www.sim.com/wm