KR101624354B1 - Method for writing data of micro controller - Google Patents

Method for writing data of micro controller Download PDF

Info

Publication number
KR101624354B1
KR101624354B1 KR1020090124414A KR20090124414A KR101624354B1 KR 101624354 B1 KR101624354 B1 KR 101624354B1 KR 1020090124414 A KR1020090124414 A KR 1020090124414A KR 20090124414 A KR20090124414 A KR 20090124414A KR 101624354 B1 KR101624354 B1 KR 101624354B1
Authority
KR
South Korea
Prior art keywords
memory
data
busy
count
recorded
Prior art date
Application number
KR1020090124414A
Other languages
Korean (ko)
Other versions
KR20110067714A (en
Inventor
김현기
Original Assignee
엘지이노텍 주식회사
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 엘지이노텍 주식회사 filed Critical 엘지이노텍 주식회사
Priority to KR1020090124414A priority Critical patent/KR101624354B1/en
Publication of KR20110067714A publication Critical patent/KR20110067714A/en
Application granted granted Critical
Publication of KR101624354B1 publication Critical patent/KR101624354B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation

Abstract

본 발명은 마이크로 컨트롤러가 외부 메모리에 데이터의 기록시 데이터의 신뢰성을 판단할 수 있는 마이크로 컨트롤러의 데이터 기록 방법에 관한 것으로, 메모리에 기록할 데이터가 있을 경우, 메모리가 동작중(Busy)인지를 체크하는 단계와, 상기에서 메모리가 동작중 상태가 아닐 경우 칩 선택 신호를 온시켜 메모리를 점유한 후 기록금지 명령을 메모리로 송신하는 단계와, 상기 기록금지 명령을 전송한 후 기록 요청 명령과 기록할 데이터를 메모리로 송신하는 단계와, 상기 메모리에 데이터의 기록이 완료되면, 칩 선택 신호를 온시킨 후 기록한 데이터의 전송을 메모리에 요청하는 단계와, 상기 메모리로부터 수신된 데이터와 메모리에 기록한 데이터를 서로 비교하여 일치 여부를 판단하는 단계, 및 상기에서 수신된 데이터와 기록한 데이터가 서로 일치할 경우 데이터의 기록 처리를 완료하는 단계를 포함한다.The present invention relates to a data recording method of a microcontroller in which a microcontroller can judge the reliability of data when recording data in an external memory. When there is data to be written in the memory, it is checked whether the memory is busy The method comprising the steps of: when a memory is not in operation, turning on a chip select signal to occupy a memory and then transmitting a write inhibit command to a memory; Transmitting data to a memory; requesting a memory for transmission of recorded data after turning on a chip selection signal when data is written to the memory; Comparing the received data with each other to determine whether or not they are coincident with each other, And completing the recording process of the data when they coincide with each other.

컨트롤러, 메모리, 데이터 기록(write), 비지(Busy), 검증(Verify) Controller, memory, write, busy, verify,

Description

마이크로 컨트롤러의 데이터 기록 방법{METHOD FOR WRITING DATA OF MICRO CONTROLLER}METHOD FOR WRITING DATA OF MICRO CONTROLLER [0002]

본 발명은 데이터 기록 방법에 관한 것으로, 특히 마이크로 컨트롤러가 외부 메모리에 데이터의 기록시 데이터의 신뢰성을 판단할 수 있는 마이크로 컨트롤러의 데이터 기록 방법에 관한 것이다.The present invention relates to a data recording method, and more particularly, to a microcontroller data recording method capable of judging the reliability of data when recording data in an external memory.

일반적으로 차량에서 사용되는 MCU(Micro-Controller Unit)와 같은 마이크로 컨트롤러가 소정의 데이터를 외부 메모리(EEPROM)에 라이트(write)할 때, 칩선택 라인과 데이터 라인 등에 노이즈가 유입되거나 전원이 단락(short)되면 정상적인 데이터의 기록이 불가능하게 된다.Generally, when a microcontroller such as a micro-controller unit (MCU) used in a vehicle writes predetermined data to an external memory (EEPROM), noise enters the chip select line and the data line, short), normal data recording becomes impossible.

이러할 경우 메모리에 잘못된 데이터가 기록되거나 다른 어드레스에 데이터가 기록되거나 또는 데이터가 전혀 기록되지 않아 시스템의 동작에 큰 문제를 야기할 수가 있다.In this case, erroneous data may be written to the memory, data may be written to another address, or data may not be written at all, which may cause a serious problem in the operation of the system.

본 발명은 마이크로 컨트롤러가 외부 메모리에 데이터의 기록(writing)시 처리 오동작이나 데이터의 신뢰성을 판단할 수 있는 마이크로 컨트롤러의 데이터 기록 방법을 제공하기 위한 것이다.The present invention provides a microcontroller data recording method capable of judging a process malfunction or reliability of data when the microcontroller writes data in an external memory.

