tree: e07e2c795e645e9d9a735f33f4d5a01fc3cc2f80 [path history] [tgz]
  1. images/
  2. README.md
doc/README.md

About

Electric Eel is a battery emulator to enable automated testing on Chromebooks. It uses an external power supply and a switching regulator to provide a specific voltage to the Chromebook. It also presents an SMBus interface so that the Chromebook detects that a supported battery is connected.

Build and program

cd ~/zephyrproject
west build -b electric_eel -s ~/chromiumos/src/platform/electric-eel

The “electric_eel” board target is set up for the Electric Eel hardware, but the pinouts are compatible with the ST Nucleo G0B1RE evaluation board listed in the “Hardware setup” section below.

If using the Nucleo G0B1RE board, refer to the Zephyr Project's documentation at https://docs.zephyrproject.org/3.0.0/boards/arm/nucleo_g0b1re/doc/index.html#flashing for details about flashing.

Use west flash to flash the Nucleo G0B1RE with STM32CubeProgrammer.

Note that the Nucleo G0B1RE board doesn't have the standard 0.050" ARM SWD connector, so using a JLink would involve several jumper wires.

Accessing the serial console

$ pyserial-miniterm /dev/ttyACM0 115200 --raw
--- Miniterm on /dev/ttyACM0  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
*** Booting Zephyr OS build zephyr-v3.1.0-2698-gd5222f318d29  ***
Zappy the electric eel says:
"Hey kids, don't let the red and black wires touch!"


$

BTW, Zappy is the project's mascot.

Hardware setup

The Electric Eel proof of concept uses an ST Nucleo G0B1RE evaluation board, a Microchip MCP401XEV digital potentiometer evaluation board, and an Analog Devices LTM8064 evaluation board. The LTM8064 power regulator uses an external resistor to set the output voltage. By connecting a digital potentiometer in parallel with the feedback resistor, we can control the LTM8064's output voltage.

Refer to documentation from the Zephyr project for the ST Nucleo G0B1RE to see what peripherals are enabled and what the pinouts are.

Connecting the MCP401XEV

All of the STM32G0B1RE's pins are available on the Morpho headers.

  • CN7-16 (3V3)
  • CN5-3 (PB8/SCL)
  • CN5-5 (PB9/SDA)
  • CN5-9 (GND)

Stake pins

Desolder the R8U resistor on the MCP401XEV board.

Connect wires from the Nucleo-G0B1RE to the corresponding pins on the MCP401XEV board.

MCP401XEV connections

To test the connection, use the i2c scan command from the Zephyr shell:

$ i2c scan I2C_1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:             -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 2f
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
1 devices found on I2C_1

Connect an ohmmeter between P2 (B terminal, internally connected to GND) and P7 (W terminal) on the MCP401XEV board.

Issue the command i2c write I2C_1 0x2f 1 0 and the ohmmeter should read close to zero.

Issue the command i2c write I2C_1 0x2f 1 0x7f and the ohmmeter should read close to 10K.

Pick any value between 0 and 0x7f and observe the measured resistance between W and GND.

Connecting the LTM8064

Solder blue wires to both sides of R5 (the feedback resistor) and connect them to a 2-pin header. Use hot glue to secure the header to the board. This header will allow connecting the digital potentiometer in parallel with the feedback resistor.

header for feedback resistor

Connect P2 (B terminal) from the MCP401XEV board to the GND side of R5. Connect P7 (W terminal) from the MCP401XEV board to the high side of R5.

connections between MCP401XEV and LTM8064

Adjusting output voltage

  1. Connect a bench power supply to theLTM8064 input and set to 12V
  2. Connect a voltmeter to the LTM8064 output
  3. Power on the STM32 eval board, and i2c write I2C_1 0x2f 1 0x7f
  4. Enable the bench power supply's output
  5. The voltmeter should read around 7.15V
  6. To get the highest voltage (11.3V), i2c write I2C_1 0x2f 1 0x29
  7. Experiment with various values for the digital potentiometer. Note that with a 12V bench supply input, the output voltage will max out around 11.3V.

Evaluation Board vs. Electric Eel Hardware

As noted, the proof of concept uses a Nucleo evaluation board with a 64-pin LQFP version of the processor (G0B1RE). The schematic for this board is available on ST's website.

The Electric Eel hardware uses the 48-pin QFN version of the processor (G0B1CE) with all of the “important” signals being connected identically:

  • PA2/PA3 - USART (console)
  • PA13/PA14 - SWD
  • PC14/PC15 - 32 KHz xtal
  • PF0/PF1 - 8 MHz xtal
  • PF2 - NRST with push button

PC13 is connected to a push button on the Nucleo board. On Electric Eel, it is connected to BULK_FAULT_ODL to signal a fault from the on-board power supply. The push button won't interfere with an external signal that is connected to the pin headers.

PD8 and PD9 are connected through solder bridges to VCC/GND. These pins aren't present on the G0B1CE processor on Electric Eel.

Most of the microcontroller pins are only connected to pin headers.

Because of how the Electric Eel hardware has been designed, and because the Nucleo board connects most of the processor pins only to the pin headers, we can load code designed for the Electric Eel hardware onto the Nucleo board without damaging the Nucleo board.

USER0 button on evaluation board

The USER0 button is connected to PC13. To read the state of the button, use the GPIO shell commands to configure the button and then read it.

$ gpio conf GPIOC 13 inu
Configuring GPIOC pin 13
$ gpio get GPIOC 13
Reading GPIOC pin 13
Value 1

Now press and hold down the button while reading again:

$ gpio get GPIOC 13
Reading GPIOC pin 13
Value 0

DAC

Connect a voltmeter to pin PA4 (CN7-32 or CN8-3 on the Nucleo board). Initialize the DAC and write values between 0 and 4095, comparing with the value on the voltmeter.

$ dac setup DAC_1 1 12
$ dac write_value DAC_1 1 1024
$ dac write_value DAC_1 1 2048
$ dac write_value DAC_1 1 3072
$ dac write_value DAC_1 1 4095

ADC

Connect a jumper wire (or a 2-pin shunt) between PA4 (CN7-32 on the Nucleo board) and PA1 (CN7-30 on the Nucleo board). Initialize the DAC as shown in the section above, and use the ADC to read the values.

$ dac setup DAC_1 1 12
$ dac write_value DAC_1 1 1024
$ adc ADC_1 channel id 1
$ adc ADC_1 reference INTERNAL
$ adc ADC_1 gain GAIN_1
$ adc ADC_1 resolution 12
$ adc ADC_1 print
ADC_1:
Gain: GAIN_1
Reference: INTERNAL
Acquisition Time: 0
Channel ID: 1
Resolution: 12
$ adc ADC_1 read 1
read: 1010
$ dac write_value DAC_1 1 2048
$ adc ADC_1 read 1
read: 2030