JP2021089531A - Electronic control device - Google Patents

Electronic control device Download PDF

Info

Publication number
JP2021089531A
JP2021089531A JP2019219056A JP2019219056A JP2021089531A JP 2021089531 A JP2021089531 A JP 2021089531A JP 2019219056 A JP2019219056 A JP 2019219056A JP 2019219056 A JP2019219056 A JP 2019219056A JP 2021089531 A JP2021089531 A JP 2021089531A
Authority
JP
Japan
Prior art keywords
data
cpu
data area
electronic control
control device
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
JP2019219056A
Other languages
Japanese (ja)
Inventor
山本 敏之
Toshiyuki Yamamoto
敏之 山本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Astemo Ltd
Original Assignee
Hitachi Astemo Ltd
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 Hitachi Astemo Ltd filed Critical Hitachi Astemo Ltd
Priority to JP2019219056A priority Critical patent/JP2021089531A/en
Publication of JP2021089531A publication Critical patent/JP2021089531A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Memory System (AREA)

Abstract

To provide an electronic control device capable of reducing a latency time of processing performed by each of a plurality of CPUs.SOLUTION: An electronic control device 2 for controlling vehicles comprises: a plurality of CPUs (Central Processing Unit) 52; a shared memory 51 shared by the plurality of CPUs and including a first data region 511(1) in which data is stored by a first CPU 52(1) among the plurality of CPUs and a second data region 511(2) in which data is stored by a second CPU 52(2) among the plurality of CPUs; and a control unit 53 which suppresses competition between data stored in the first data region and the second data region.SELECTED DRAWING: Figure 2

Description

本発明は、電子制御装置に関するものである。 The present invention relates to an electronic control device.

従来、車両には、電子化された車両制御機器を操作する複数の電子制御装置(以下、ECU(Electronic Control Unit)と示す場合がある)が備えられる。各ECU間は、車載LAN(Local Area Network)によって双方向通信可能に接続される。 Conventionally, a vehicle is provided with a plurality of electronic control devices (hereinafter, may be referred to as an ECU (Electronic Control Unit)) for operating an electronic vehicle control device. The ECUs are connected to each other via an in-vehicle LAN (Local Area Network) so that bidirectional communication is possible.

センサから取得したデータを演算するために、ECUには、複数のCPU(Central Processing Unit)を搭載するマルチコアマイクロコントローラ(以下、マイコンと略記する場合がある)が設けられる。マイコンでは、共有メモリに保存されるデータを各CPU間で共有して使用する場合がある。共有メモリは、デュアルポートRAM(Random Access Memory)等である。 In order to calculate the data acquired from the sensor, the ECU is provided with a multi-core microcontroller (hereinafter, may be abbreviated as a microcomputer) equipped with a plurality of CPUs (Central Processing Units). In the microcomputer, the data stored in the shared memory may be shared and used between the CPUs. The shared memory is a dual port RAM (Random Access Memory) or the like.

共有メモリへのデータの書き込みまたは、共有メモリからデータを読みだす際に、共有メモリでは、競合が発生する場合が考えられる。これにより、データの競合を回避するための技術が求められる。 When writing data to or reading data from shared memory, contention may occur in shared memory. As a result, a technique for avoiding data races is required.

特許文献1の技術では、共用メモリが複数のブロックに分割される。各ブロックの状態は、ポインタによって個別に示される。記憶装置は、ポインタによって、各ブロックの状態を更新用や参照用に切り換える。記憶装置は、更新中のブロックと参照中のブロックとを別領域に用意することができる。 In the technique of Patent Document 1, the shared memory is divided into a plurality of blocks. The state of each block is individually indicated by a pointer. The storage device switches the state of each block for updating or referencing by using a pointer. The storage device can prepare the block being updated and the block being referenced in different areas.

記憶装置は、ポインタの更新中にポインタメモリの排他をする。ポインタは共用メモリとは別の領域に記憶されるので、記憶装置は、共用メモリの更新処理または参照処理の間には、排他が必要ない。記憶装置は、更新処理の間に参照処理が待機する必要がなく、参照処理の間に更新処理が待機する必要がない。これにより、記憶装置は、待機時間を最小限に抑制することができる。 The storage device excludes the pointer memory while updating the pointer. Since the pointer is stored in an area separate from the shared memory, the storage device does not need to be exclusive between the shared memory update process or the reference process. The storage device does not need to wait for the reference process during the update process, and does not need to wait for the update process during the reference process. As a result, the storage device can minimize the waiting time.

特開2009−110063号公報Japanese Unexamined Patent Publication No. 2009-110063

特許文献1では、更新処理または参照処理が実行された場合には、ブロックの状態を切り換える。しかしながら、ポインタの更新や参照に排他制御を使用しており、新しくポインタにアクセスするCPUには、待ち時間が発生する。リアルタイム性が求められる車両制御では、排他制御による待ち時間を低減することが求められる。 In Patent Document 1, when the update process or the reference process is executed, the block state is switched. However, exclusive control is used for updating and referencing the pointer, and the CPU that newly accesses the pointer has a waiting time. In vehicle control, which requires real-time performance, it is required to reduce the waiting time due to exclusive control.

本発明は、上記のような課題を解決するためのものであり、複数のCPUがそれぞれ実行する処理の待ち時間を低減可能な電子制御装置を提供することを目的とする。 The present invention is for solving the above-mentioned problems, and an object of the present invention is to provide an electronic control device capable of reducing the waiting time for processing executed by a plurality of CPUs.

