Raspberry Pi Computer Architecture Essentials
上QQ阅读APP看书,第一时间看更新

Running tests on the OS and configuration changes

There are ranges of hardware tests we can run on the Raspberry Pi to learn more about it. These include checking voltage readings, the temperature of the device, and testing that the GPIO pins work correctly.

You can run these tests by either connecting to the Pi over SSH or loading up the LXTerminal from the desktop.

Diagnostic tests

The following diagnostic tests provide basic information on your Raspberry Pi. This just provides a taster and many more are available. A more comprehensive list of commands is available via the links at the end of this section.

You should, however, run these tests to get a basic idea of what is possible.

The system information of your Raspberry Pi can be run via the following command:

cat /proc/cpuinfo

Version information can be seen via the following command:

cat /proc/version

Memory information can be accessed using the following command:

cat /proc/meminfo

The microSD cards partitions via the following command:

cat /proc/partitions

To check the temperature of the device we can use the vcgencmd command:

vcgencmd measure_temp

We can also use this command with a different parameter to see the voltages. The basic command is as follows:

vcgencmd measure_volts id

In this command, id is one of the following items:

  • core for the core voltage
  • sdram_c for the sdram Core voltage
  • sdram_i for the sdram I/O voltage
  • sdram_p for the sdram PHY voltage

You can find more commands at elinux.org where a guide to vcgencmd can be found (http://elinux.org/RPI_vcgencmd_usage).

Over and underclocking the Raspberry Pi

You may want to tweak the performance of your Raspberry Pi 2. This can be achieved by overclocking the device.

Overclocking is the process of forcing the CPU or other component, for example the GPU, to operate faster than its advertised or OS configured clock frequency. In the process of overclocking it is also possible to change the operating voltage to increase the device's speed.

There is a risk associated with overclocking a device, such as instability of its operation or faster degradation of components.

The raspi-config menu provides a set of screens to guide you through this process.

You can access raspi-config from the command line by typing this command:

sudo raspi-config

Then you select an overclock option from the menu that is presented.

Alternatively, you can modify the boot configuration file directly from inside the terminal window.

You will need to edit the /boot/config.txt file.

Once you have this open you will see a number of commented out values, for example, #arm_freq=800.

In the case of our Raspberry Pi 2 the processor runs at 700MHz. We could uncomment this line and up the speed of the processor to 800MHz.

An in-depth guide to overclocking the Raspberry Pi 2 can be found at Hayden James' website: http://haydenjames.io/raspberry-pi-2-overclock/.

Going further – testing the GPIO pins

For those interested in exploring diagnostic tools further there is the option of downloading the pigpio GPIO pin test. As you start to work more with the pins this test will come in handy for debugging problems, and allow you to check if you have accidentally damaged a pin.

You can download the pigpio library directly to your Raspberry Pi from http://abyz.co.uk/rpi/pigpio/download.html.

An overview and instructions on use can be found at http://abyz.co.uk/rpi/pigpio/index.html.

Example applications and tests can be found at http://abyz.co.uk/rpi/pigpio/examples.html.

For those looking for a digital waveform view for the Raspberry Pi's GPIO pins you can install piscope from http://abyz.co.uk/rpi/pigpio/piscope.html.