Mastering the Raspberry Pi2 kernel update

As a visitor of many discussion forums about the Raspberry Pi, I recently stumbled upon a lot of cries for help, such as “My RasPi doesn’t boot anymore!” or “Help, my i2c-, spi devices and 1-wire sensors” suddenly disappeared.

Pi2ModB1GB_-compD O N ‘ T   P A N I C!

All of you probably belong to the Raspi lovers, that wan’t  to keep the device’s linux-kernel at a “bleeding-edge” release, doing an “rpi-update” almost every day. Be aware that such a kernel is still tagged as “experimental”, so that it can seriously damage your Raspbian installation. The number of messages is still very high in all discussion forums and a lot of experienced users already became tired in answering the help requests.

To be on the safe site, update your system using “apt-get update && apt-get upgrade” or “apt-get dist-upgrade”, unless you know what you are doing. If your upgrade already has failed, but you’re still able to boot the system, you can roll-back to a previous release with:

sudo rpi-update b2f6c103e5355bee90ff57f55cdf6d7005485a23

The long string represents the Git hash for the specific firmware revision. You can look for those hash in the rpi-update git repos commits list: https://github.com/Hexxeh/rpi-firmware/commits/master.

However, if you want to stay with the latest 3.18 kernel branch, here’s what you can do to solve your problems with i2c, spi, lirc and 1-wire:

Continue reading Mastering the Raspberry Pi2 kernel update

USBasp USB-Programmer Firmware update

I recently purchased a cheap USBasp clone (Made in China), originally developed by Thomas Fischl. It is an USB in-circuit programmer for Atmel AVR controllers. It simply consists of an ATMega88 or ATMega8 and a couple of passive components. The programmer uses a firmware-only USB driver, no special USB controller is needed.

IMG_6998No driver is needed under Linux in order to program Amtel chips. With the Arduino IDE, it is enough to connect +5V, GND, MISO, MOSI, SCK and RESET to the respective pins of the microcontroller. However, after uploading a sketch, avrdude complained about an outdated firmware version:

avrdude: warning: cannot set sck period. please check for usbasp firmware update

So I decided to attempt to update the firmware on the USBasp using one of my Arduino UNO boards as the programmer. There is a lot of confusing information on the web about how to do this, so here is what worked for me:

Continue reading USBasp USB-Programmer Firmware update

How to plot the frequency of PIR sensor events?

With a PIR sensor one can detect movements within it’s field of view and trigger other hardware, such as surveillance cameras. It is also possible to record the frequency of movements over time, e.g. to monitor motion activity in a room of your apartment.

pir_sensorWith a PIR sensor attached to my RasPi, I recorded motion events by storing UNIX timestamps in a single-column MySQL table. I wanted to visuaize these data points as a histogram displaying the frequency of motion events over time, but this task turned out to be more complicated than expected using GNUPlot. So here’s a short tutorial how it works:

Continue reading How to plot the frequency of PIR sensor events?

Unbrick a counterfeit FTDI chip under Linux

I recently purchased a Serial-to-TTL adapter at the Amazon Marketplace for programming of micro-controllers, such as ATMega328P.

41vFeNmOOEL._SS300_The device worked very well until I plugged it into a machine running Windows. It turned out that it contains a counterfeit FTDI chip. The latest FTDI driver bricked the device by setting it’s product ID to “0000”. I understand that FTDI tries to react on faked chips, but I would say that this is quite conniving. I’m a victim of a counterfeit product and I had no chance to recognize a faked chip when I placed my order. FTDI promised to roll back and to stop distributing the malicious driver via Windows Update. However, what shall I do with a bricked device?

Fortunately, there is a method to reset the FTDI chip back to its original VID:PID of 0403:6001:

  • Plug-in the bricked device and check the ID with “lsusb” (if it is bricked, it shows 0403:0000).
  • To re-program the EEPROM, download ft232r_prog from ft232r_prog (v1.24).tar.gz and extract it to a folder. To compile the program, make sure to have libftdi-dev installed on your system.
  • After building the program, run:
sudo ./ft232r_prog --old-pid 0x0000 --new-pid 0x600
  • Now, unplug and re-insert your USB device and run “lsusb” again.  It should show the proper id of 0403:6001. The device should show up again as ttyUSB0.

Raspberry Pi to Banana Pi migration

You might have noticed that my site was down for maintenance on Wednesday, 2014-09-17. For better WordPress performance, I decided to migrate my blog to a brand-new Banana Pi server, featuring a Cortex-A7/ Allwinner A20 Dual-core CPU with Mali-400M2 GPU — that’s cheating — I know 😀.

Let’s go bananas … !

It took me a couple of hours and some tinkering to move my WordPress installation including the MySQL database onto the new server. So here are my first impressions:

Continue reading Raspberry Pi to Banana Pi migration