車両を制御する電子制御装置は、複数のCPU(Central Processing Unit)と、複数のCPUで共有される共有メモリとを含み、共有メモリは、複数のCPUのうち第1CPUによりデータが保存される第1データ領域と、複数のCPUのうち第2CPUによってデータが保存される第2データ領域を備え、さらに第1データ領域および第2データ領域に保存されるデータの競合を抑制する制御部を備え、複数のCPUは、第1ないし第2のデータ領域にデータを保存する更新処理と、第1ないし第2のデータ領域からデータを参照する参照処理と、更新処理から参照処理に順に実行する処理構成を備え、制御部は、第1CPUが第1データ領域に第1データを保存した場合には、第1データが保存されてから第1CPUによって参照処理が実行されるまでの期間、第2CPUが第1データ領域に保存することを抑制する抑制値を第1データ領域に設定する抑制値設定部と、参照処理において、第1CPUによって第1データ領域から第1データが参照された場合には、第1データ領域に保存された抑制値を解放値に変更する解放値設定部と、を備え、第2CPUが第1データ領域に第2データを保存する処理を実行したとき第1データ領域に抑制値が設定されていた場合、第2CPUは第2データ領域に第2データを保存し、第2データ領域を参照したとき第2データ領域の値を第1データ領域に複写する同期処理を実行する。 The electronic control device that controls the vehicle includes a plurality of CPUs (Central Processing Units) and a shared memory shared by the plurality of CPUs, and the shared memory is a first CPU among the plurality of CPUs in which data is stored. It includes one data area, a second data area in which data is stored by the second CPU among a plurality of CPUs, and a control unit that suppresses conflict of data stored in the first data area and the second data area. The plurality of CPUs have a processing configuration in which an update process for saving data in the first to second data areas, a reference process for referencing data from the first to second data areas, and a process configuration for executing the update process to the reference process in order. When the first CPU saves the first data in the first data area, the control unit uses the second CPU for a period from when the first data is saved until the reference process is executed by the first CPU. In the suppression value setting unit that sets the suppression value for suppressing storage in the 1 data area in the first data area, and when the first data is referred to by the first CPU in the reference processing, the first data is referenced. A release value setting unit that changes the suppression value saved in one data area to a release value is provided, and when the second CPU executes a process of saving the second data in the first data area, the suppression value is stored in the first data area. If is set, the second CPU stores the second data in the second data area, and executes a synchronization process of copying the value of the second data area to the first data area when the second data area is referred to.

本発明によると、複数のCPUがそれぞれ実行する処理の待ち時間を低減することができる。 According to the present invention, it is possible to reduce the waiting time for processing executed by each of the plurality of CPUs.

車両制御処理の説明図。Explanatory drawing of vehicle control processing. マイコンの説明図。Explanatory drawing of the microcomputer. ECUのハードウェア構成図。The hardware configuration diagram of the ECU. マイコンの処理のシーケンス図。Sequence diagram of processing of the microcomputer. CPUの処理の流れ図。CPU processing flow chart. データバッファ更新処理の流れ図。Flow chart of data buffer update process. データバッファ参照処理の流れ図。Flow chart of data buffer reference processing. 共有データのE2E保護の説明図。Explanatory drawing of E2E protection of shared data.

本実施形態は、複数の(例えば2つの)CPUがそれぞれ実行する処理の待ち時間を低減可能なECUに関するものである。 The present embodiment relates to an ECU capable of reducing the waiting time for processing executed by a plurality of (for example, two) CPUs.

図1は、車両制御処理の説明図である。車両には、例えば、車載センサ1と、ECU2と、アクチュエータ3とが設けられる。なお、車両には、複数のECU2が設けられてもよい。車載センサ1とECU2とアクチュエータ3とは、車内LANによって双方向通信可能に接続される。 FIG. 1 is an explanatory diagram of vehicle control processing. The vehicle is provided with, for example, an in-vehicle sensor 1, an ECU 2, and an actuator 3. The vehicle may be provided with a plurality of ECUs 2. The in-vehicle sensor 1, the ECU 2, and the actuator 3 are connected by an in-vehicle LAN so that they can communicate in both directions.

車載センサ1は、例えば、エンジンの回転数を検出するエンジン回転センサ等である。なお、車載センサ1は、エンジン回転センサに限られない。車載センサ1は、ECU2にセンサ情報を送信する。センサ情報は、例えば、スイッチ入力、エンジン回転数または吸入空気量等を示す。 The in-vehicle sensor 1 is, for example, an engine rotation sensor that detects the rotation speed of the engine. The in-vehicle sensor 1 is not limited to the engine rotation sensor. The in-vehicle sensor 1 transmits sensor information to the ECU 2. The sensor information indicates, for example, switch input, engine speed, intake air amount, and the like.

ECU2は、センサ情報に基づいて、エンジン、トランスミッションまたはインバータ等を制御する。ECU2は、例えば、入力回路4とマイコン5とドライバIC(Integrated Circuit)6とを備える。 The ECU 2 controls an engine, a transmission, an inverter, or the like based on sensor information. The ECU 2 includes, for example, an input circuit 4, a microcomputer 5, and a driver IC (Integrated Circuit) 6.

入力回路4は、デジタル入力信号やアナログ入力信号を、マイコン5に入力できる信号レベルまたはデジタル値に変換する。入力回路4は、例えば、入力バッファまたはADコンバータ等から構成される。 The input circuit 4 converts a digital input signal or an analog input signal into a signal level or a digital value that can be input to the microcomputer 5. The input circuit 4 is composed of, for example, an input buffer, an AD converter, or the like.

マイコン5は、図2に示すように、第1CPU52(1)と第2CPU52(2)とを備えるマルチコアマイコンである。マイコン5は、各種の入力信号またはパラメータ値等を入力回路4から取得する。マイコン5は、入力回路4から取得した情報を元にアクチュエータ3の制御量を演算する。マイコン5は、ドライバIC6への出力信号を生成する。 As shown in FIG. 2, the microcomputer 5 is a multi-core microcomputer including a first CPU 52 (1) and a second CPU 52 (2). The microcomputer 5 acquires various input signals, parameter values, and the like from the input circuit 4. The microcomputer 5 calculates the control amount of the actuator 3 based on the information acquired from the input circuit 4. The microcomputer 5 generates an output signal to the driver IC 6.

ドライバIC6は、マイコン5の出力信号からアクチュエータ3の制御信号を生成する。なお、ドライバIC6は、例えば、電圧増幅、ON/OFF出力、パルス出力またはPWM(Pulse Width Modulation)出力等を生成してもよい。 The driver IC 6 generates a control signal for the actuator 3 from the output signal of the microcomputer 5. The driver IC 6 may generate, for example, voltage amplification, ON / OFF output, pulse output, PWM (Pulse Width Modulation) output, or the like.