본 발명이 이루고자 하는 기술적 과제들은 이상에서 언급한 기술적 과제들로 제한되지 않으며, 언급되지 않은 다른 기술적 과제들은 아래의 기재로부터 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory and are not intended to limit the invention to the particular embodiments that are described. It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory and are not restrictive of the invention, There will be.

상기 목적을 달성하기 위한 본 발명의 데이터 기록 방법은, 메모리에 기록할 데이터가 있을 경우, 메모리가 동작중(Busy)인지를 체크하는 단계; 상기에서 메모리가 동작중 상태가 아닐 경우 칩 선택 신호를 온시켜 메모리를 점유한 후 기록금지 명령을 메모리로 송신하는 단계; 상기 기록금지 명령을 전송한 후 기록 요청 명령과 기록할 데이터를 메모리로 송신하는 단계; 상기 메모리에 데이터의 기록이 완료되면, 칩 선택 신호를 온시킨 후 기록한 데이터의 전송을 메모리에 요청하는 단계; 상기 메모리로부터 수신된 데이터와 메모리에 기록한 데이터를 서로 비교하여 일치 여부를 판단하는 단계; 및 상기에서 수신된 데이터와 기록한 데이터가 서로 일치할 경우 데이터의 기록 처리를 완료하는 단계;를 포함하는 것을 특징으로 한 다.According to another aspect of the present invention, there is provided a data recording method comprising the steps of: checking if a memory is busy; If the memory is not in operation, turning on a chip select signal to occupy the memory and transmit a write inhibit command to the memory; Transmitting a write request command and data to be written to a memory after transmitting the write prohibition command; Requesting the memory to transmit the recorded data after turning on the chip select signal when the writing of data into the memory is completed; Comparing the data received from the memory and the data recorded in the memory to determine whether they match or not; And completing the data recording process when the received data and the recorded data match each other.

구체적으로, 상기 메모리의 동작중(Busy) 여부를 체크하기 전에, 동작전압을 검출하여 미리 설정된 기준전압과 비교하여 이상 여부를 판단하는 단계; 및 상기 검출된 전압이 설정된 기준전압 범위를 벗어날 경우 동작 전압이 정상적인 전압으로 복귀될 때까지 데이터의 기록을 지연시키는 단계;를 포함하는 것을 특징으로 한다.Specifically, before checking whether or not the memory is busy, detecting an operating voltage and comparing the operating voltage with a predetermined reference voltage to determine an abnormality; And delaying the writing of data until the operating voltage returns to a normal voltage when the detected voltage is out of the set reference voltage range.

또한, 상기 메모리가 동작중(Busy)일 경우에는, 비지 카운트(Busy Count)를 증가시킨 후 누적된 비지 카운트가 설정된 기준횟수를 초과하는지를 판단하는 단계; 및 상기에서 누적된 비지 카운트가 설정된 기준횟수를 초과할 경우 통신 에러로 처리하여 데이터 기록 동작을 종료하는 단계;를 포함하는 것을 특징으로 한다.When the memory is busy, it is determined whether the accumulated busy count exceeds a preset reference count after the busy count is increased. And terminating the data recording operation by processing a communication error when the accumulated busy count exceeds the set reference number.

상기에서 수신된 데이터가 기록한 데이터와 일치하지 않을 경우, 검증 카운트(Verify Count)를 증가시킨 후 누적된 검증 카운트가 설정된 기준횟수를 초과하는지를 판단하는 단계; 및 상기에서 누적된 검증 카운트가 설정된 기준횟수를 초과하게 되면 통신 에러로 처리하여 데이터 기록 동작을 종료하는 단계;를 포함하는 것을 특징으로 한다.Determining whether the accumulated verification count exceeds a preset reference number after increasing the verification count if the received data does not match the recorded data; And terminating the data recording operation by processing a communication error when the accumulated verification count exceeds the preset reference number.

이상에서 설명한 바와 같이 본 발명은 마이크로 컨트롤러가 외부 메모리에 데이터의 기록(writing)할 때, 동작전압의 이상 여부와 비지(Busy) 상태 및 기록 데이터의 검증을 통해 정상적인 데이터의 기록이 가능함으로써, 시스템의 오동작을 방지함과 아울러 데이터의 신뢰성과 시스템의 안정성을 향상시킬 수 있는 이점이 있다.As described above, according to the present invention, when the microcontroller writes data in the external memory, it is possible to record normal data by checking whether the operating voltage is abnormal, busy, and recording data, And it is possible to improve the reliability of the data and the stability of the system.

이하, 첨부된 도면을 참조하여 본 발명의 바람직한 실시예를 상세하게 설명한다. 도면들 중 동일한 구성요소들은 가능한 어느 곳에서든지 동일한 부호로 표시한다. 또한 본 발명의 요지를 불필요하게 흐릴 수 있는 공지 기능 및 구성에 대한 상세한 설명은 생략한다.Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings. In the drawings, the same components are denoted by the same reference symbols whenever possible. In the following description, well-known functions or constructions are not described in detail since they would obscure the invention in unnecessary detail.

