.Working With Files

There are two types of file: text and binary.  The interpretation of text files differs between systems to match their internal ways of working with text, with special byte values for characters such as carriage return, line feed and end of file.  Binary files are simply an array of bytes and are always written and […]

Read More

Using the UART

If you are running Raspbian or similar then the UART will be used as a serial console.  Using a suitable cable, such as the TTL-232R-3V3-WE, you can connect it to your PC and using some simple terminal software set to 115200-8-N-1 use the command line interface to the Raspberry Pi in the same way as if you […]

Read More

Using The SPI Interface

Resources https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md https://www.kernel.org/doc/Documentation/spi/spidev Enabling The SPI Port The SPI port needs to be enabled in Rasbian before it can be used. See here. Leave the IO pins used unconfigured (do not set them as inputs or outptus). Using The SPI Port With The BCM2835 library by Mike McCauley This uses the same library as used for the IO […]

Read More

Using the I2C interface

  Enabling The I2C Port The I2C port needs to be enabled in Rasbian before it can be used. See here. Checking For Connected Devices Install the I2C tools (i2c-tools is a set of I²C programs that make it easy to debug I²C devices without having to write any code): sudo apt-get install i2c-tools sudo […]

Read More

BCM2835 SoC

  The Raspberry Pi SoC (System on Chip) is a Broadcom BCM2835. The ARM This contains an ARM1176JZFS (ARM11), with floating point, running at 700Mhz (over clocking to 800MHz is often OK if needed). Software needs to be compiled for ARMv6 to be used with the Raspberry Pi. The GPU Videocore 4 GPU. Capable of BluRay quality playback, using H.264 at 40MBits/s. Fast 3D core accessed using the supplied OpenGL […]

Read More

clock_gettime() For Acurate Timing

Setting up to use clockgettime() Include the following header file: You also need to add the librt library to the linker Using a Geany makefile, add this: Using eclipse: Right click your project > Properties > C/C++ Build > Settings > Cygwin C++ Linker > Libraries.  Add a new library entry: rt Example Which Provides Accurate uS Timing […]

Read More

GPIO interrupts

Good resources http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=7509 http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=9207

Read More

Process Allocation By The OS

Tests Using '2012-09-18-wheezy-raspbian.img' Using this code running: while (1) { bcm2835_gpio_write(RPI_GPIO_P1_13, 0); bcm2835_gpio_write(RPI_GPIO_P1_13, 1); } Running the application at the command prompt (no GUI) gave this on the pin: i.e. no significant process interruptions. Running the application inside the GUI (startx) with nothing else specific happening gave this: Very occasional process interruptions. Now starting the Midori browser […]

Read More