アクチュエータ3は、例えば、ソレノイドバルブ、モータまたはリレー等の部品である。アクチュエータ3は、例えば、燃料噴射装置や点火装置等を駆動させる。 The actuator 3 is, for example, a component such as a solenoid valve, a motor, or a relay. The actuator 3 drives, for example, a fuel injection device, an ignition device, and the like.

図2は、マイコン5の説明図である。マイコン5は、例えば、共有メモリ51と、第1CPU52(1)と、第2CPU52(2)と、「制御部」の一例としてのデータバッファ制御部53と、判定値保存部54とを備える。なお、特に区別しない場合には、第1CPU52(1)と第2CPU52(2)とは、CPU52と示す場合がある。 FIG. 2 is an explanatory diagram of the microcomputer 5. The microcomputer 5 includes, for example, a shared memory 51, a first CPU 52 (1), a second CPU 52 (2), a data buffer control unit 53 as an example of a “control unit”, and a determination value storage unit 54. When not particularly distinguished, the first CPU 52 (1) and the second CPU 52 (2) may be referred to as the CPU 52.

共有メモリ51は、各CPU52に共有して使用される。共有メモリ51には、例えば、「第1データ領域」の一例としての第1データバッファ511(1)と「第2データ領域」の一例としての第2データバッファ511(2)とが備えられる。なお、第1データバッファ511(1)と第2データバッファ511(2)とは、特に区別しない場合には、データバッファ511と示す場合がある。 The shared memory 51 is shared and used by each CPU 52. The shared memory 51 is provided with, for example, a first data buffer 511 (1) as an example of the "first data area" and a second data buffer 511 (2) as an example of the "second data area". The first data buffer 511 (1) and the second data buffer 511 (2) may be referred to as a data buffer 511 unless otherwise distinguished.

データバッファ511には、例えば、アクチュエータ3の制御に必要な制御値が保存される。制御値には、車載センサ1から送信されたセンサ情報が含まれる。データバッファ511に保存される制御値は、各CPU52から更新および参照される。 In the data buffer 511, for example, control values required for controlling the actuator 3 are stored. The control value includes sensor information transmitted from the vehicle-mounted sensor 1. The control values stored in the data buffer 511 are updated and referenced by each CPU 52.

各CPU52は、第1判定値541(1)と第2判定値541(2)とに基づいて、データバッファ511のデータを更新および参照する。なお、第1判定値541(1)および第2判定値541(2)は、特に区別しない場合には、判定値541と示す場合がある。 Each CPU 52 updates and refers to the data in the data buffer 511 based on the first determination value 541 (1) and the second determination value 541 (2). The first determination value 541 (1) and the second determination value 541 (2) may be indicated as a determination value 541 unless otherwise specified.

第1CPU52(1)は、所定の周期で、更新処理と参照処理とを含む所定の処理を実行する。第2CPU52(2)は、「所定の信号」の一例としてのイベントトリガによって、所定の処理を実行する。 The first CPU 52 (1) executes a predetermined process including an update process and a reference process at a predetermined cycle. The second CPU 52 (2) executes a predetermined process by an event trigger as an example of the “predetermined signal”.

判定値541は、各CPU52がデータバッファ511にデータを保存できるかを判定する。各判定値541は、例えば、判定値保存部54に保存される。第1判定値541(1)は、第1データバッファ511(1)に対応して設定される。第2判定値541(2)は、第2データバッファ511(2)に対応して設定される。 The determination value 541 determines whether each CPU 52 can store data in the data buffer 511. Each determination value 541 is stored in, for example, the determination value storage unit 54. The first determination value 541 (1) is set corresponding to the first data buffer 511 (1). The second determination value 541 (2) is set corresponding to the second data buffer 511 (2).

判定値541は、例えば、「0」と「1」とで示されるフラグによって、保存可能かどうかを示してもよい。CPU52は、判定値541が「0」を示すデータバッファ511にデータを保存してもよい。CPU52は、判定値541が「1」を示すデータバッファ511にデータを保存することを抑制される。 The determination value 541 may indicate whether or not it can be saved by, for example, the flags indicated by "0" and "1". The CPU 52 may store data in the data buffer 511 in which the determination value 541 indicates "0". The CPU 52 is suppressed from storing data in the data buffer 511 in which the determination value 541 indicates "1".

すなわち、第1判定値541(1)が「0」を示す場合には、CPU52は、例えば、第1データバッファ511(1)にデータを保存してもよい。第1判定値541(1)が「1」を示す場合には、CPU52は、例えば、第1データバッファ511(1)にデータを保存することを抑制される。 That is, when the first determination value 541 (1) indicates "0", the CPU 52 may store the data in the first data buffer 511 (1), for example. When the first determination value 541 (1) indicates "1", the CPU 52 is suppressed from storing the data in the first data buffer 511 (1), for example.

データバッファ制御部53は、判定値541を設定する。データバッファ制御部53は、例えば、抑制値設定部531と解放値設定部532とを備える。 The data buffer control unit 53 sets the determination value 541. The data buffer control unit 53 includes, for example, a suppression value setting unit 531 and a release value setting unit 532.

抑制値設定部531は、CPU52によってデータバッファ511が更新された場合に、判定値541を「1」に設定する。例えば、抑制値設定部531は、CPU52が第1データバッファ511(1)を更新した場合には、第1判定値541(1)を「抑制値」の一例としての「1」に設定する。 The suppression value setting unit 531 sets the determination value 541 to "1" when the data buffer 511 is updated by the CPU 52. For example, when the CPU 52 updates the first data buffer 511 (1), the suppression value setting unit 531 sets the first determination value 541 (1) to "1" as an example of the "suppression value".

