The above and other objects, advantages and features of the present invention will be more apparent from the following description of certain preferred embodiments taken in conjunction with the accompanying drawings, in which:
The invention will be now described herein with reference to illustrative embodiments. Those skilled in the art will recognize that many alternative embodiments can be accomplished using the teachings of present invention and that the invention is not limited to the embodiments illustrated for explanatory purposes.
Hereinafter, the present invention will be described with reference to a data writing system (data transfer system) which includes a microcomputer on which a flash memory is mounted (data processing apparatus) and a flash writer for transferring data to be written into the flash memory (data transmitting and receiving device). The flash memory may be another memory, for example, an EEPROM or a ferroelectric random access memory (FeRAM).
The flash writer 11 has a WSCK terminal 110, a WSO terminal 111, a WSI terminal 112, a WOA terminal 113, a WOB terminal 114, and a WI terminal 115. The flash microcomputer 12 has an MSCK terminal 120, an MSI terminal 121, an MSO terminal 122, an MRST terminal 123, and an MMODE terminal 124.
The WSCK terminal 110 is connected with the MSCK terminal 120 through an SCK signal line. A serial clock (SCK signal) is transmitted from the flash writer 11 to the flash microcomputer 12 through the SCK signal line. The WSO terminal 111 is connected with the MSI terminal 121 through a WDATA line. A serial data signal (WDATA signal) is transmitted from the flash writer 11 to the flash microcomputer 12 through the WDATA line. The WSI terminal 112 is connected with the MSO terminal 122 through an MDATA line. A serial data signal (MDATA signal) is transmitted from the flash microcomputer 12 to the flash writer 11 through the MDATA line. The WOA terminal 113 is connected with the MRST terminal 123 through an RST signal line. A reset signal (RST signal) is transmitted from the flash writer 11 to the flash microcomputer 12 through the RST signal line. The WOB terminal 114 is connected with the MMODE terminal 124 through an MODE signal line. An operation mode set signal (MODE signal) is transmitted from the flash writer 11 to the flash microcomputer 12 through the MODE signal line.
The WI terminal 115 is a data input terminal for inputting, to the flash writer 11, write data which is data to be written, or the like into the flash memory contained in the flash microcomputer 12. A handshake leased line is not provided between the flash writer 11 and the flash microcomputer 12.
Next, the flash writer 11 will be described in detail with reference to
The CPU 21 is connected with the bus 25 and can access the ROM 22, the SRAM 23, and the I/F section 24 through the bus 25.
The ROM 22 is connected with the bus 25. The ROM 22 stores a program for controlling the flash writer 11. The program is read by the CPU 21 and executed thereby to control the flash memory 11.
The SRAM 23 is connected with the bus 25. The SRAM 23 is used to store data input from an input terminal such as the WI terminal 115 and store programs read out from the ROM 22 by the CPU 21.
The I/F section 24 is connected with the bus 25 and the six terminals shown in
The port section 240 is connected with the six terminals shown in
The port control section 241 outputs, to the port section 240, control signals for setting the respective terminals of the flash writer control microcomputer 20 and controlling logic levels of output signals. The port control section 241 is connected with the bus 25. Signals output from the port control section 241 are controlled based on instructions from the CPU 21.
The serial transmission and reception control section 242 is connected with the bus 25 and the port section 240 and controls serial communication in the case where a terminal of the flash writer control microcomputer 20 is set as a serial communication terminal. To be specific, serial data which is transmitted from the flash microcomputer 12 and input from the port section 240 is captured in synchronization with the serial clock. The captured serial data is converted into parallel data of plural bits and output to the CPU 21 or the SRAM 23. Parallel data of plural bits which is input from the CPU 21 or the SRAM 23 is converted into serial data and output to the flash microcomputer 12 through the port section 240 in synchronization with the serial clock. Data parallel/serial (serial/parallel) conversion can be performed by, for example, a shift register.
The serial clock generating portion 243 is connected with the port section 240 and the serial transmission and reception control section 242. The serial clock generating portion 243 generates the serial clock in response to a control signal from the serial transmission and reception control section 242 and outputs the generated serial clock to the port section 240 and the serial transmission and reception control section 242.
In the case of
The flash microcomputer 12 will be described in detail with reference to
The CPU 30 is connected with the bus 35 and can access the flash memory 31, the ROM 32, the SRAM 33, and the I/F section 34 through the bus 35. The CPU 30 is connected with the MRST terminal 123 and the MMODE terminal 124. The CPU 30 performs reset processing (initialization processing) on the flash microcomputer 12 in response to the RST signal input through the MRST terminal 123. The CPU 30 sets an operation mode of the flash microcomputer 12 based on the MODE signal input through the MMODE terminal 124. The operation mode of the flash microcomputer 12 includes a normal operation mode in which the flash microcomputer 12 is operated by a user system and a write operation mode in which the flash microcomputer 12 is connected with the flash writer 11 to write data into the flash memory 31.
The flash memory 31 is connected with the bus 35 and stores write data transmitted from the flash writer 11. The flash memory 31 includes a flash memory control section 310 and a memory cell array 311, each of which is a sub-block. The flash memory control section 310 executes various processings including writing, reading, and erasing of data in the memory cell array 311.
The ROM 32 is connected with the bus 35. The ROM 32 stores a program for controlling the operation of the flash microcomputer 12. The program is read by the CPU 30 and executed thereby to control the operation of the flash microcomputer 12. The ROM 32 further stores a program (firmware) for controlling writing, reading, and erasing in the flash memory 31. The flash memory control section 310 executes processing such as the writing in the memory cell array 311 based on the firmware.
The SRAM 33 is connected with the bus 35. The SRAM 33 is used to temporarily store the write data, an address indicating a write destination, and various commands (hereinafter referred to as write data and the like) which are received by the flash microcomputer 12 from the flash writer 11 through the I/F section 34, is used to store programs read out from the ROM 32 by the CPU 30.
The I/F section 34 is connected with the bus 35 and the three terminals (MSCK terminal 120, MSI terminal 121, and MSO terminal 122) shown in
The port section 340 is connected with the three terminals shown in
The functions of the port control section 341 and the serial transmission and reception control section 342 are fundamentally identical to the port control section 241 and the serial transmission and reception control section 242 in the flash writer control microcomputer 20 shown in
As in the case of
Next, the operation of the data writing system 10 according to the first embodiment of the present invention will be described with reference to
First, in Step S4-1, an operation mode of the flash writer 11 is set. To be specific, the CPU 21 reads out the program for controlling the flash writer 11 from the ROM 22 and executes the read out program, so the flash writer 11 is shifted to a state where the flash memory 11 can be operated as a flash writer. When the operation mode is set, the subsequent operation of the flash writer 11 is controlled based on the programs stored in the ROM 22. With respect to the execution of the programs, the programs read out from the ROM 22 may be temporarily stored in the SRAM 23 and then read out from the SRAM 23 and executed.
In Step S4-2, the CPU 21 performs the setting of the terminals of the flash writer 11. To be specific, the following setting is performed by the CPU 21 through the port section 240 and the port control section 241. The WSCK terminal 110 is set as an output terminal for outputting the serial clock (SCK signal) The WSO terminal 111 is set as an output terminal for outputting the WDATA signal which is serial data. The WSI terminal 112 is set as an input terminal for inputting the MDATA signal which is serial data. The WOA terminal 113 is set as an output terminal for outputting the RST signal. The WOB terminal 114 is set as an output terminal for outputting the MODE signal. The WI terminal 115 is set as an input terminal for inputting the write data and the like to be transferred to the flash microcomputer. The initial state level of each of the output terminals which are the WSCK terminal 110, the WSO terminal 111, the WOA terminal 113, and the WOB terminal 114 is set to the “H” level.
In Step S4-3, the write data and the like to be transferred to the flash microcomputer 12 is input from an outside through the WI terminal 115. The input write data and the like are stored in the SRAM 23. The processing of Step S4-3 may be performed before the processing of Step S4-1 or the processing of Step S4-2. In such a case, it is necessary to set the WI terminal 115 as a specific input terminal to which the write data and the like can be input or set the WI terminal 115 as an input terminal in an initial state of the flash writer 11 after the power-on thereof.
In Step A4-1, the flash writer 11 transmits a signal for resetting the flash microcomputer 12. To be specific, the CPU 21 changes the output of the WOA terminal 113 from the “H” level to the “L” level through the port section 240 and the port control section 241 to transmit the RST signal of the “L” level to the flash microcomputer 12. The flash microcomputer 12 receives the RST signal of the “L” level from the MRST terminal 123 to perform the reset processing (initialization processing) on the internal blocks.
In Step A4-2, the flash writer 11 transmits a signal for setting a write operation mode (write operation mode set signal) to the flash microcomputer 12. To be specific, the CPU 21 changes the output of the WOB terminal 114 from the “H” level to the “L” level through the port section 240 and the port control section 241 to transmit the MODE signal of the “L” level to the flash microcomputer 12. The flash microcomputer 12 receives the MODE signal of the “L” level from the MMODE terminal 124.
In Step A4-3, the flash writer 11 transmits a signal for releasing a reset state of the flash microcomputer 12 which is obtained by the reset processing executed in Step A4-1. To be specific, the CPU 21 changes the output of the WOA terminal 113 from the “L” level to the “H” level through the port section 240 and the port control section 241 to transmit the RST signal of the “H” level to the flash microcomputer 12. Therefore, the reset state of the flash microcomputer 12 is released.
In Step S4-4, the flash microcomputer 12 selects the operation mode. To be specific, the CPU 30 checks a logic level of the MODE signal input to the MMODE terminal 124 at a timing of a rising edge of the RST signal (at a time when rest state is released) input from the MRST terminal 123. When the logic level of the MODE signal is the “H” level, the normal operation mode is selected by the CPU 30. When the logic level of the MODE signal is the “L” level, the write operation mode is selected by the CPU 30. At this time, the input MODE signal is in the “L” level, so the CPU 30 selects the write operation mode.
In Step S4-5, the operation mode of the flash microcomputer 12 is set. To be specific, the CPU 30 reads out a program corresponding to the write operation mode from the ROM 32 and executes the program. Upon receiving data transferred from the flash writer 11, the flash microcomputer 12 is shifted to a state in which the write operation can be performed on the flash memory 31. When the write operation mode is set, the subsequent operation of the flash microcomputer 12 is controlled based on the programs stored in the ROM 32. As in the case of the flash writer 11, with respect to the execution of the programs, the programs read out from the ROM 32 may be temporarily stored in the SRAM 33 and then read out from the SRAM 33 and executed.
In Step S4-6, the CPU 30 performs the setting of the terminals of the flash microcomputer 12. To be specific, the following setting is performed by the CPU 30 through the port section 340 and the port control section 341. The MSCK terminal 120 is set as an input terminal for inputting the serial clock (SCK signal). The MSI terminal 121 is set as an input terminal for inputting the WDATA signal which is serial data. The MSO terminal 122 is set as an output terminal for outputting the MDATA signal which is serial data. The initial state level of the output terminal of the MSO terminal 122 is set to the “H” level.
When the setting of the operation mode of the flash microcomputer 12 and the setting of the terminals thereof are completed, in Step A4-4, the flash microcomputer 12 transmits a notice signal indicating that the reception preparation of the write data and the like are completed to the flash writer 11. To be specific, the CPU 30 changes the output of the MSO terminal 122 from the “H” level to the “L” level through the port section 340 and the port control section 341 to transmit a falling edge signal of the MDATA signal to the flash writer 11. As a result, the flash writer 11 recognizes that the reception preparation of the flash microcomputer 12 is completed.
In Step A4-5a, the flash writer 11 transmits the serial clock to the flash microcomputer 12 in response to the falling edge signal of the MDATA signal which is transmitted in Step A4-4. In Step A4-5b, the flash writer 11 transmits the write data and the like to the flash microcomputer 12 in synchronization with the serial clock. To be specific, the CPU 21 detecting the falling edge signal of the MDATA signal reads out the write data and the like stored in the SRAM 23 and instructs the serial transmission and reception control section 242 to perform serial communication. The serial transmission and reception control section 242 outputs the control signal to the serial clock generating portion 243 to generate the serial clock. The serial clock generated by the serial clock generating portion 243 is output to the serial transmission and reception control section 242 and the port section 240. The serial transmission and reception control section 242 performs parallel/serial conversion on the write data and the like in synchronization with the serial clock and outputs the converted write data and the like to the port section 240. The port section 240 transmits the input the serial clock and the input serial write data and the like as the SCK signal and the WDATA signal to the flash microcomputer 12 through the WSCK terminal 110 and the WSO terminal 111.
In Step S4-7, the flash microcomputer 12 performs reception processing on the write data and the like. To be specific, the write data and the like input from the MSI terminal 121 is input to the serial transmission and reception control section 342 through the port section 340. The serial transmission and reception control section 342 performs serial/parallel conversion on the serial write data and the like to generate a parallel write data and the like and outputs the parallel write data and the like to the SRAM 33. The write data and the stored in the SRAM 33 is read out by the CPU 30. Whether or not the data transfer is normally performed is checked based on checksum data included in the read out write data and the like. In addition to this, the type of the received write data and the like are determined. That is, the write data and the like transmitted from the flash writer 11 includes address data for designating an address of the memory cell array 311 into which data is written and various commands (such as erasing command and write command) as well as the write data actually written into the flash memory 31, so the CPU 30 determines the contents of the received write data and the like.
In Step S4-8, the firmware processing, that is, processing including writing is performed. To be specific, the CPU 30 reads out, from the ROM 32, firmware for controlling the access to the flash memory 31 and executes the read out firmware. The subsequent write processing is controlled based on the firmware. The CPU 30 reads out the write data and the like from the SRAM 33 and outputs the read out write data and the like to the flash memory control section 310. The flash memory control section 310 writes the write data and the like into a predetermined address of the memory cell array 311. After the completion of the data writing, verify processing is performed to compare the written data with an expected value.
In Step S4-9, the flash microcomputer 12 determines whether or not the processing of each of Steps S4-7 and S4-8 can be normally performed to complete the write processing of the write data transmitted from the flash writer 11 into the flash memory 31 (determines result obtained by the write processing). When a checksum error is not detected in Step S4-7 and a result obtained by the verify processing match in Step S4-8, it is determined that the writing into the flash memory 31 is normally performed.
In Step A4-6, the flash microcomputer 12 notifies, to the flash writer 11, a transmission preparation completion notice indicating that the transmission preparation of the result obtained in Step S4-9 to the flash writer 11 is completed. To be specific, the CPU 30 changes the output of the MSO terminal 122 from the “L” level to the “H” level through the port section 340 and the port control section 341 to transmit the rising edge signal of the MDATA signal to the flash writer 11. Therefore, the flash writer 11 recognizes that the transmission preparation of the flash microcomputer 12 is completed to request the transmission of the serial clock.
In Step A4-7a, the flash writer 11 transmits the serial clock to the flash microcomputer 12 in response to the rising edge signal of the MDATA signal which is transmitted in Step A4-6. In Step A4-7b, the flash microcomputer 12 transmits response data to the flash writer 11 in synchronization with the received serial clock. To be specific, the CPU 21 detecting the rising edge signal of the MDATA signal instructs the serial transmission and reception control section 242 to transmit the serial clock. The serial transmission and reception control section 242 outputs the control signal to the serial clock generating portion 243 to generate the serial clock. The serial clock generated by the serial clock generating portion 243 is output to the port section 240. The port section 240 transmits the input the serial clock to the flash microcomputer 12 through the WSCK terminal 110. The serial clock input from the MSCK terminal 120 is input to the serial transmission and reception control section 342 through the port section 340. The serial transmission and reception control section 342 performs parallel/serial conversion on the response data (result in step S4-9) output from the CPU 30 and outputs serial response data to the port section 340. The serial response data input to the port section 340 is transmitted as the MDATA signal to the flash writer 11 through the MSO terminal 122. The serial response data input from the WSI terminal 112 is input to the serial transmission and reception control section 242 through the port section 240. The serial transmission and reception control section 242 obtains the serial response data in synchronization with the serial clock input from the serial clock generating section 243. Then, serial transmission and reception control section 242 performs serial/parallel conversion on the obtained serial response data to generate parallel response data and outputs the generated parallel response data to the CPU 21. Therefore, the CPU 21 can check the response data to determine whether or not the write processing of the write data transmitted in Step A4-5b is normally performed. When a result of the response data indicates the completion of the normal write processing, processing is shifted to next processing related to the write data. On the other hand, when the response data indicates an error, error processing including the retransmission of the write data and the like are executed.
Next, timings of signals transmitted and received between the flash writer 11 and the flash microcomputer 12 will be described with reference to timing charts shown in
A period between a time t0 and a time t3 is a period for setting the operation mode of the flash microcomputer 12. At the time t0, the level of the RST signal is changed from the “H” level to the “L” level to reset the flash microcomputer 12. During the period between the time t0 and the time t2 in which the RST signal is in the “L” level, the flash microcomputer 12 is maintained at a reset state. At the time t1, the flash writer 11 changes the level of the MODE signal from the “H” level to the “L” level to set the write operation mode to the flash microcomputer 12. At the time t2, the RST signal is changed from the “L” level to the “H” level, so the reset state of the flash microcomputer 12 is released and the flash microcomputer 12 is shifted to the write operation mode based on the “L” level of the MODE signal.
A period between the time t3 and a time t4 is a period during which handshake (HS) communication processing for starting the transfer of the write data and the like are performed between the flash writer 11 and the flash microcomputer 12. At the time t3, in order to send, to the flash writer 11, a notice indicating that the flash microcomputer 12 is in a state in which the write data and the like can be received, the flash microcomputer 12 changes the level of the MDATA signal from the “H” level to the “L” level to generate the falling edge signal and transmits the generated falling edge signal to the flash writer 11. The flash writer 11 receives the falling edge signal to determine that the flash microcomputer 12 is already in the receivable state. At the time t4, in response to the falling edge signal of the MDATA signal, the flash writer 11 transmits the serial cock as the SCK signal and starts serial communication of the write data and the as the WDATA signal.
A period between the time t4 and a time t5 is a period during which the write data and the like are transmitted from the flash writer 11 and received by the flash microcomputer 12. The WDATA signal is transmitted from the flash writer 11 in synchronization with a falling edge of the SCK signal. The flash microcomputer 12 receives the WDATA signal at a rising edge of the SCK signal. During this period, the transmission and reception of eight-bit serial data of “01100010” is performed. The flash writer 11 sets the level of the WDATA signal to the “H” level at the time t5 after the transmission of the write data and the like.
A period between the time t5 and a time t6 is a period during which the flash microcomputer 12 checks the presence or absence of a communication error of the received write data and the like, checks the contents of the received write data and the, and determines whether or not a series of write processings including the write processing to the flash memory 31 and the verify processing of the written data are normally performed. The checking and the determination are performed in the inner portion of the flash microcomputer 12, so data communication between the flash writer 11 and the flash microcomputer 12 is not performed during the period.
A period between the time t6 and a time t7 is a period during which handshake (HS) communication processing for starting the transfer of the response data indicating whether or not the series of write processings are normally performed is carried out between the flash writer 11 and the flash microcomputer 12. At the time t6, in order to send, to the flash writer 11, a notice indicating that the flash microcomputer 12 is in a state in which the response data can be transmitted, the flash microcomputer 12 changes the level of the MDATA signal from the “L” level to the “H” level to generate the rising edge signal and transmits the generated rising edge signal to the flash writer 11. The flash writer 11 receives the rising edge signal to determine that the flash microcomputer 12 is already in a transmittable state. At the time t7, the flash writer 11 starts transmitting the serial cock as the SCK signal in response to the rising edge signal of the MDATA signal. The flash microcomputer 12 starts transmitting the response data to the flash writer 11 in synchronization with the serial clock.
A period between the time t7 and a time t8 is a period during which the response data is transmitted from the flash microcomputer 12 to the flash writer 11. The MDATA signal is transmitted from the flash microcomputer 12 in synchronization with the falling edge of the SCK signal. The flash writer 11 receives the MDATA signal at the rising edge of the SCK signal. During this period, the transmission and reception of eight-bit serial data of “00111100” is performed. The flash microcomputer 12 sets the level of the MDATA signal to the “H” level at the time t8 after the transmission of the response data.
With respect to the response data indicating that the normal writing is not performed, response data to be prepared may be changed for each cause and transmitted to the flash writer 11. The following different applications may be employed. For example, when the write data and the like are not normally transmitted from the flash writer 11 to the flash microcomputer 12 and error write processing is caused, the response data is set to “11100011”. When the write data and the like are normally transmitted from the flash writer 11 to the flash microcomputer 12 but an error occurs at the time of writing to the flash memory 31 (verification error occurs), the response data is set to “11000011”.
Whether or not a communication error such as a checksum error occurs may be checked for the response data. Therefore, when the communication error occurs in the response data, the flash writer 11 can request again the transmission of the response data to the flash microcomputer 12.
As described above, when the write data and the like are transmitted from the flash writer 11 to the flash microcomputer 12, the falling edge signal of the MDATA signal is used as a handshake signal. On the other hand, when the response data is transmitted from the flash microcomputer 12 to the flash writer 11, the rising edge signal of the MDATA signal is used as a handshake signal. In other words, in the example shown in
Therefore, according to the first embodiment of the present invention, when the write data and the like are transferred from the flash writer 11 to the flash microcomputer 12, the falling edge signal of the MDATA signal is used as the handshake signal (the trigger signal). On the other hand, when the response data is transferred from the flash microcomputer 12 to the flash writer 11, the rising edge signal of the MDATA signal is used as the handshake signal (the trigger signal). That is, in data transmission and reception between the flash writer 11 and the flash microcomputer 12 after the flash microcomputer 12 is shifted to the write operation mode in response to the signal from the flash writer 11, the data transfer is realized using a single signal line which is the MDATA line through which the MDATA signal is transmitted. In the case of write processing to the nonvolatile-memory-contained microcomputer using the above data transfer system, the data transfer system for the write data is simpler than the conventional system (data transfer system using the two signal lines (data lines SD and MD) in the case of data transmission and reception because the handshake signal is output from the reception side). Therefore, the control (processing) of the data transfer in the present invention is facilitated. Thus, a time for the write processing to the nonvolatile-memory-contained microcomputer can be shortened.
Although the inventions has been described above in connection with several preferred embodiments thereof, it will be appreciated by those skilled in the art that those embodiments are provided solely for illustrating the invention, and should not be relied upon to construe the appended claims in a limiting sense. In the case of
Number | Date | Country | Kind |
---|---|---|---|
267976/2006 | Sep 2006 | JP | national |