-
-
Notifications
You must be signed in to change notification settings - Fork 79
3.2 Setup Your Pi and Serial Port
The quickest way to setup your pi and the software is to use the genmonmaint.sh script. This page has information on how to download the software and run the script.
The following is an example setup. Please note that there are often several ways to setup things in Linux (gui vs command line, different distributions, etc).
If you are new to using a Raspberry Pi and Linux please refer to other sources for coming up to speed with the environment. Having a base knowledge will go a long way. This site is a great place to start if you are new to these topic.
If you are not familiar with remote login commands for Linux/Unix, two useful commands if you are not using a GUI on your raspberry pi are "ssh" and "scp". These commands allow you to run your Pi without a monitor or user interface. These program allow you to remotely login to your Pi and remotely transfer files to your Pi. This page describes both programs. You can also do a web search on these programs to find other resources on their use. In short you need to have at minimum a basic understanding of using a command line, preferably some experience with Linux and the ability to transfer files to a Raspberry Pi and execute them.
The Raspberry Pi organization has documentation on installing an operating system on your Raspberry Pi. It is located here.
Assemble the Raspberry Pi and all the physical connections as per the schematic
The Raspberry Pi Imager can format an SD card on your computer and load the Rasbperry Pi Operating System. You can get the imager from the main Raspberry Pi Download page. You can use the advanced settings on the Imager application to enable options like SSH (for headless operation), or set the default username and password.
Once the image is on the SD Card, eject the SD card from your PC or Laptop and insert into the PI ensuring that you have and HDMI monitor, usb keyboard and mouse connected to your unit. Power up the PI and let the installer setup the Raspberry Pi software. FYI – this takes a while and wait for the system to load.
Connect network patch cable to the PI unit and setup your timezone, time and date. Click on terminal window >_ and then type the following:
sudo raspi-config.
Select Localization Options.
Select L2 Timezone.
Select your Geographic area.
Select your nearest City.
Select Finish
Type Reboot at the terminal window.
The remaining steps deal with setting up the raspberry pi serial port hardware. The program /OtherApps/serialconfig.py can perform the steps described below. It is documented on this page. You can setup your serial port manually in the steps below, or you can skip to downloading and installing the generator monitor software and then use the serialconfig.py program to setup the serial port.
To enabled the serial port on a Raspberry Pi 5 you can add this line to /boot/config.txt:
dtparam=uart0=on
For earlier version of the pi you can edit the file /boot/config.txt and add the following line at the bottom:
enable_uart=1
With Pre Pi5 versions, may need to disable Bluetooth also, depending on your firmware revision in your Pi. To disable Bluetooth add the following to the bottom of /boot/config.txt:
dtoverlay=disable-bt
and then press ctrl-o to save the /boot/config.txt file, ctrl-x to exit nano.
Leave the terminal window open and confirm the name of the serial port of ttyAMA0 has the alias serial0. Type:
ls -l /dev/serial*
and confirm that /dev/ttyAMA0 has an alias of /dev/serial0. The output should look like this:
lrwxrwxrwx 1 root root 7 Apr 12 01:06 /dev/serial0 -> ttyAMA0
lrwxrwxrwx 1 root root 5 Apr 12 01:06 /dev/serial1 -> ttyS0
If serial0 -> ttyS0 instead of serial0 -> ttyAMA0 then you may have attempted to enable the UART via raspi-config. This may cause interference with the console. The onboard serial port is ttyAMA0 and for compatibility reasons you should typically use the alias. In short, to user the onboard serial port with genmon you must user the alias mapped to ttyAMA0, not ttyS0.
NOTE: Starting with the Raspberry Pi 5 there is a new serial port that is dedicated to the Raspberry Pi system debug port. This debug port uses the device name /dev/ttyAMA10 and has a symbolic link to /dev/serial0. Since the operating system reserves /dev/serial0 for the system debug port starting with the Pi5, on Pi5 and later genmon will use /dev/ttyAMA0 instead of the symbolic link /dev/serial0.
More info on how the pi assigns serial0 vs serial1 can be found here.
Disable the console function of the serial port by typing :
sudo systemctl stop [email protected]
sudo systemctl disable [email protected]
Disable the BlueTooth service that access the serial port (if you have BT on your Pi)
sudo systemctl disable hciuart
Now remove the console from the command line boot file. Type
sudo nano /boot/cmdline.txt
and remove the text “console=serial0,115200. Press ctrl o and write the file
At the terminal window now type
sudo reboot