解放値設定部532は、CPU52によってデータバッファ511が参照された場合には、判定値541を「0」に設定する。例えば、CPU52が第1データバッファ511(1)を参照した場合には、解放値設定部532は、第1判定値541(1)を「解放値」の一例としての「0」に設定する。 The release value setting unit 532 sets the determination value 541 to "0" when the data buffer 511 is referred to by the CPU 52. For example, when the CPU 52 refers to the first data buffer 511 (1), the release value setting unit 532 sets the first determination value 541 (1) to "0" as an example of the "release value".

さらに、解放値設定部532は、後述する同期処理(S45、図7参照)が実行される場合には、複製元のデータバッファ511に対応する判定値541を「0」に設定する。例えば、同期処理(S45)によって第2データバッファ511(2)のデータが第1データバッファ511(1)に複製される場合には、解放値設定部532は、第2データバッファ511(2)に対応する第2判定値541(2)を「0」に設定する。 Further, the release value setting unit 532 sets the determination value 541 corresponding to the data buffer 511 of the duplication source to "0" when the synchronization process (S45, see FIG. 7) described later is executed. For example, when the data in the second data buffer 511 (2) is replicated in the first data buffer 511 (1) by the synchronization process (S45), the release value setting unit 532 sets the second data buffer 511 (2). The second determination value 541 (2) corresponding to is set to "0".

図3は、ECU2のハードウェア構成図である。ECU2は、例えば、二つのCPU52と、記憶部55と、メモリ50と、入力回路4と、ドライバIC6と、各機能4,6,50,52,55を双方向通信可能に接続するデータ伝送路56とを備える。 FIG. 3 is a hardware configuration diagram of the ECU 2. The ECU 2 is, for example, a data transmission line that connects two CPUs 52, a storage unit 55, a memory 50, an input circuit 4, a driver IC 6, and functions 4, 6, 50, 52, 55 in two-way communication. It includes 56.

記憶部55には、例えば、データバッファ制御部53のプログラムが保存される。記憶部55には、例えば、判定値保存部54のデータベースが保存される。メモリ50は、例えば、RAM等の揮発性記憶媒体である。 For example, the program of the data buffer control unit 53 is stored in the storage unit 55. In the storage unit 55, for example, the database of the determination value storage unit 54 is stored. The memory 50 is, for example, a volatile storage medium such as a RAM.

以下、図5以降に示すマイコン5の処理(S1〜S5)について、図4を参照しながら説明する。図4は、マイコン5の処理のシーケンス図である。図4には、例えば、第1CPU52(1)が第2CPU52(2)よりも早く更新処理(S3)を実行する場合について示される。 Hereinafter, the processing (S1 to S5) of the microcomputer 5 shown in FIGS. 5 and 5 will be described with reference to FIG. FIG. 4 is a sequence diagram of processing of the microcomputer 5. FIG. 4 shows, for example, a case where the first CPU 52 (1) executes the update process (S3) earlier than the second CPU 52 (2).

図5は、CPU52の流れ図である。CPU52は、処理(S2〜S5)を実行するかを判定する(S1)。第1CPU52(1)は、所定の周期で処理(S2〜S5)を実行する。第2CPU52(2)は、外部から取得したイベント信号に基づいて、処理(S2〜S5)を実行する。 FIG. 5 is a flow chart of the CPU 52. The CPU 52 determines whether to execute the processes (S2 to S5) (S1). The first CPU 52 (1) executes processing (S2 to S5) at a predetermined cycle. The second CPU 52 (2) executes the process (S2 to S5) based on the event signal acquired from the outside.

CPU52は、入力回路4によって車載センサ1からセンサ情報を取得する(S2)。第1CPU52(1)は、例えば、センサ情報のデータ「AA」を取得する。第2CPU52(2)は、例えば、センサ情報のデータ「BB」を取得する。CPU52は、データバッファ更新処理(S3)をする。 The CPU 52 acquires sensor information from the vehicle-mounted sensor 1 by the input circuit 4 (S2). The first CPU 52 (1) acquires, for example, the sensor information data “AA”. The second CPU 52 (2) acquires, for example, the sensor information data “BB”. The CPU 52 performs a data buffer update process (S3).

図6は、データバッファ更新処理(S3)の流れ図である。CPU52は、第1データバッファ511(1)に対応する第1判定値541(1)を取得し、データを保存できるかを判定する(S31)。 FIG. 6 is a flow chart of the data buffer update process (S3). The CPU 52 acquires the first determination value 541 (1) corresponding to the first data buffer 511 (1), and determines whether the data can be saved (S31).

第1判定値541(1)が「0」の場合(S31:Yes)には、CPU52は、第1データバッファ511(1)にデータを保存する(S32)。例えば、第1CPU52(1)は、第1判定値541(1)が「0」であるため、第1データバッファ511(1)にデータ「AA」を保存する。抑制値設定部531は、第1判定値541(1)を「1」に設定する(S33)。 When the first determination value 541 (1) is "0" (S31: Yes), the CPU 52 saves the data in the first data buffer 511 (1) (S32). For example, the first CPU 52 (1) stores the data “AA” in the first data buffer 511 (1) because the first determination value 541 (1) is “0”. The suppression value setting unit 531 sets the first determination value 541 (1) to "1" (S33).

第1判定値541(1)が「1」の場合(S31:No)には、CPU52は、第2データバッファ511(2)にデータを保存する(S34)。例えば、第2CPU52(2)は、第1判定値541(1)が「1」であるため、第2データバッファ511(2)にデータ「BB」を保存する。 When the first determination value 541 (1) is "1" (S31: No), the CPU 52 saves the data in the second data buffer 511 (2) (S34). For example, the second CPU 52 (2) stores the data “BB” in the second data buffer 511 (2) because the first determination value 541 (1) is “1”.

抑制値設定部531は、第2判定値541(2)を「1」に設定する(S35)。CPU52は、処理(S33)または処理(S35)が終了後に、データバッファ更新処理(S3)を終了する。なお、CPU52は、データバッファ更新処理(S3)を終了に、ヘッダ部分またはフッタ部分の負荷データを更新または参照する演算処理が実行されてもよい。 The suppression value setting unit 531 sets the second determination value 541 (2) to "1" (S35). The CPU 52 ends the data buffer update process (S3) after the process (S33) or the process (S35) is completed. The CPU 52 may execute an arithmetic process for updating or referencing the load data of the header portion or the footer portion after the data buffer update process (S3) is completed.

