guide creating log files - Sevenstax/FreeV2G GitHub Wiki

Guide: Creating log files

In order to provide decent support you need to provide log files of the communication between host controller and Whitebeet and of the V2G communication, as well as the output of the UART port of your Whitebeet. This guide will help you create the necessary log files to make sure you are not missing out any important.

Please read the guide carefully before creating the log files to make sure you are providing all the requested information. If you are creating log files of different sources, please make sure that the log are captured simultaneously. Issues missing decent log files will be closed until the logs are provided by the customer!

If there are any questions or you need support, please feel free to open an issue in the issue tracker by using the Question template!

UART

To create UART logs please your Whitebeet to a PC using an USB-to-UART adapter. The Rx line of the adapter needs to be connected to PAD 76 on the Whitebeet, the Tx line of the adapter needs to be connected to PAD 75. Please also make sure to connect a ground (GND) line as well.

If you are using a Whitebeet carrier board such an adapter is already integrated in the board, you just need to connect an USB type C cable to J11 no the Whitebeet carrier board.

There are different terminal applications that can be used, this is just a random selection:

TeraTerm (Windows)

hTerm (Windows, Linux)

PuTTy (Windos, Linux, macOS)

The used settings are 1000000-8-N-1:

Baudrate data bits parity stop bits
1000000 8 no 1

Please save the log as plain text file.

Ethernet

Before starting the logs make sure you connect your Whitebeet directly to an ethernet interface of you PC, NO routers or switches inbetween.

If you do not have the ethernet port populated on the Whitebeet, please install a external ethernet breakout board to the Whitebeet ethernet port, for example Waveshare LAN 8720.

If you are using Whitebeet carrier board the ethernet port is already accessible by connecting to J15.

Important: Please make sure to enable the port mirror on your Whitebeet prior running your session. This is done by sending a framing message with modID: 0x and subID: 0x and payload: 0x 0x to your Whitebeet. If you are using FreeV2G the port mirror can be enabled by starting Application.py with the -p flag. The port mirror will send the packets send and received on the PLC line to the Whitebeet ethernet port.

We ask for ethernet logs to be in the pcapng format. There are different ways of creating such logs, the guide will present a GUI based and a terminal based way to create the ethernet logs

Important: If you missed populating an Ethernet access on your Whitebeet featured PCB design (what we strongly recommend) you might use a PLC sniffer to capture the Homeplug Green PHY communication on the control pilot line. Such sniffer can be purchased from your Whitebeet Distributor.

GUI (Wireshark)

The most easiest way is to use Wireshark for creating the capture. It runs on Windows, Linux and macOS and can be downloaded here. Please follow the installation guide according to your system.

After installing the application open it. In the first window you need to select the interface you connected your Whitebeet to. Here it is eth-wb-ev as an example.

After double clicking on the interface name the capture process starts immediatly. You will see the captured traffic in the main window. Clicking on a specific packet will selct it and Wireshark will show you detailed information about this packet.

With the help of the three left most symbols in the toolbar you can stop and (re-)start the capturing. If you do not save your current log it will be dismissed when restarting the capture.

To create the log of the communication with Whitebeet start a capture and run your session. Stop the capture by pressing the stop button when your session is done. Press File>Save as... and save the capture file.

Please give the file a strong name, not just log.pcapng or capture.pcapng.

If you want to share different charging sessions please create different log files, big log files lead to longer processing time when applying filters.

GUI (HTerm)

HTerm is a terminal program for serial communication running on Windows and Linux.

  1. Connect the Whitebeet over an USB-C Cable to the pc and and plug power in
  2. open hterm
  3. use the correct Port (Linux: /dev/ttyUSBx, Windows: COMx)
  4. set the baudrate to 1000000
  5. set Newline at to LF
  6. click on connect
  7. Save the Logfile over Save output as .log

Terminal (tcpdump)