도 1은 본 발명에 적용된 마이크로 컨트롤러와 메모리를 나타낸 도면이고, 도 2는 마이크로 컨트롤러의 기록금지 명령어 처리 시퀀스를 나타낸 도면이고, 도 3은 마이크로 컨트롤러의 데이터 기록 처리 시퀀스를 나타낸 도면이다.FIG. 1 is a diagram showing a microcontroller and a memory applied to the present invention, FIG. 2 is a diagram showing a write inhibit command processing sequence of a microcontroller, and FIG. 3 is a diagram showing a data write processing sequence of a microcontroller.

먼저, MCU(Micro-Controller Unit)와 같은 마이크로 컨트롤러(10)는, 칩 선택 신호를 출력하는 선택출력단자(CS)와, 동기를 위한 클록신호를 출력하는 동기클록단자(SCK)와, 메모리(50)로 각종 명령과 데이터를 출력하는 시리얼출력단자(SO), 및 메모리(50)로부터 데이터를 입력받는 시리얼입력단자(SI)를 포함하여 구성된다.First, a microcontroller 10 such as an MCU (Micro-Controller Unit) includes a selection output terminal CS for outputting a chip selection signal, a synchronous clock terminal SCK for outputting a clock signal for synchronization, 50 for outputting various commands and data, and a serial input terminal (SI) for receiving data from the memory 50.

그리고, EEPROM과 같은 외부 메모리(50)는, 마이크로 컨트롤러(10)의 선택출력단자(CS)로부터 칩 선택 신호를 입력받는 칩선택단자(CS)와, 마이크로 컨트롤러(10)의 동기클록단자(SCK)로부터 동기를 위한 클록신호를 입력받는 클록단자(SK)와, 마이크로 컨트롤러(10)의 시리얼출력단자(SO)로부터 각종 명령과 데이터를 입력받는 데이터입력단자(DI), 및 마이크로 컨트롤러(10)로 요청된 데이터를 출력하 는 데이터출력단자(DO)를 포함하여 구성된다.The external memory 50 such as an EEPROM has a chip select terminal CS receiving a chip select signal from the select output terminal CS of the microcontroller 10 and a synchronous clock terminal SCK A data input terminal DI for receiving various commands and data from the serial output terminal SO of the microcontroller 10 and a data input terminal DI for receiving a clock signal for synchronization from the microcontroller 10, And a data output terminal (DO) for outputting the requested data.

상기 마이크로 컨트롤러(10)와 메모리(50)는 시리얼 인터페이스로 연결되는 데, 도시된 바와 같이 마이크로 컨트롤러(10)의 선택출력단자(CS)와 동기클록단자(SCK), 시리얼출력단자(SO), 및 시리얼입력단자(SI)는 메모리(50)의 칩선택단자(CS), 클록단자(SK), 데이터입력단자(DI) 및 데이터출력단자(DO)에 각각 연결된다.The microcontroller 10 and the memory 50 are connected to each other through a serial interface so that the selection output terminal CS and the synchronous clock terminal SCK, And the serial input terminal SI are connected to the chip selection terminal CS, the clock terminal SK, the data input terminal DI and the data output terminal DO of the memory 50, respectively.

상기 마이크로 컨트롤러(10)와 메모리(50)는 시리얼(Serial) 통신을 기본으로 하며, 메모리(50)의 데이터 기록 처리는 1ms 주기로 실행된다.The microcontroller 10 and the memory 50 are based on serial communication, and the data recording process of the memory 50 is executed in a cycle of 1 ms.

이와 같이 구성된 마이크로 컨트롤러(10)와 메모리(50)의 일반적인 데이터 기록을 위한 시퀀스를 도 2 및 도 3을 참조하여 살펴보면 아래와 같다.A sequence for general data recording of the microcontroller 10 and the memory 50 constructed as above will be described with reference to FIGS. 2 and 3. FIG.

도 2에 도시된 바와 같이 메모리(50)에 데이터를 기록하기 전에, 마이크로 컨트롤러(10)는 선택출력단자(CS)를 통해 칩 선택 신호를 온시켜 메모리(50)를 점유한 후 시리얼출력단자(SO)를 통해 데이터 기록금지 명령을 메모리(50)로 송신한다. 이에 따라 메모리(50)는 외부에서 입력되는 어떠한 데이터도 기록하지 않고 마이크로 컨트롤러(10)로부터 입력되는 명령 및 데이터를 대기하게 된다.2, before the data is written to the memory 50, the microcontroller 10 turns on the chip select signal through the select output terminal CS to occupy the memory 50, SO to the memory 50. The data write prohibition command is transmitted to the memory 50 via the data write command SO. Accordingly, the memory 50 waits for commands and data input from the microcontroller 10 without recording any data input from the outside.

도 2에서 보듯이 선택출력단자(CS)를 통해 칩 선택 신호가 온되는 구간 내에서 시리얼출력단자(SO)를 통해 기록금지 명령이 전송되고, 기록금지 명령이 모두 전송되면 상기 칩 선택 신호는 오프된다.2, a write inhibit command is transmitted through the serial output terminal SO within a period in which the chip select signal is turned on through the select output terminal CS, and when all write inhibit commands are transmitted, the chip select signal is turned off do.

