Here you will find simple explanations and resources to problems encountered with the Raspberry Pi software and hardware. (Also it helps me to remember!)

martes, 24 de marzo de 2015

Change the swap memory size in Raspeberry

I've been puzzled by a failure in the Rails on Ruby setup inside the Pi. After searching I found this page and it works fine:
Raspbian uses dphys-swapfile, which is a swap-file based solution instead of the "standard" swap-partition based solution. It is much easier to change the size of the swap.

  • The configuration file is:

/etc/dphys-swapfile 
  • The content is very simple. By default my Raspbian has 100MB of swap:
CONF_SWAPSIZE=100
  • If you want to change the size, you need to modify the number and restart dphys-swapfile:
/etc/init.d/dphys-swapfile stop
/etc/init.d/dphys-swapfile start
 

The last step didn't work for me. Instead, I had to restart the Pi.

domingo, 22 de marzo de 2015

Configuring the RPi B+ default serial port

By default Raspbian configures the Raspberry Pi serial port (GPIO14-GPIO15) to provide boot-up information. It also allows you to login via a connected device. If you need to use the Pi’s serial port for something else (i.e. a specific add-on board) you will need to disable this default functionality.

The Broadcom UART appears as /dev/ttyAMA0 under Linux. There are several minor things in the way if you want to have dedicated control of the serial port on a Raspberry Pi. This link describes the process for free the serial port: http://elinux.org/RPi_Serial_Connection. There is a brief script to automate the same steps: https://github.com/lurch/rpi-serial-console.

If you want to test the serial port to send/receive data:
  • First have a look at the permissions on that file, lets assume you are using /dev/ttyAMA0:
ls -l /dev/ttyAMA0
  • You will want read.write access, if this is a shared system then you should consider the security consequences of opening it up for everyone:
chmod o+rw /dev/ttyAMA0
  • You have to setup the baud rate with the next instruction:
 stty 115200 -F /dev/ttyAMA0
  • A very simple crude method to write to the file (send data to the serial port), would use the simple echo command in one terminal:
echo -ne 'ri_07_02' > /dev/ttyAMA0
  • And to read use the minicom command (maybe with another terminal):
minicom -b 115200 -o -D /dev/ttyAMA0