図5に戻り、CPU52は、データバッファ参照処理(S4)を実行する。図7は、データバッファ参照処理(S4)の流れ図である。各CPU52は、第1データバッファ511(1)を参照する(S401)。各CPU52は、共有メモリに保存されるデータを参照する際には、第2データバッファ511(2)ではなく、第1データバッファ511(1)を参照する。 Returning to FIG. 5, the CPU 52 executes the data buffer reference process (S4). FIG. 7 is a flow chart of the data buffer reference process (S4). Each CPU 52 refers to the first data buffer 511 (1) (S401). When referring to the data stored in the shared memory, each CPU 52 refers to the first data buffer 511 (1) instead of the second data buffer 511 (2).

すなわち、第1データバッファ511(1)は、参照用として使用されるメモリの領域である。第2データバッファ511(2)は、第1データバッファ511(1)の更新が抑制されている場合に一時的に保存されるメモリの領域である。 That is, the first data buffer 511 (1) is an area of memory used for reference. The second data buffer 511 (2) is an area of memory that is temporarily stored when the update of the first data buffer 511 (1) is suppressed.

各CPU52は、第1データバッファ511(1)または第2データバッファ511(2)をデータの更新先として選択できるが、データの参照先として第1データバッファ511(1)を選択する。 Each CPU 52 can select the first data buffer 511 (1) or the second data buffer 511 (2) as the data update destination, but selects the first data buffer 511 (1) as the data reference destination.

CPU52は、第1判定値541(1)が「0」であるかを判定する(S42)。第1判定値541(1)が「0」である場合(S42:Yes)には、CPU52は、データバッファ参照処理(S4)を終了する。 The CPU 52 determines whether the first determination value 541 (1) is "0" (S42). When the first determination value 541 (1) is "0" (S42: Yes), the CPU 52 ends the data buffer reference process (S4).

第1判定値541(1)が「1」である場合(S42:No)には、解放値設定部532は、第1判定値541(1)を「0」に設定する(S43)。例えば、第1CPU52(1)が第1データバッファ511(1)のデータ「AA」を参照することにより、解放値設定部532は、第1判定値541(1)を「0」に設定する。 When the first determination value 541 (1) is "1" (S42: No), the release value setting unit 532 sets the first determination value 541 (1) to "0" (S43). For example, when the first CPU 52 (1) refers to the data “AA” of the first data buffer 511 (1), the release value setting unit 532 sets the first determination value 541 (1) to “0”.

各CPU52は、第2判定値541(2)が「0」であるかを判定する(S44)。第2判定値541(2)が「0」である場合(S44:Yes)には、ECU2は、データバッファ参照処理(S4)を終了する。 Each CPU 52 determines whether the second determination value 541 (2) is "0" (S44). When the second determination value 541 (2) is "0" (S44: Yes), the ECU 2 ends the data buffer reference process (S4).

第2判定値541(2)が「1」である場合(S44:No)には、各CPU52は、第2データバッファ511(2)のデータを第1データバッファ511(1)に複製する(S45)。例えば、第2判定値541(2)が「1」であるため、第1CPU52(1)は、データ「BB」を第1データバッファ511(1)に複製する。 When the second determination value 541 (2) is "1" (S44: No), each CPU 52 replicates the data of the second data buffer 511 (2) to the first data buffer 511 (1) ( S45). For example, since the second determination value 541 (2) is "1", the first CPU 52 (1) duplicates the data "BB" in the first data buffer 511 (1).

解放値設定部532は、第2判定値541(2)を「0」に設定する(S46)。ECU2は、データバッファ参照処理(S4)を終了する。図5に戻り、CPU52は、参照したデータを用いて、ドライバIC6に制御値を出力する(S6)。 The release value setting unit 532 sets the second determination value 541 (2) to "0" (S46). The ECU 2 ends the data buffer reference process (S4). Returning to FIG. 5, the CPU 52 outputs a control value to the driver IC 6 using the referenced data (S6).

図8は、共有データのE2E(End−to−End)保護の説明図である。共有メモリ51内の複数のデータバッファ511に保存される共有データが、自動車用機能安全規格(ISO 26262)に規定されたASIL(Automotive Safety Integrity Level)レベルの通信データである場合には、ECU2は、規定された故障検出率を満たすことが求められる。 FIG. 8 is an explanatory diagram of E2E (End-to-End) protection of shared data. When the shared data stored in the plurality of data buffers 511 in the shared memory 51 is ASIL (Automotive Safety Intelligence Level) level communication data specified in the automobile functional safety standard (ISO 26262), the ECU 2 performs , It is required to meet the specified failure detection rate.

通信データを保護するためのE2E保護機能としては、例えば、巡回冗長検査(CRC:Cyclic Redundancy Check)などが含まれる。ECU2には、データ送信部7とデータ受信部8とが含まれる。データ送信部7は、共有メモリ51(1)と、通信データ57と、CRC演算部58(1)と、誤り検出符号59(1)とを備える。 The E2E protection function for protecting communication data includes, for example, a cyclic redundancy check (CRC) and the like. The ECU 2 includes a data transmitting unit 7 and a data receiving unit 8. The data transmission unit 7 includes a shared memory 51 (1), communication data 57, a CRC calculation unit 58 (1), and an error detection code 59 (1).

共有メモリ51(1)には、通信データ57が保存される。通信データ57は、データ受信部8に送信されるとともに、CRC演算部58(1)に入力される。 Communication data 57 is stored in the shared memory 51 (1). The communication data 57 is transmitted to the data receiving unit 8 and input to the CRC calculation unit 58 (1).

CRC演算部58(1)は、通信データ57に対する誤り検出符号59(1)を算出する。誤り検出符号59(1)は、通信データ57に付加され、データ受信部8に送信される。 The CRC calculation unit 58 (1) calculates the error detection code 59 (1) for the communication data 57. The error detection code 59 (1) is added to the communication data 57 and transmitted to the data receiving unit 8.