이어, 마이크로 컨트롤러(10)는 도 3과 같이 선택출력단자(CS)를 통해 칩 선택 신호를 온시켜 메모리(50)를 점유한 후 시리얼출력단자(SO)를 통해 기록 요청 명령과 어드레스를 메모리(50)로 송신한 후 기록할 데이터를 연이어 메모리(50)로 송신하게 된다. 이에 따라 메모리(50)는 지정된 어드레스에 송신된 데이터를 기록하게 된다.3, the microcontroller 10 turns on the chip select signal through the select output terminal CS to occupy the memory 50 and then outputs the write request command and the address to the memory (not shown) via the serial output terminal SO 50, and then transmits the data to be recorded to the memory 50 successively. Thus, the memory 50 records the data transmitted to the specified address.

도 3에서 보듯이 선택출력단자(CS)를 통해 칩 선택 신호가 온되는 구간 내에서 시리얼출력단자(SO)를 통해 기록 요청 명령과 그 데이터가 전송되고, 기록할 데이터가 모두 전송되면 상기 칩 선택 신호는 다시 오프된다.As shown in FIG. 3, when a write request command and its data are transmitted through a serial output terminal SO within a period in which a chip select signal is turned on through a select output terminal CS, The signal is turned off again.

상기와 같은 시퀀스를 통해 데이터 기록이 수행된다.Data recording is performed through the above sequence.

하지만, 마이크로 컨트롤러(10)가 소정의 데이터를 메모리(50; EEPROM)에 기록(write)할 때, 칩 선택 라인과 데이터 라인 등에 노이즈가 유입되거나 전원이 단락(short)되면 정상적인 데이터의 기록이 불가능하게 된다.However, when the microcontroller 10 writes predetermined data to the memory 50 (EEPROM), if noises are input to the chip select line and the data line, or if the power is short-circuited, normal data recording is impossible .

이에 따라 데이터의 기록처리에 대한 에러를 체크할 필요가 있으며, 본 발명에서는 대략 3가지 유형의 에러 체크 방법을 제시한다. 즉, 메모리(50)의 사용중 또는 동작중 여부를 체크하는 비지 체크(Busy Check)와, 기록된 데이터의 오류 여부를 검증하는 검증 체크(Verify Check)와, 마이크로 컨트롤러(10)와 메모리(50)로 인가되는 동작 전원이 기준 전압 이하일 경우 정상적인 전압으로 복귀될 때까지 해당 데이터의 기록을 지연시키는 전원 체크(Power Check) 방법이 있을 수 있다.Accordingly, it is necessary to check for errors in the data recording process. In the present invention, three types of error checking methods are proposed. That is, a busy check for checking whether the memory 50 is in use or in operation, a verify check for verifying whether or not the written data is erroneous, a microcomputer 10 and a memory 50, There may be a power check method for delaying the writing of the data until the voltage is returned to a normal voltage when the operation power applied to the power supply is less than the reference voltage.

도 4a 및 도 4b는 본 발명의 실시예에 의한 데이터 기록 절차를 나타낸 플로우챠트로서, 도 1 내지 도 3을 참조하여 살펴보면 아래와 같다.4A and 4B are flow charts illustrating a data recording procedure according to an embodiment of the present invention, and will be described with reference to FIGS. 1 to 3. FIG.

먼저, 마이크로 컨트롤러(10)는 외부 메모리(50)에 기록할 데이터가 있는지를 판단하게 된다(S11). First, the microcontroller 10 determines whether there is data to be written in the external memory 50 (S11).

상기 메모리(50)에 기록할 데이터가 있으면 마이크로 컨트롤러(10)는 외부로부터 인가되는 동작전압을 검출하고, 검출된 동작 전압과 미리 설정된 기준전압을 비교하여 이상이 없는지를 판단하게 된다(S12, S13). 여기서 검출된 전압은 설정된 기준전압과 반드시 일치해야 할 필요는 없으며, 오동작이 발생하지 않는 전압 범위 내에 있으면 된다.If there is data to be written in the memory 50, the microcontroller 10 detects an operating voltage applied from the outside, compares the detected operating voltage with a predetermined reference voltage, and determines whether there is any abnormality (S12, S13 ). Here, the detected voltage does not necessarily have to match the set reference voltage, and it may be within a voltage range in which no malfunction occurs.

만일, 검출된 전압이 설정된 기준전압 범위를 벗어날 경우 동작 전압이 정상적인 전압으로 복귀될 때까지 데이터의 기록을 지연시키게 된다(S14).If the detected voltage is out of the set reference voltage range, the data writing is delayed until the operating voltage returns to the normal voltage (S14).

상기에서 검출된 전압에 이상이 없을 경우, 마이크로 컨트롤러(10)는 메모리(50)의 칩선택단자(CS)를 통해 메모리(50)가 동작중(Busy)인지를 체크하게 된다(S15). If there is no abnormality in the detected voltage, the microcontroller 10 checks whether the memory 50 is busy (Busy) through the chip selection terminal CS of the memory 50 (S15).

