One thing that i often lacked while developing embedded projects is to have a small device which acts as a VT100 compatible terminal emulator to show a debug info on it. It comes especially useful in situations where adding more usb cables, uart converters to your main pc is not possible, difficult or makes the work process uncomfortable.
Hardware:
I had an old RasPi B gathering dust, for which i ordered a 3,95" TFT LCD at elecrow (see the component list for the item ID) a while ago. The seller provides a custom image and a kernel. It will work only on RaspiB/+ and with the supplied Raspian image. The LCD uses an 8bit parallel interface, using up a lot of the IOs, but compared to SPI solutions it offers a much faster update rate. Luckily the UART pins are free to use, after deactivating the console login of course.
Since i have a lot of 9-18V adapters around on my desk, i decided to use a 5V output DC-DC converter module, available from many online sources to power up the RaspberryPi. A Graetz bridge (FWR) is used as a polarity protection, making the input works with both types of DC power jacks (center positive/negative).
A TXS0102 dual channel level translator is used to interface the Pi with the outside world. The output VCC pin is exposed and has to be powered from the target device. The range is 1.65-5.5V DC, which covers most of the uses. The UART port (TX, RX, VCC, GND) is accessible via an IDC6 socket installed on the front side of the enclosure.
I also installed a 4 way USB hub to have the ability to connect a keyboard if i need it.
Software:
Since it is a rather old Raspbian image, probably obsolete, i decided the device will not be connected to the internet. Only at the setup time to install all the required packages.
Do not try to run a system update, it will ruin the system and the display won't work anymore. Again, another reason to keep it out of the internet.
After burning the image onto the SD card a few steps are requires to set up out new emulator:
- Replace the original kernel with the supplied one as it is provided in the display manual.
- Do the usual startup changes, like expanding the partition, keyboard layout settings etc.
sudo raspi-config
- expand filesystem,
- set the desired keyboard layout,
- enable login to console, requiring login,
- disable the console on the serial port ttyAMA0 (Advanced->Serial). - Set up the network, used to install additional software. The image supplied by the online store comes with a static IP set to 192.168.134.something, might be different from what you usually find as default in routers.
sudo nano /etc/network/interfaces
use the settings of your local network.
Since i have mounted the Raspi inside the enclosure without access to the LAN connector, i added
iface eth1 inet static
right under
iface eth0 inet static
this way i can use an external USB-LAN adapter if i need to connect the Raspi to network again.
Reboot:
sudo reboot
- Next, i changed the CLI font type using the following command:
sudo dpkg-reconfigure console-setup
Parameters changed:
Font: Terminus
Font size: 6x12 (framebuffer only)
It will change the default console font:
into: - Connect the RasPi to the internet and Install Minicom, used as a VT100 emulator:
sudo apt-get install minicom
and any other software that may come handy in the future. After that disconnect the Pi from the internet. The system image is quite old, comes with a custom kernel and we are going to enable an auto-login in the next step. It is safer to keep it offline.
- Enable autologin and boot to CLI:
sudo nano /etc/inittab
find a line with the following content:
1:2345:respawn:/sbin/getty --noclear 38400 tty1
and replace it with:
1:2345:respawn:/sbin/getty --autologin pi --noclear 38400 tty1
Reboot. Pi should start and automatically log in the user "pi".
- Add a script to automatically start the Minicom after boot up:
in home directory:
sudo nano start_term.sh
The script looks like this:
#!/bin/bash STRING="Starting minicom...
Well, this is my first visit to your blog! Your blog provided us valuable information .You have done a marvelous job
http://minionrush.online/