• Realizes 51 essence monolithic integrated circuit’s online programming using the serial port with and the mouth

    Abstract: The detailed explanation use and the mouth simulate the I2C main line agreement, realizes Myson the MTV230 chip online programming (ISP) the process, as well as realizes the Winbond W78E516B online programming using the PC machine serial port correspondence (ISP) the process; Elaborates the PC machine serial port and the mouth in monolithic integrated circuit development application.

    Key word: And the mouth programming serial port correspondence online programs ISP MTV230 W78E516B

    Introduction

    1 online programming synopsis

      51 essence’s monolithic integrated circuit online programming patterns divide into two broad headings generally. One kind is uses the JTAG agreement the online programming pattern. This kind of pattern provides the online programming tool generally by the factory, the easy to operate. Uses this kind of pattern the monolithic integrated circuit price to be often high, the use manufacturer are not many, therefore not in this article row of discussion. Another kind of online programming pattern uses a special instruction, causes the monolithic integrated circuit to enter the online programming pattern. After entering the online programming pattern, wants to control to monolithic integrated circuit’s erase write logic. This kind of pattern may subdivide is two kind of different patterns: First, after entering the online programming pattern, the monolithic integrated circuit only provides a connection, no longer moves user’s procedure, scratches writes logic to provide by superior machine (PC), if the following needs to discuss MTV230 belongs to this kind of pattern; After another kind is enters the online programming pattern, the chip can move in some region user compilation procedure, chip programming logic by the chip in this section of programmed control, superior machine (PC) only takes a monolithic integrated circuit’s data pool, must scratch the data which to the monolithic integrated circuit transmission writes, like the following needs to discuss W78E516B.

    2 uses and mouth to MTV230 online programming realization

    2.1 MTV230 synopses

      MTV230 is one which produces by Myson Corporation integrates the OSD function based on 51 essence chips. It uses when the 12MHz crystal oscillator may establish as the frequency multiplication work, meanwhile integrated 4 group A/D and 4 group PWM DAC. And most competitive was it has used Flash the OSD fonts. Is different with the general OSD chip, its fonts are not the mask in the chip, the user may have custom-made. This model of chip may satisfy in the video frequency application the control demand, thus is widely applied in the video frequency class product.

    2.2 MTV230 online programming pattern entry

      Must enable MTV230 to have the online programming function, may increase section of procedures in the main application procedure. This procedure uses for to respond the specific monolithic integrated circuit condition, if some specific pin’s level fluctuation, perhaps the serial port receives the specific character by to determine whether can enter the online programming pattern. After carrying out the following procedure, MTV230 may enter online programming pattern [1]:

    ① The clear watch-dog, prevents in the programming period monolithic integrated circuit to reposition;

    ② Monolithic integrated circuit’s online programming pattern is carries on under idling condition (idle), must therefore close all interrupts, prevents the monolithic integrated circuit to awaken;

    ③ Because time MTV230 online programming is takes I2C from the equipment, thus must dispose monolithic integrated circuit’s I2C from the address;

    ④ Reads in 0×93 to ISPEN, enables the online programming function;

    ⑤ Enters 51 idle modes, online programming start.

    The concrete program is as follows:
    WDT=0; //1
    IE=0; //2
    ISPSLV=0×7C; //3
    ISPEN=0×93; //4
    PCON=0×01; //5

       In above procedure 1~5 and above explanation correspondence. The above the I2C address establishment is 0×7C. It is noteworthy that when establishes I2C from the address, lowest two invalid [1]. Carried out above the procedure, the monolithic integrated circuit already became I2C from the equipment, SCL and the chip 15 feet was connected I2C, SDA and the chip 16 feet were connected, might use the I2C agreement, carried on the online programming according to certain forms of field orders to the chip. The forms of field orders for details see reference [1], no longer gives unnecessary detail in this.

    2.3 PC machine I2C connection realization

      Carries on the online programming to MTV230, must realize the I2C communication protocol. Took carries on the programming to MTV230 superior machine PC, realized I2C to have three methods:

    ① The use serial port and the monolithic integrated circuit correspondence, simulate the I2C agreement again by the monolithic integrated circuit, the cost are high, the I2C speed regards the use the monolithic integrated circuit to decide;

    ② To the computer and the mouth programming, simulate the I2C agreement, the cost are low, the I2C speed is ordinary;

    ③ Uses the USB connection to realize the I2C agreement, the cost is high, in the I2C speed quick market may buy.

      Because MTV230 carries on time the programming, the I2C clock speed most is high is 140kHz, the speed request is not high, simultaneously considers the cost, the decision operational version②.

    2.4 and mouth I2C hardware’s realization

      Because and mouth each pin is unidirectional, can only output or the one-way input one way; But I2C and is a bidirectional agreement, also (sometimes SDA and SCL request both to be able to input can output must gain the SCL current condition), therefore, SDA and SCL must distinguish to output the pin and an input pin constitution respectively by one. In order to increase and the mouth driving force and the reliability, designa circuit as shown in Figure 1. And the mouth 2, 12 pins constitute the SDA foot, and the mouth 3, 10 pins constitute the SCL foot.
           
    2.5 and mouth I2C software’s realization

      Is simple in Win98 to and the mouth programming, through in inlays the assembly in VC, uses IN and the OUT instruction visit the port which corresponds with and the mouth, the establishment corresponds in port’s value position to be possible to control corresponding and the mouth pin height level value.

    For example: Must sets the computer and the mouth 1 2nd pin Gao Zaizhi to be low first, the assembly language may write like this:
    MOV DX, 0×378; Establishment port address
    MOV AL, 1; Will wait the position 0 values which reads to read in AL
    OUT DX, AL; Delivers the corresponding port the value
    MOV AL, 0
    OUT DX, AL

      But in Win2000/XP, because the system strengthened to the hardware equipment’s protection, if in procedure directly with IN and OUT instruction visit and mouth, will then initiate system’s illegal operation; But the mouth visit does not look like the serial port, may use Windows directly the API function, thus must use the driver. May arrive at www.sstnet.com website to download DriverLINX Port I/O Driver and the mouth driver. This procedure may the free duplication and the distribution. Had this driver, the compilation and the mouth procedure is very convenient under Win2000/XP. After installing this driver, contains corresponding dlportio.h and dlportio.lib after the procedure may use DlPortReadPortUchar (IN ULONG Port) to read port’s value (to be equal in assembly in instruction), (IN ULONG Port, IN UCHAR Value) comes with DlPortWritePortUchar to a port to write a specific value (to be equal in assembly the OUT instruction). Using a change port value’s in units place’s value, may of cause corresponding and the mouth pin output height level, thus may use its to simulate the I2C agreement, realizes and I2C correspondence between the mouth and monolithic integrated circuit’s. About the I2C agreement, on-line has many material, no longer gives unnecessary detail in this.

    2.6 procedure explanations

      If the preamble states, MTV230 after entering the online programming pattern, quite in I2C from the equipment, programming logic all by the procedure which moves on PC realizes. This procedure uses the VC6.0 compilation. Programming procedure’s main contact surface as shown in Figure 2, main module like table 1 arranges in order. Because simulates I2C with and the mouth to the monolithic integrated circuit programming, will cause this thread to occupy the blocking condition temporarily, if will realize this process in main thread (UI), when to chip programming, the procedure main contact surface will be unable to respond the user exit command, therefore has used the multithreading program structure, will realize this process in a work thread, will enable the user to be possible momentarily to withdraw from the programming process.
              
      Table 1 arranges in order the first three kinds have used the level design structure: The upper formation class transfer lower level class, the lower level class provides the connection for the upper formation class, like this designed has guaranteed the code biggest reusability. For example, if has another chip is similarly uses the I2C connection to carry on the online programming, so long as then rewrote MTVISP this chip the online programming agreement class to be possible; If front uses and the pretext which states at present the document 1 or 3, so long as the recomposition lowest level’s Parallel kind then may.
           
      Procedure work thread’s approximate flow as shown in Figure 3.
            
      Procedure characteristic:

    ① May establish the I2C speed the height, simulates I2C and the mouth address, as well as use and mouth pin.

    ② May choose the simple verification and verify completely, namely after programming the chip is carries on the built-in check register value the simple verification,
    In the chip content reads out and the programming document completely carries on the comparison the complete verification.

    ③ May to the chip procedure area, the OSD area carry on the programming, but may also read out these two areas the data (only then to be possible to establish enters online programming pattern procedure only then to be possible).

    ④ Carries on document support binary file form which the fever writes (*.bin) and Intel Hex document format (*.hex).

    3 using serial port to W78E516B online programming realization

    3.1 W78E516B synopses

      W78E516B is produces by Winbound Corporation based on 52 essence high performance chips, the exterior crystal oscillator may achieve 40MHz, the interior has the 64KB procedure area and the 4KB vectoring procedure area, as well as 256B RAM area and 256B AUX-RAM area. The AUX-RAM area is equal to the exterior memory block, after carrying on the register establishment, carries on the visit with the MOVX instruction. In the Keil compiler, carries on the corresponding establishment then to be possible to use the pdata type variable to visit.

    3.2 W78E516B online programming pattern entry

      The W78E516B online programming pattern enters may divide into two kind of patterns: One kind is the software pattern, another kind is the hardware pattern. After the chip enters the online programming pattern, the chip will skip from present’s 64KB procedure area to the 4KB guidance area 0×00 address place executive routine. If the preamble states, this type chip’s online programming logic is by in this 4KB guidance area procedure decision, but superior machine (PC) is only provides a data pool for the online programming.

    (1) software enters the pattern

    ① Reads in 0×87,0×59 to the CHPERN register according to this to open the CHPCON register to write the pattern.

    ② Closure interrupt.

    ③ Reads in the 0×03 expression to CHPCON to carry on the procedure area programming.

    ④ Reads in 0×00 to CHPCRN to close the CHPCON register to write the pattern.

    ⑤ Establishes the timer for the time delay 12μs initiation interrupt.

    ⑥ Changes over to the idle mode the monolithic integrated circuit, the opening interrupt.
    For example: Inlays the following procedure is in charge in the circulation, when the serial port receives the character “A” then enters the online programming pattern:
    if (in B_Temp== `A’{//B_Temp deposits receives from the serial port to the number
    TR0=0; // stop timer
    TH0=TL0=256-250; // establishment timer fixed time value
    CHPENR = 0×87; // opens CHPCON to write the pattern
    CHPENR = 0×59;
    CHPCON|=0×03; // opens the programming function
    CHPENR=0×00; // closes CHPCON to write the pattern
    TR0=1; // opening timer
    PCON=0×01; // changes over to the idle mode
    }

    (2) hardware enters the pattern

      If Table 2 arrange in order, establishes the corresponding pin as the corresponding level, will be carrying on the replacement later also to be possible to enter the online programming pattern. What value attention is, when chip normal work should avoid entering the online programming pattern by mistake, otherwise the consequence is inconceivable. Table 2 L represents the low level, X represents the random level.
                  
    3.3 W78E516B online programming realization

    (1) monolithic integrated circuit guidance area procedure

      W78E516B online programming logic mainly realizes in this subprograms. Has a demonstration procedure finally in reference [2], it is reads the data from exterior SRAM to carry on the programming to the 64KB procedure area. Rewrites it, becomes from the serial port read-in data. Carries on the renewal to the procedure area, the approximate flow and the demonstration procedure are the same, the code approximately is also same. Has the interest friend to be possible to read in literature [2] voluntarily the procedure source document, only lists the key change place in this:
    ; Uses the 24MHz crystal oscillator
    ; Uses the WAVE compiler
    ; And R3 has treats write data byte count - 1 high 16
    ; And R4 has treats write data byte count - 1 low 16
    JMP PROG_D_64K
    PADJUEST:
    INC R2; Increases the low address 1
    CJNE R2,#00H, PROG_D_64K
    INC R1; The low position carries when increases the top digit 1
    MOV SFRAH, R1; Change high address
    PROG_D_64K:
    MOV SFRAL, R2; Puts in the low address
    JNB RI,$; Receives the byte which from the serial port treats reads in
    MOV A, SBUF
    CLR RI
    MOV SFRFD, A; Will wait the value which reads to put in
    MOV TCON,#10H; Opens the timer
    MOV PCON,#01H; CPU enters the IDLE condition (to carry on programming)
    CLR C; Compared with R3, R4, looked whether to read in completes
    MOV A, R4
    SUBB A, R2
    JNZ PADJUEST
    CLR C
    MOV A, R3
    SUBB A, R1
    JNZ PADJUEST

    (2)PC machine procedure

      The PC machine procedure provides a data pool for the monolithic integrated circuit. This data is carries on the data transmission through the PC machine serial port. Procedure by the VC6.0 compilation, what serial port correspondence use is the VC bringing serial port controls MSCOMM. Because the MSCOMM receive data is by the news form, simultaneously the data quantity which receives in this procedure is very small, but transmits the data is the blocking pattern, therefore the newly opened work thread uses in transmitting the data, but receives the data and the main thread merge. The procedure whole uses the state machine pattern. When the monolithic integrated circuit carries on the cleaning, the programming, the verification and so on each condition, through the serial port to the PC machine transmission mode character, PC machine through the accepting state character decided that the monolithic integrated circuit present’s active status, and decided must data which provides to the monolithic integrated circuit. Simultaneously advocates in the thread to have a timer, if the monolithic integrated circuit does not have the reply in the special time, or the reply contains errors, then the newspaper is wrong, stops monolithic integrated circuit’s programming process. It is noteworthy that because used MSCOMM to control, in has not installed VC6.0 on the machine to move this procedure to the source document SYSTEM table of contents in three document copy to the system32 system directory under. Procedure main contact surface as shown in Figure 4. PC machine and monolithic integrated circuit correspondence’s work flow as shown in Figure 5.
                 
             
    Procedure characteristic:
    ① May establish the use the serial port with the baudrate which corresponds. (also wants corresponding revision with its corresponding 4KB guidance area’s in procedure).
    ② May establish causes the monolithic integrated circuit to enter the online programming pattern the character order.
    ③ Carries on document support binary file form which the fever writes (*.bin) and Intel Hex document format (*.hex).

    4 conclusions

      The use and the mouth simulate the I2C procedure to be possible on the gauge block MTV230 chip to carry on the online programming, the use serial port are conveniently W78E516B provide the data pool also to be possible to carry on the programming conveniently to it, both after the practice examination, the procedure completely serve the anticipated purpose. The use chip’s online programming technology, has facilitated the chip procedure renewal, reduced the product maintenance cost.

    Share/Save/Bookmark

    Saturday, September 6th, 2008 at 19:42
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

TOP
Copyright © 51 Research and Design, Electronic Engineers website - Embedded Systems, MCU, DSP, EDA, Test and Measurement, Components, Communications, Power, Microelectronics, Semiconductors
Powered by WordPress | Theme by mg12 | Valid XHTML 1.1 and CSS 3