상기에서 메모리(50)가 동작중(Busy)일 경우(S16), 마이크로 컨트롤러(10)는 비지 카운트(Busy Count)를 증가시킨 후 누적된 비지 카운트가 설정된 기준횟수를 초과하는지를 판단하게 된다(S17, S18). 상기 비지 카운트에 대한 기준횟수는 3회 정도가 될 수 있다.If the memory 50 is busy (S16), the microcontroller 10 increases the Busy Count and determines whether the accumulated busy count exceeds the set reference count (S17 , S18). The reference count for the busy count may be about three times.

상기에서 누적된 비지 카운트가 설정된 기준횟수를 초과하지 않을 경우, 반복적으로 메모리(50)의 동작중 여부를 체크하게 된다(S16). 만일 상기(S18)에서 누적된 비지 카운트가 설정된 기준횟수를 초과하게 되면 에러로 처리한 후 데이터 기록 동작을 종료하게 된다(S19).If the accumulated busy count does not exceed the preset reference count, it is checked whether the memory 50 is operated repeatedly (S16). If the busy count accumulated in step S18 exceeds the set reference count, the data recording operation is terminated after processing the error (S19).

사실, 메모리(50)는 마이크로 컨트롤러(10)와 연결되어 있으므로, 마이크로 컨트롤러(10)의 칩 선택 신호 이외의 동작중 상태가 메모리(50)에서 체크된다면 메 모리(50)의 통신 인터페이스에 일정 문제가 있다는 것을 의미한다.In fact, since the memory 50 is connected to the microcontroller 10, if the state of the operation other than the chip select signal of the microcontroller 10 is checked in the memory 50, .

상기(S16)에서 메모리(50)가 동작중(Busy) 상태가 아닐 경우, 마이크로 컨트롤러(10)는 도 2와 같이 선택출력단자(CS)를 통해 칩 선택 신호를 온시켜 메모리(50)를 점유한 후 시리얼출력단자(SO)를 통해 기록금지 명령을 메모리(50)로 송신한다(S20). 상기 선택출력단자(CS)를 통해 칩 선택 신호가 온되는 구간 내에서 시리얼출력단자(SO)를 통해 기록금지 명령이 전송되고, 기록금지 명령이 모두 전송되면 상기 칩 선택 신호는 오프된다. 이에 따라 메모리(50)는 외부에서 입력되는 어떠한 데이터도 기록하지 않고 마이크로 컨트롤러(10)로부터 입력되는 명령 및 데이터를 대기하게 된다. If the memory 50 is not busy, the microcontroller 10 turns on the chip select signal through the select output terminal CS as shown in FIG. 2 to occupy the memory 50 And transmits a write prohibition command to the memory 50 via the serial output terminal SO (S20). A write inhibit command is transmitted through the serial output terminal SO within a period in which the chip select signal is turned on through the select output terminal CS and the chip select signal is turned off when all the write prohibit commands are transmitted. Accordingly, the memory 50 waits for commands and data input from the microcontroller 10 without recording any data input from the outside.

이어, 마이크로 컨트롤러(10)는 도 3과 같이 선택출력단자(CS)를 통해 칩 선택 신호를 온시켜 메모리(50)를 점유한 후 시리얼출력단자(SO)를 통해 기록 요청 명령과 어드레스를 메모리(50)로 송신한 후 기록할 데이터를 연이어 메모리(50)로 송신하게 된다(S21). 이에 따라 메모리(50)는 지정된 어드레스에 송신된 데이터를 기록하게 된다. 여기서, 선택출력단자(CS)를 통해 칩 선택 신호가 온되는 구간 내에서 시리얼출력단자(SO)를 통해 기록 요청 명령과 그 데이터가 전송되고, 기록할 데이터가 모두 전송되면 상기 칩 선택 신호는 다시 오프된다.3, the microcontroller 10 turns on the chip select signal through the select output terminal CS to occupy the memory 50 and then outputs the write request command and the address to the memory (not shown) via the serial output terminal SO 50, and then transmits the data to be recorded to the memory 50 in succession (S21). Thus, the memory 50 records the data transmitted to the specified address. Here, the write request command and its data are transmitted through the serial output terminal SO in a period in which the chip select signal is turned on through the select output terminal CS, and when all of the data to be written is transmitted, Off.

상기에서, 메모리(50)에 칩 선택 신호를 전송하기 전에 그리고 메모리(50)에 데이터를 전송하기 전에 각각 상기 메모리(50)의 동작중 여부를 체크하는 과정(S16)을 한번 더 수행할 수 있다.In the above, the process of checking whether the memory 50 is in operation before transferring the chip selection signal to the memory 50 and before transferring the data to the memory 50 may be performed once more (S16) .