データ受信部8は、共有メモリ51(2)と、通信データ57と、CRC演算部58(2)と、誤り検出符号59(1)と、誤り検出符号59(2)と、符号比較部60と、データ処理部61とを備える。通信データ57は、データ送信部7から送信されてきたデータであり、データ処理部61とCRC演算部58(2)に入力される。 The data receiving unit 8 includes a shared memory 51 (2), communication data 57, a CRC calculation unit 58 (2), an error detection code 59 (1), an error detection code 59 (2), and a code comparison unit 60. And a data processing unit 61. The communication data 57 is data transmitted from the data transmission unit 7, and is input to the data processing unit 61 and the CRC calculation unit 58 (2).

誤り検出符号59(1)は、通信データ57に付加されて、データ送信部7から送信されてきた符号であり、符号比較部60に入力される。CRC演算部58(2)は、通信データ57に対する誤り検出符号59(2)を算出する。誤り検出符号59(2)は、符号比較部60に入力される。 The error detection code 59 (1) is a code added to the communication data 57 and transmitted from the data transmission unit 7, and is input to the code comparison unit 60. The CRC calculation unit 58 (2) calculates the error detection code 59 (2) for the communication data 57. The error detection code 59 (2) is input to the code comparison unit 60.

符号比較部60は、誤り検出符号59(1)と誤り検出符号59(2)とを比較し、その符号比較結果をデータ処理部61に入力する。データ処理部61は、符号比較部60からの符号比較結果を参照する。 The code comparison unit 60 compares the error detection code 59 (1) with the error detection code 59 (2), and inputs the code comparison result to the data processing unit 61. The data processing unit 61 refers to the code comparison result from the code comparison unit 60.

データ処理部61は、問題がない場合には、通信データ57を共有メモリ51(2)に保存する。データ処理部61は、問題がある場合には、通信データ57の代わりに固定データを共有メモリ51(2)に保存する。これにより、データ送信部7とデータ受信部8との間でデータを保護することができる。 If there is no problem, the data processing unit 61 stores the communication data 57 in the shared memory 51 (2). When there is a problem, the data processing unit 61 stores fixed data in the shared memory 51 (2) instead of the communication data 57. As a result, data can be protected between the data transmitting unit 7 and the data receiving unit 8.

図4に戻り、第1CPU52(1)が更新した値を第1CPU52(1)が参照するより前に第2CPU52(2)が上書き更新した場合には、第1CPU52(1)は、更新した値と異なる値を参照することになる。これにより、CPU52には、データの競合を回避することが求められる。 Returning to FIG. 4, when the second CPU 52 (2) overwrites and updates the value updated by the first CPU 52 (1) before the first CPU 52 (1) refers to it, the first CPU 52 (1) has the updated value. You will refer to different values. As a result, the CPU 52 is required to avoid data races.

データの競合を回避するための方法として、排他制御が知られている。排他制御は、共有データにアクセスするタイミングが同時に発生しないことを実現する。排他制御は、例えば、セマフォ等が用いられる。 Exclusive control is known as a method for avoiding data races. Exclusive control realizes that the timing of accessing shared data does not occur at the same time. For exclusive control, for example, a semaphore or the like is used.

CPU52は、共有データにアクセスする前にセマフォの取得を行う。CPU52は、セマフォの取得に成功した場合に、データの更新または参照を実行する。CPU52は、データの更新または参照の終了後にセマフォを解放する。セマフォを取得したCPUまたはタスクは、セマフォの解放をすることができる。 The CPU 52 acquires the semaphore before accessing the shared data. When the acquisition of the semaphore is successful, the CPU 52 updates or refers to the data. The CPU 52 releases the semaphore after the data has been updated or referenced. The CPU or task that has acquired the semaphore can release the semaphore.

例えば、所定のCPU52がセマフォを取得しているとき、他のCPU52がセマフォを取得しようとすると、セマフォが解放されるまで待ち状態となる。所定のCPU52によってセマフォが解放されると、他のCPU52における1つのCPU52がセマフォを取得する。マルチコア間のセマフォは、例えば、複数のCPU52が同時にセマフォを取得することができないハードウェアにより実現される。 For example, when a predetermined CPU 52 is acquiring a semaphore, if another CPU 52 tries to acquire the semaphore, it will be in a waiting state until the semaphore is released. When the semaphore is released by the predetermined CPU 52, one CPU 52 in the other CPU 52 acquires the semaphore. The semaphore between multiple cores is realized by, for example, hardware in which a plurality of CPUs 52 cannot acquire the semaphore at the same time.

しかしながら、所定のCPU52がセマフォを取得している場合には、他のCPU52の処理が停止する。車両を制御する処理には、車両の安全を確保するためにリアルタイム性が求められる。これにより、セマフォによる排他制御では、処理待ちのCPU52がリアルタイム性を発揮することが困難である場合が考えられる。 However, when the predetermined CPU 52 has acquired the semaphore, the processing of the other CPU 52 is stopped. The process of controlling the vehicle is required to be real-time in order to ensure the safety of the vehicle. As a result, it may be difficult for the CPU 52 waiting for processing to exhibit real-time performance by exclusive control by the semaphore.

さらに、車載センサ1から送信されるセンサ情報は、自動運転等の技術の発展に従って、容量が増大する。マイコン5には、リアルタイム性を発揮するために、センサ情報を処理するための時間を確保することが求められる。これにより、マイコン5には、CPU52の負荷を低減させることが求められる。 Further, the capacity of the sensor information transmitted from the vehicle-mounted sensor 1 increases with the development of technologies such as automatic driving. The microcomputer 5 is required to secure time for processing sensor information in order to exhibit real-time performance. As a result, the microcomputer 5 is required to reduce the load on the CPU 52.

