Introduction
Due to the size of the SPEC7 card and because the RJ45 socket in the board is placed in the top, if the board is deployed in a closed crate is difficult to allow for a setup where you can perform a remote access and update software components via U-Boot.
As a workaround, you can use a 90 degrees microUSB cable to stablish the serial connection via UART and, at the same time, reuse the serial connection to transfer binaries from/to the host computer.
In this page, we provide some instructions on how to do that using minicom
to access the serial port and Kermit
as the protocol to perform serial file transfers.
Install Kermit
As a first step, in addition to installing minicom
, a program that is available in many distros (it's already installed in CERN's Front-end-Computers), we need to install the kermit
program too.
If we are able to install the distributions packages, we can install C-Kermit
, a common Kermit
implementation by just using the package manager:
# In Debian / Ubuntu distributions
sudo apt-get install ckermit
# In RHEL / Fedora derivatives
yum install ckermit
In the case of CERN's FECs, that runs CentOS-8 at the time of testing, we cannot use the package manager. Because of this, we need to build the program from the following CentOS-8 compatible source code for C-Kermit:
Once we have downloaded and uncompressed the source code in a local folder, we can build the program by just using the following command:
make linux
If the build is successful, we will get a program binary named wermit
that will be used to perform the Kermit
protocol.
Configure Kermit
If you have system admin privileges, add the following content to the end of /etc/kermit/kermrc
:
set carrier-watch off
set prefixing all
set parity none
set stop-bits 1
set modem none
set file type bin
set file name lit
set flow-control none
set prompt "Linux Kermit> "
If you don't have admin privileges, you can employ a per-user configuration by adding the contents to .kermrc
file in your $HOME
directory e.g.:
/user/jgarcia/.kermrc
Configure Minicom
We need to use minicom
without super-user privileges, so we must be sure that our user is in the dialout
group:
sudo usermod -aG dialout jdgarcia
Now, we need this content in the minicom
configuration file, i.e. ~/.minirc.dfl
:
pu pname7 YUYNNkermit
pu pname8 NDYNNkermit
pu pprog7 /user/jdgarcia/builds/kermit/wermit -y /user/jdgarcia/.kermrc -i -l %f -b %b -s
pu pprog8 /user/jdgarcia/builds/kermit/wermit -y /user/jdgarcia/.kermrc -i -l %f -b %b -r
pu port /dev/ttyUSB1
pu mhangup
pu updir /user/jdgarcia/uploads
pu baudrate 115200
pu bits 8
pu parity N
pu stopbits 1
pu rtscts No
NOTE: update the wermit
binary path and your local .kermrc
and updir
values.
Upload binaries by using Kermit
Once minicom
and Kermit
are properly configured, we can use the U-Boot loadb
command to upload any file to the specified DDR location.
As an example, in order to load a new gateware to the predefined loadbit_addr
in U-Boot via the serial port using a speed of 115200 bauds, we will start with:
SPEC7> loadb 0x100000 115200
# or
SPEC7> loadb ${loadbit_addr} 115200
Now, we can do Ctrl+A
then Z
to access the Minicom menu, then press "S", scroll down to kermit
and press on
it. We will be presented a browser window to choose any file we want to transfer using Kermit from the uploads folder.
We should see something like:
C-Kermit 9.0.305 OPEN SOURCE: Alpha.02, 19 Sep 2020, Workstation [192.168.0.100]
Current Directory: /user/jdgarcia/uploads
Communication Device: 4
Communication Speed: 115200
Parity: none
RTT/Timeout: 01 / 03
SENDING: => gateware.bit
File Type: BINARY
File Size: 5980025
Percent Done: 18 /////////
...10...20...30...40...50...60...70...80...90..100
Estimated Time Left: 00:14:03
Transfer Rate, CPS: 5770
Window Slots: 1 of 1
Packet Type: D
Packet Count: 251
Packet Length: 9023
Error Count: 0
Last Error:
Last Message:
X to cancel file, Z to cancel group, <CR> to resend last packet,
E to send Error packet, ^C to quit immediately, ^L to refresh screen.
Once finished (it's slow), press Ctrl+C to interrupt the Kermit program if required.
Now, the new gateware file is in DDR and we can perform several actions with it.
We can write the bitstream to a MMC partition, e.g.:
fatwrite mmc 0:1 0x100000 gateware.bit ${filesize}
# or
fatwrite mmc 0:1 ${loadbit_addr} gateware.bit ${filesize}
We can write the bitstream to the QSPI, e.g.:
SPEC7> sf probe 0 0 0
SPEC7> sf erase 0x2000000 0x1000000
SPEC7> sf write ${loadbit_addr} 0x2000000 ${filesize}
We can load it into the FPGA, e.g.:
fpga loadb 0 0x100000 ${filesize}
# or
fpga loadb 0 ${loadbit_addr} ${filesize}