마이크로 컨트롤러(10)는 메모리(50)에 데이터의 기록이 완료되면(S22), 마 이크로 컨트롤러(10)는 도 2와 같이 선택출력단자(CS)를 통해 칩 선택 신호를 온시켜 메모리(50)를 점유한 후 시리얼출력단자(SO)를 통해 기록금지 명령을 메모리(50)로 송신한다(S23).The microcontroller 10 turns on the chip select signal through the select output terminal CS as shown in FIG. 2 to write the data in the memory 50, And transmits a write prohibition command to the memory 50 via the serial output terminal SO (S23).

이어, 마이크로 컨트롤러(10)는 선택출력단자(CS)를 통해 칩 선택 신호를 온시켜 메모리(50)를 점유한 후 시리얼출력단자(SO)를 통해 기록한 데이터의 읽기 요청 명령을 메모리(50)로 송신하게 된다(S24). 이에 따라 메모리(50)는 지정된 어드레스에 기록된 데이터를 독출하여 마이크로 컨트롤러(10)로 전송하게 된다.The microcontroller 10 then turns on the chip select signal through the select output terminal CS to occupy the memory 50 and then sends a read request command of the data written through the serial output terminal SO to the memory 50 (S24). Accordingly, the memory 50 reads the data recorded at the specified address and transmits it to the microcontroller 10.

마이크로 컨트롤러(10)는 메모리(50)로부터 기록했던 데이터를 수신하고, 수신된 데이터와 메모리(50)에 기록한 데이터를 상호 비교하여 일치하는지를 판단하게 된다(S25, S26).The microcontroller 10 receives the data recorded from the memory 50, compares the received data with the data recorded in the memory 50, and judges whether or not they match (S25, S26).

상기에서 수신된 데이터와 기록한 데이터가 서로 일치할 경우(S27), 마이크로 컨트롤러(10)는 통신 인터페이스 및 기록 처리에 문제가 없는 것으로 판단하여 데이터의 기록 처리를 완료하게 된다(S28).When the received data and the written data match each other (S27), the microcontroller 10 judges that there is no problem in the communication interface and the recording process, and completes the data recording process (S28).

하지만, 상기에서 수신된 데이터와 메모리(50)에 기록한 데이터가 서로 일치하지 않을 경우(S27), 마이크로 컨트롤러(10)는 검증 카운트(Verify Count)를 증가시킨 후 누적된 검증 카운트가 설정된 기준횟수를 초과하는지를 판단하게 된다(S29, S30). 상기 검증 카운트에 대한 기준횟수는 3회 정도가 될 수 있다.However, if the received data does not match with the data written in the memory 50 (S27), the microcontroller 10 increases the verify count and then outputs the accumulated reference count (S29, S30). The reference count for the verification count may be about three times.

상기에서 누적된 검증 카운트가 설정된 기준횟수를 초과하지 않을 경우, 마이크로 컨트롤러(10)는 다시 검출된 동작전압을 기준전압과 비교(S12)하거나 또는 메모리(50)의 동작중 여부를 체크하는 과정(S15)부터 재수행하게 된다. 만일 상기 에서 누적된 검증 카운트가 설정된 기준횟수를 초과하게 되면 통신 에러로 처리한 후 데이터 기록 동작을 종료하게 된다(S31).If the accumulated verification count does not exceed the preset reference count, the microcontroller 10 compares the detected operating voltage with the reference voltage (S12) or checks whether the memory 50 is in operation S15). If the accumulated verification count exceeds the set reference count, the data recording operation is terminated after processing a communication error (S31).

한편, 도 4a 및 도 4b에서 도시하지는 않았지만, 마이크로 컨트롤러(10)는 메모리(50)에 소정의 명령과 데이터를 전송하기 전에 메모리(50)의 칩선택단자(CS)를 통해 동작중 여부를 매번 체크하고, 이상이 없을 경우 소정의 명령과 데이터를 메모리(50)에 전송하는 것이 바람직하다.Although not shown in FIGS. 4A and 4B, the microcontroller 10 determines whether or not the microcomputer 10 is operating through the chip selection terminal CS of the memory 50 before transmitting predetermined commands and data to the memory 50 It is preferable to transmit a predetermined command and data to the memory 50 when there is no abnormality.

상기의 본 발명은 바람직한 실시예를 중심으로 살펴보았으며, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자는 본 발명의 본질적 기술 범위 내에서 상기 본 발명의 상세한 설명과 다른 형태의 실시예들을 구현할 수 있을 것이다. 여기서 본 발명의 본질적 기술범위는 특허청구범위에 나타나 있으며, 그와 동등한 범위 내에 있는 모든 차이점은 본 발명에 포함된 것으로 해석되어야 할 것이다.It will be apparent to those skilled in the art that various modifications and variations can be made in the present invention without departing from the spirit or scope of the invention as defined by the appended claims. It will be possible. The scope of the present invention is defined by the appended claims, and all differences within the scope of the claims are to be construed as being included in the present invention.

도 1은 본 발명에 적용된 마이크로 컨트롤러와 메모리를 나타낸 도면이다.1 is a diagram illustrating a microcontroller and a memory applied to the present invention.

