ECU Software V1 Explanation - Part 1

The Arduino sketch contains the usual Arduino standard functions setup() and loop(). SW V1 sketch can be downloaded here: efi_davide_20160131_v1.

The function setup() is run when the microcontroller turns ON. In the code, the following instructions are executed:

  • Timer1.initialize() initializes the timer object, which is used to handle the injection extra time. Timer1 is declared in the Tempo library, which can be downloaded here: tempo_library_v1.
  • With pinMode() function, the status of the digital input (IN_INJ_PIN=2) and output (OUT_INJ_PIN=12) is set.
  • Serial1.begin(9600) is used to initialize the status of the serial connection, which is used to communicate with the data logger/service tool, and with the PC. Arduino Micro Serial1 port is used for this feature.
  • EEPROM_check() has the purpose of checking if the information written in the EEPROM is correct. In case of corruption, standard values are written in the EEPROM.
  • attachInterrupt() is used to attach an interrupt on digital input pin 2, which is the one connected to the Honda CBR125R original ECU. This input is used to read the status of the signal which the original ECU wants to output to the fuel injector.
  • Initialization of the global variables.

The function loop() is run continuously, until the Arduino power supply is cut or the microcontroller is reset. The function can be divided in the following parts:

  • Serial communication buffer check, to verify if any message character has been received on Serial1.
  • in case a request for sending info (rpm, injection time, throttle position, and so on) has been received via Serial1, the ECU replies.

 

Author: Davide Cavaliere

I am an Italian Electrical Engineer graduated at Politecnico di Milano. My interests are motorcycles and cars, electronics, programming, Internet of Things, and Japanese culture.

Leave a Reply

Your email address will not be published. Required fields are marked *