Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 2.7 KB

mega2560.md

File metadata and controls

72 lines (49 loc) · 2.7 KB

Mega 2560

The Mega 2560 is the recommended tool for EC flashing and debugging.

The Mega 2560 is an open-source hardware design by Arduino based on the 8-bit Atmel ATmega2560. Arduino's official model sells for around 40 USD. Multiple clones exist, and can be bought for around 15 USD.

Clone compatibility

Multiple clones of the Arduino Mega 2560 exist. Clones can be used, but must be compatible with the Arduino model. Some have replaced the ATmega16U2 chip used for USB communication with a CH340G chip. If it does not explicitly state that it uses the ATmega16U2, find a different model.

FPC breakout board

A flexible printed circuit (FPC) breakout board is required. It should have:

  • 24 pins with 0.1" (2.54mm) pitch
  • One side with 0.5mm pitch FPC connector (for lemp9, lemp10, lemp11, galp5, and galp6)
  • One side with 1.0mm pitch FPC connector (for all other models)

Depending on the vendor, the connectors may not come soldered to the board (or at all). A header block will likely not be provided, so male breakaway headers will need to be purchased separately.

Connecting to the Mega 2560

The FPC board should be assembled so the 1.0mm pitch connector faces up. When connected to the Mega 2560, the FPC connector should face away from the Mega 2560. In this orientation, pin 1 of the FPC connector connects to pin 22 (PA0) of the Mega 2560.

Connecting to the laptop

A 24 pin flexible flat cable (FFC) is used to connect the Mega 2560 to the laptop. It may be worth buying both a set of standard cables (traces exposed on same side at each end) and reversed cables (traces exposed on opposite sides at each end). With both, it will always be possible to have pin 1 of the breakout board go to pin 1 of the keyboard port.

The orientation of the FFC traces can be determined by looking at how the keyboard connects to its port.

The laptop keyboard may use a 26-pin connection. Ensure that the FFC is aligned so the traces line up with pins 1-24 on the keyboard port.

A second cable (typically, USB-C) must be used for grounding the target laptop to the host system (what the Mega 2560 is connected to).

Firmware

mega2560/parallel.c must be modified for the mapping of the keyboard pins to the GPIO pins.

Using the orientation described above, pin 1 of the keyboard maps to

  • pin 22 (PA0) of the Mega 2560 when using the 1.0mm pitch connector
  • pin 45 (PL4) of the Mega 2560 when using the 0.5mm pitch connector

Once the GPIO mapping is updated, the firmware can be compiled and flashed.

make BOARD=arduino/mega2560
make BOARD=arduino/mega2560 flash