If you are using a headless or remote system you can use the tcpdump tool to create pcapng files. This tool works on UNIX like systems (Linux/macOS) and Windows. It can be compiled from source, but is also available in the repository of many Linux distributions.

After installing tcpdump you can start the capture by running the application with elevated rights and passing the name of the interface and file to write the capture to. To get a list of available interfaces you can pass the -D argument:

$ tcpdump -D
1.eno1 [Up, Running, Connected]
2.eth-wb-ev [Up, Running, Connected]
3.eth-wb-evse [Up, Running, Connected]

To capture the traffic on a specific interface you need to pass the -i argument and the interface name. To write the captured traffic to a file you need to pass -w and the file name.

Note: You need priviliged rights to access an interface for capturing network traffic. Please run as root or use sudo on UNIX like system, or start your shell with administrator under Windows.

Example: Create a log on the eth-wb-ev interface and write the output to a file named whitebeet-ioniq5-session-setup-failed.pcapng:

$ sudo tcpdump -i eth-wb-ev -w whitebeet-ioniq5-session-setup-failed.pcapng
tcpdump: listening on eth-wb-ev, link-type EN10MB (Ethernet), snapshot length 262144 bytes

If you are done capturing, just press ctrl+c to stop tcpdump. The output is automatically writen to the file passed with the -w parameter.

Terminal (stty)

stty is a Linux command for changing terminal line settings for the UART bus. To read out the logs, use cat and write them to a log file.

Write the current UART output via /dev/ttyUSB0 to a log file:

sudo stty 1000000 -F /dev/ttyUSB0                        # Set baudrate to 1000000 for ttyUSB0
sudo cat /dev/ttyUSB0  > $(date +\%Y\%m\%d-\%H\%M).log   # created log file with current date and time

to cancel hit ctrl+c.

Note: you must be in the dialout group!

sudo useradd -G dialout <user>

Restart the terminal.

SPI

When using SPI as host controller interface you need to capture the SPI traffic between your host controller and Whitebeet. We are asking for Saleae Logic2 or KingstVIS recordings, although Saleae Logic2 is preferred.

If you do not have a logic analyzer yet, you can find a cheap and Saleae Logic2 compatible analyzer here.

Set up the whitebeet described in the Guide: Quick start, but connect also the ethernet port to your system.

Then connect your logic analyzer in parallel to the Whitebeet.

The following table shows the pin assignment:

Signal Whitebeet Whitebeet Carrier Board Raspberry Pi 4 (name / wPi / BCM) Logic analyzer channel
CLK PAD 24 (PD3) J8 SCK SPI0 SCLK / 14 / 11 0
MOSI PAD 36 (PB15) J8 MOSI SPI0 MOSI / 12 / 10 1
MISO PAD 35 (PB14) J8 MISO SPI0 MISO / 13 / 9 2
NSS PAD 77 (PB9) J8 NSS GPIO.5 / 5 / 24 3
RxReady PAD 37 (PD4) J1 PD4 GPIO.3 / 3 / 22 4
TxPending PAD 38 (PD11) J1 PD11 GPIO.2 / 2 / 27 5
UART RX (optional) PAD 75 RXD (near J11) TxD / 15 / 14 6
UART TX (optional) PAD 76 TXD (near J11) RxD / 16 / 15 7

After installing Saleae Logic2 or KingstVIS name your channels accordingly. Set the samplerate of the logic analyzer to a minimum of twice the maximum SPI clock speed. If you are using FreeV2G the maximum clock speed is 12 MHz.

Logic2 KingstVIS
images/kingstvis-initial-setup.png

Next, add a SPI high level anaylzer:

Logic2 KingstVIS

Start the recording by pressing the green start button.

Logic2 KingstVIS

Run your session and stop the recording by pressing the red stop button.

Logic2 KingstVIS

Press File>Save as... and save the capture file.

Logic2 KingstVIS

Please give the file a strong name, not just log or capture.

Logic2 KingstVIS

If you want to share different charging sessions please create different log files.

⚠️ **GitHub.com Fallback** ⚠️