以上に示すECU2は、データバッファ制御部53を備えることによって、データバッファ511の判定値541に基づいてデータの競合を回避することができる。これにより、各CPU52は、データバッファ511に保存したデータを正確に参照することができる。 By providing the data buffer control unit 53, the ECU 2 shown above can avoid data contention based on the determination value 541 of the data buffer 511. As a result, each CPU 52 can accurately refer to the data stored in the data buffer 511.

参照処理(S4)は、同期処理(S45)を実行することによって、各データバッファ511間でデータの一貫性を図ることができる。これにより、各CPU52は、正確なデータを参照することができる。 In the reference process (S4), data consistency can be achieved between the data buffers 511 by executing the synchronous process (S45). As a result, each CPU 52 can refer to accurate data.

各CPU52は、第1データバッファ511(1)からデータを参照するように設定されることにより、更新処理にてデータを保存したCPU52を特定しなくてもよい。これにより、CPU52の特定処理を削減できるため、CPU52の負荷率を低減させることができる。 By setting each CPU 52 to refer to the data from the first data buffer 511 (1), it is not necessary to specify the CPU 52 in which the data is stored in the update process. As a result, the specific processing of the CPU 52 can be reduced, so that the load factor of the CPU 52 can be reduced.

なお、本発明は上記した実施例に限定されるものではなく、様々な変形例が含まれる。例えば、上記した実施例は本発明を分かりやすく説明するために詳細に説明したものであり、必ずしも説明した全ての構成を備えるものに限定されるものではない。ある実施例の構成の一部を他の実施例の構成に置き換えることが可能であり、ある実施例の構成に他の実施例の構成を加えることも可能である。 The present invention is not limited to the above-described examples, and includes various modifications. For example, the above-described embodiment has been described in detail in order to explain the present invention in an easy-to-understand manner, and is not necessarily limited to the one including all the described configurations. It is possible to replace a part of the configuration of one embodiment with the configuration of another embodiment, and it is also possible to add the configuration of another embodiment to the configuration of one embodiment.

各実施例の構成の一部について、他の構成の追加・削除・置換をすることが可能である。上記の各構成、機能、処理部、処理手段等は、それらの一部または全部を、例えば集積回路で設計する等によりハードウェアで実現してもよい。上記の各構成、機能等は、プロセッサがそれぞれの機能を実現するプログラムを解釈し、実行することによりソフトウェアで実現してもよい。 It is possible to add / delete / replace other configurations with respect to a part of the configurations of each embodiment. Each of the above configurations, functions, processing units, processing means, etc. may be realized by hardware by designing a part or all of them by, for example, an integrated circuit. Each of the above configurations, functions, and the like may be realized by software by the processor interpreting and executing a program that realizes each function.

本発明は、以下に示す電子制御方法を含むことができる。第1CPUが共有メモリ内の第1データ領域に第1データを保存した場合には、前記第1データが保存されてから前記第1CPUによって参照されるまでに、第2CPUが前記第1データ領域に第2データを保存することを抑制し、前記第1CPUによって前記第1データ領域から前記第1データが参照された場合には、前記第1データ領域を前記第1CPUから解放する電子制御方法。 The present invention can include the electronic control methods shown below. When the first CPU stores the first data in the first data area in the shared memory, the second CPU is stored in the first data area from the time when the first data is saved until it is referenced by the first CPU. An electronic control method for suppressing storage of second data and releasing the first data area from the first CPU when the first data is referenced from the first data area by the first CPU.

本発明は、以下に示すコンピュータプログラムを含むことができる。コンピュータを電子制御装置として機能させるためのコンピュータプログラムは、コンピュータ上に、第1CPUが共有メモリ内の第1データ領域に第1データを保存した場合には、前記第1データが保存されてから前記第1CPUによって参照されるまでに、第2CPUが前記第1データ領域に第2データを保存することを抑制させる機能と、前記第1CPUによって前記第1データ領域から前記第1データが参照された場合には、前記第1データ領域を前記第1CPUから解放する機能とを実現する。 The present invention can include the computer programs shown below. When the first CPU stores the first data in the first data area in the shared memory on the computer, the computer program for operating the computer as an electronic control device is described after the first data is saved. A function of suppressing the second CPU from storing the second data in the first data area before being referred by the first CPU, and a case where the first data is referred to from the first data area by the first CPU. To realize the function of releasing the first data area from the first CPU.

1・・・車載センサ,2・・・電子制御装置,3・・・アクチュエータ,4・・・入力回路,5・・・マイコン,50・・・メモリ,51・・・共有メモリ,511(1)・・・第1データバッファ,511(2)・・・第2データバッファ,52(1)・・・第1CPU,52(2)・・・第2CPU,53・・・制御部,531・・・抑制値設定部,532・・・解放値設定部,54・・・判定値保存部,541(1)・・・第1判定値,541(2)・・・第2判定値,6・・・ドライバIC 1 ... In-vehicle sensor, 2 ... Electronic control device, 3 ... Actuator, 4 ... Input circuit, 5 ... Microcomputer, 50 ... Memory, 51 ... Shared memory, 511 (1) ) ... 1st data buffer, 511 (2) ... 2nd data buffer, 52 (1) ... 1st CPU, 52 (2) ... 2nd CPU, 53 ... Control unit, 531. .. Suppression value setting unit, 532 ... Release value setting unit, 54 ... Judgment value storage unit, 541 (1) ... 1st judgment value, 541 (2) ... 2nd judgment value, 6・ ・ ・ Driver IC

Claims (8)