도 2는 마이크로 컨트롤러의 기록금지 명령어 처리 시퀀스를 나타낸 도면이다.2 is a diagram showing a write inhibit command processing sequence of the microcontroller.

도 3은 마이크로 컨트롤러의 데이터 기록 처리 시퀀스를 나타낸 도면이다.3 is a diagram showing a data recording processing sequence of the microcontroller.

도 4a 및 도 4b는 본 발명의 실시예에 의한 데이터 기록 절차를 나타낸 플로우챠트이다.4A and 4B are flowcharts illustrating a data recording procedure according to an embodiment of the present invention.

Claims (7)

메모리에 기록할 데이터가 있을 경우, 메모리가 동작중(Busy)인지를 체크하는 단계;If there is data to be written in the memory, checking whether the memory is Busy; 상기 메모리가 동작중 상태가 아닐 경우, 칩 선택 신호를 온시켜 메모리를 점유한 후 기록금지 명령을 메모리로 송신하는 단계;If the memory is not in operation, turning on a chip select signal to occupy the memory and transmit a write inhibit command to the memory; 상기 기록금지 명령을 전송한 후 기록 요청 명령과 기록할 데이터를 메모리로 송신하는 단계; Transmitting a write request command and data to be written to a memory after transmitting the write prohibition command; 상기 메모리에 데이터의 기록이 완료되면, 칩 선택 신호를 온시킨 후 기록한 데이터의 전송을 메모리에 요청하는 단계;Requesting the memory to transmit the recorded data after turning on the chip select signal when the writing of data into the memory is completed; 상기 메모리로부터 수신된 데이터와 메모리에 기록한 데이터를 서로 비교하여 일치 여부를 판단하는 단계; 및Comparing the data received from the memory and the data recorded in the memory to determine whether they match or not; And 상기 수신된 데이터와 기록한 데이터가 서로 일치할 경우 데이터의 기록 처리를 완료하는 단계;를 포함하고, And completing the data recording process when the received data and the recorded data match each other, 상기 메모리가 동작중 상태일 경우, 비지 카운트(Busy Count)를 증가시킨 후 누적된 비지 카운트가 설정된 기준횟수를 초과하는지를 판단하는 단계; 및 상기 누적된 비지 카운트가 설정된 기준횟수를 초과할 경우 통신 에러로 처리하여 데이터 기록 동작을 종료하는 단계;를 포함하는 마이크로 컨트롤러의 데이터 기록 방법.Determining whether the accumulated busy count exceeds a preset reference count after increasing the Busy Count when the memory is in operation; And terminating the data recording operation by processing a communication error when the accumulated busy count exceeds the set reference count. 메모리에 기록할 데이터가 있을 경우, 메모리가 동작중(Busy)인지를 체크하는 단계;If there is data to be written in the memory, checking whether the memory is Busy; 상기 메모리가 동작중 상태가 아닐 경우, 칩 선택 신호를 온시켜 메모리를 점유한 후 기록금지 명령을 메모리로 송신하는 단계;If the memory is not in operation, turning on a chip select signal to occupy the memory and transmit a write inhibit command to the memory; 상기 기록금지 명령을 전송한 후 기록 요청 명령과 기록할 데이터를 메모리로 송신하는 단계; Transmitting a write request command and data to be written to a memory after transmitting the write prohibition command; 상기 메모리에 데이터의 기록이 완료되면, 칩 선택 신호를 온시킨 후 기록한 데이터의 전송을 메모리에 요청하는 단계;Requesting the memory to transmit the recorded data after turning on the chip select signal when the writing of data into the memory is completed; 상기 메모리로부터 수신된 데이터와 메모리에 기록한 데이터를 서로 비교하여 일치 여부를 판단하는 단계; 및 Comparing the data received from the memory and the data recorded in the memory to determine whether they match or not; And 상기 수신된 데이터와 기록한 데이터가 서로 일치할 경우 데이터의 기록 처리를 완료하는 단계;를 포함하고, And completing the data recording process when the received data and the recorded data match each other, 상기 수신된 데이터가 기록한 데이터와 일치하지 않을 경우, If the received data does not match the recorded data, 검증 카운트(Verify Count)를 증가시킨 후 누적된 검증 카운트가 설정된 기준횟수를 초과하는지를 판단하는 단계; 및 상기 누적된 검증 카운트가 설정된 기준횟수를 초과하게 되면 통신 에러로 처리하여 데이터 기록 동작을 종료하는 단계;를 포함하는 마이크로 컨트롤러의 데이터 기록 방법.Determining whether the accumulated verification count exceeds a preset reference count after increasing the verify count; And terminating the data recording operation by processing a communication error when the accumulated verification count exceeds a preset reference number. 제 1 항 또는 제 2항에 있어서,3. The method according to claim 1 or 2, 상기 메모리의 동작중(Busy) 여부를 체크하기 전에,Before checking whether the memory is busy (Busy) 동작전압을 검출하여 미리 설정된 기준전압과 비교하여 이상 여부를 판단하는 단계; 및 상기 검출된 전압이 설정된 기준전압 범위를 벗어날 경우 동작 전압이 정상적인 전압으로 복귀될 때까지 데이터의 기록을 지연시키는 단계;를 포함하는 마이크로 컨트롤러의 데이터 기록 방법.Detecting an operating voltage and comparing the operating voltage with a preset reference voltage to determine whether the voltage is abnormal; And delaying the writing of data until the operating voltage returns to a normal voltage when the detected voltage is out of the set reference voltage range. 삭제delete 제 2 항에 있어서,3. The method of claim 2, 상기 누적된 검증 카운트가 설정된 기준횟수를 초과하지 않을 경우, 메모리의 동작중 여부를 체크하는 과정부터 재수행하는 마이크로 컨트롤러의 데이터 기록 방법.And if the accumulated verification count does not exceed the set reference number, checking whether or not the memory is in operation. 제 1 항 또는 제 2 항에 있어서,3. The method according to claim 1 or 2, 상기 메모리에 소정의 명령과 데이터를 전송하기 전에, 동작중 여부를 매번 체크하고, 이상이 없을 경우 소정의 명령과 데이터를 메모리에 전송하는 마이크로 컨트롤러의 데이터 기록 방법.Wherein the microcomputer checks whether or not the predetermined command and data are transferred to the memory every time, and if there is no abnormality, transmits a predetermined command and data to the memory. 제 1 항 또는 제 2 항에 있어서,3. The method according to claim 1 or 2, 상기 동작중 여부는 메모리의 칩선택단자를 통해 체크하는 마이크로 컨트롤러의 데이터 기록 방법.Wherein the microcomputer checks whether the operation is performed through a chip selection terminal of the memory.
KR1020090124414A 2009-12-15 2009-12-15 Method for writing data of micro controller KR101624354B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020090124414A KR101624354B1 (en) 2009-12-15 2009-12-15 Method for writing data of micro controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020090124414A KR101624354B1 (en) 2009-12-15 2009-12-15 Method for writing data of micro controller