車両を制御する電子制御装置であって、
前記電子制御装置は、
複数のCPU(Central Processing Unit)と、前記複数のCPUで共有される共有メモリとを含み、前記共有メモリは、前記複数のCPUのうち第1CPUによりデータが保存される第1データ領域と、前記複数のCPUのうち第2CPUによってデータが保存される第2データ領域を備え、
さらに前記第1データ領域および前記第2データ領域に保存されるデータの競合を抑制する制御部
を備え、
前記複数のCPUは、第1ないし第2のデータ領域にデータを保存する更新処理と、第1ないし第2のデータ領域からデータを参照する参照処理と、更新処理から参照処理に順に実行する処理構成を備え、
前記制御部は、
第1CPUが第1データ領域に第1データを保存した場合には、前記第1データが保存されてから前記第1CPUによって前記参照処理が実行されるまでの期間、第2CPUが第1データ領域に保存することを抑制する抑制値を第1データ領域に設定する抑制値設定部と、
前記参照処理において、第1CPUによって第1データ領域から第1データが参照された場合には、第1データ領域に保存された抑制値を解放値に変更する解放値設定部と、
を備え、
第2CPUが第1データ領域に第2データを保存する処理を実行したとき第1データ領域に抑制値が設定されていた場合、第2CPUは第2データ領域に第2データを保存し、第2データ領域を参照したとき第2データ領域の値を第1データ領域に複写する同期処理を実行すること、
を特徴とする電子制御装置。
An electronic control device that controls a vehicle
The electronic control device is
A plurality of CPUs (Central Processing Units) and a shared memory shared by the plurality of CPUs are included, and the shared memory includes a first data area in which data is stored by the first CPU among the plurality of CPUs, and the said. A second data area in which data is stored by the second CPU among a plurality of CPUs is provided.
Further, it is provided with a control unit that suppresses conflict of data stored in the first data area and the second data area.
The plurality of CPUs execute an update process for storing data in the first to second data areas, a reference process for referencing data from the first to second data areas, and a process for sequentially executing the update process to the reference process. With composition,
The control unit
When the first CPU stores the first data in the first data area, the second CPU is stored in the first data area during the period from when the first data is saved until the reference process is executed by the first CPU. A suppression value setting unit that sets the suppression value that suppresses saving in the first data area,
In the reference process, when the first data is referenced from the first data area by the first CPU, the release value setting unit that changes the suppression value stored in the first data area to the release value, and the release value setting unit.
With
If the suppression value is set in the first data area when the second CPU executes the process of storing the second data in the first data area, the second CPU stores the second data in the second data area and the second To execute a synchronization process that copies the value of the second data area to the first data area when the data area is referenced.
An electronic control device characterized by.
前記更新処理において、前記第2CPUは、前記第1データ領域に前記抑制値が設定される場合には、前記第2データを前記第2データ領域に保存する
請求項1に記載の電子制御装置。
The electronic control device according to claim 1, wherein in the update process, when the suppression value is set in the first data area, the second CPU stores the second data in the second data area.
前記抑制値設定部は、前記第2CPUが前記第2データ領域に前記第2データを保存する場合には、前記抑制値を前記第2データ領域に設定する
請求項2に記載の電子制御装置。
The electronic control device according to claim 2, wherein the suppression value setting unit sets the suppression value in the second data area when the second CPU stores the second data in the second data area.
前記解放値設定部は、前記第2データ領域に保存される前記第2データが前記第1データ領域に保存される場合には、前記第2データ領域に前記解放値を設定する
請求項3に記載の電子制御装置。
The release value setting unit according to claim 3 sets the release value in the second data area when the second data stored in the second data area is stored in the first data area. The electronic control device described.
前記第1CPUは、所定の周期で前記所定の処理を実行する
請求項1に記載の電子制御装置。
The electronic control device according to claim 1, wherein the first CPU executes the predetermined process at a predetermined cycle.
前記第2CPUは、所定の信号によって前記所定の処理を実行する
請求項1に記載の電子制御装置。
The electronic control device according to claim 1, wherein the second CPU executes the predetermined process by a predetermined signal.
前記共有メモリに保存されるデータは、車載機器の制御に用いる制御値である
請求項1に記載の電子制御装置。
The electronic control device according to claim 1, wherein the data stored in the shared memory is a control value used for controlling an in-vehicle device.
さらに、前記電子制御装置には、所定の自動車用安全基準に基づいてデータを保護する自動車用セキュリティ部が備えられる
請求項1に記載の電子制御装置。
The electronic control device according to claim 1, further comprising an automobile security unit that protects data based on a predetermined automobile safety standard.
JP2019219056A 2019-12-03 2019-12-03 Electronic control device Pending JP2021089531A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019219056A JP2021089531A (en) 2019-12-03 2019-12-03 Electronic control device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019219056A JP2021089531A (en) 2019-12-03 2019-12-03 Electronic control device

Publications (1)

Publication Number Publication Date
JP2021089531A true JP2021089531A (en) 2021-06-10

Family

ID=76220320

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019219056A Pending JP2021089531A (en) 2019-12-03 2019-12-03 Electronic control device

Country Status (1)

Country Link
JP (1) JP2021089531A (en)

Similar Documents

Publication Publication Date Title
EP1703391B1 (en) Vehicle control software and vehicle control apparatus
US7650274B2 (en) Microcomputer logic development system
CN108351840B (en) Vehicle control device
JP6011379B2 (en) Tamper detection system, electronic control unit
US20170277566A1 (en) Software component assigning system for vehicle
JP2014230140A (en) Repeating device
US20120185876A1 (en) Control device, control method, and computer readable medium
EP3920020A1 (en) Electronic control device and program update method
WO2011102207A1 (en) Embedded control device
EP1712424B1 (en) Vehicle control apparatus
US20220063646A1 (en) Onboard device, information generating method, non-transitory storage medium, and vehicle
JP2021089531A (en) Electronic control device
KR101601074B1 (en) ECU Updating Apparatus, ECU Updating Method and ECU Updating Network using the same
JP2004220326A (en) Control software structure and controller using the structure
JP3827565B2 (en) Microcomputer logic development equipment
US20210065478A1 (en) Electronic control unit and non-transitory computer readable medium storing session establishment program
JP6183251B2 (en) Electronic control unit
JP6865707B2 (en) Vehicle control device
JP5978873B2 (en) Electronic control unit
EP3428799B1 (en) Data access device and access error notification method
US20240020245A1 (en) Electronic control device
JP2019212032A (en) Electronic control device with multi-core microcomputer
JP2023009818A (en) Electronic control device for vehicle and control method by electronic control device for vehicle
JP2002202891A (en) Electronic controller and recording medium
WO2024087234A1 (en) Method and apparatus for updating software, and intelligent device