Publications (2)

Publication Number Publication Date
KR20110067714A KR20110067714A (en) 2011-06-22
KR101624354B1 true KR101624354B1 (en) 2016-06-07

Family

ID=44400113

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020090124414A KR101624354B1 (en) 2009-12-15 2009-12-15 Method for writing data of micro controller

Country Status (1)

Country Link
KR (1) KR101624354B1 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009020845A1 (en) * 2007-08-06 2009-02-12 Sandisk Corporation Enhanced write abort mechanism for non-volatile memory

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11120087A (en) * 1997-10-20 1999-04-30 Fujitsu Ltd Dual-memory processor
KR20080066463A (en) * 2007-01-12 2008-07-16 엠텍비젼 주식회사 Multimedia storage device and control method of the same

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009020845A1 (en) * 2007-08-06 2009-02-12 Sandisk Corporation Enhanced write abort mechanism for non-volatile memory

Also Published As

Publication number Publication date
KR20110067714A (en) 2011-06-22

Similar Documents

Publication Publication Date Title
US7509446B2 (en) IIC bus communication system capable of suppressing freeze of IIC bus communication due to a noise and method for controlling IIC bus communication
CN104699576B (en) Serial communication testing device, system comprising same and method thereof
US6842806B2 (en) Method and apparatus for interconnecting wired-AND buses
US20190272252A1 (en) Method of processing deadlock of i2c bus, electronic device and communication system
KR100680473B1 (en) Flash memory device with reduced access time
EP2476062B1 (en) Adjustment of memory write timing based on error detection techniques
KR20160034913A (en) Response control for memory modules that include or interface with non-compliant memory technologies
US8375250B2 (en) System and method for testing a module
US7636262B2 (en) Synchronous memory having shared CRC and strobe pin
US20170221584A1 (en) Ssd controlling circuit for determining reusability of data block of ssd
US8719650B2 (en) Self-diagnosis system and test circuit determination method
EP2359372A1 (en) Error detection method and a system including one or more memory devices
US10721022B2 (en) Communication apparatus, communication method, program, and communication system
CN104184454A (en) Circuit connection of SFP chip suitable for multi-type storage, and detection method thereof
KR101624354B1 (en) Method for writing data of micro controller
CN111752881A (en) Inter-module communication method and system
US20110185218A1 (en) Adjustment of Write Timing Based on a Training Signal
US7561455B2 (en) Memory system using single wavelength optical transmission
KR101583090B1 (en) Method for reading data of micro controller
JP4782406B2 (en) Duplex system
US7587655B2 (en) Method of transferring signals between a memory device and a memory controller
KR20180028613A (en) Memory System and Memory Control Method
KR101977955B1 (en) Apparatus and method for monitoring Microcontroller Unit
US20190222355A1 (en) Method, Sensor, and Controller for Transmitting a Data Packet from a Sensor to a Controller
CN116991651B (en) Error injection method, system on chip, computer equipment and storage medium

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant