Shut down my Pi today and thought to make a copy of files in its SD card. This is what
mount /dev/sdf2 /mnt had to say:
mount: wrong fs type, bad option, bad superblock on /dev/sdf2,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Great. After trying
fsck, it became apparent that for some reason, the root partition is marked as being 1 block longer than the physical card. Must be a bug with Raspbian partition expansion or something.
Thankfully, I found this gold nugget which suggested using
resize2fs to fix it. Turns out I had to run e2fsck first (and say “y” a couple of times):
sudo e2fsck /dev/sdf2
sudo resize2fs /dev/sdf2
mount /dev/sdf2 /mnt
Voilá! Fully functioning filesystem again.
The new Raspberry Pi model 2 is out and the Pi world seems more popular than ever. My 2012 benchmark of different RaspPi GPIO access methods has been getting a lot of hits, so I thought to revisit it, and have now updated all the benchmarks with latest versions of firmware and GPIO libraries. I’ve also upgraded my oscilloscope to PicoScope 5444B, so the scope bandwith limitations I had earlier are now gone. :)
Because the benchmark has been linked from many other sites, I’ve just updated the old post to keep links pointing to right places.
Read the updated Raspberry Pi GPIO Speed Benchmark!
Tux logo by Larry Ewing, Simon Budig, Anja Gerwinski
I’ve been a big fan of Picotech’s USB connected PC oscilloscopes ever since I purchased my first PicoScope 2204 almost two years ago. I liked the compact form factor on my desk a lot, and the powerful Picoscope software for Windows – Picotech makes only one version of this software so you get the same functionality with a £159 ($260) 2204 scope as a £5,995 ($9,900) PicoScope 6407 user would – although of course the scope features would be wildly different.
Now Picoscope is a great piece of Windows software and as I generally use Win7 to avoid reboots every time I want to use Photoshop or play a session of Mass Effect, it’s been perfect for me. However, quite a few of electronics enthusiasts are also big advocates of open software movement, and while Picotech has had drivers and SDK for Linux for a while to implement things like my realtime composite decoder, the fact that there is no Linux version of the oscilloscope software has been unfortunate. So when I noticed in the latest Picotech newsletter that there is now a beta of Picoscope for Linux, I knew I had to take it for a spin.
Installing Picoscope on Linux Mint 15
Picotech’s installation process is built on
apt packaging system, so a Debian-based Linux distro is the easiest installation target. This includes the wildly popular Ubuntu and Linux Mint distros, which means mainstream Linux users are well catered to. In Picotech forums, the beta thread had at least one user who extracted necessary stuff from the .deb packages and installed the software for Fedora, too.
In Debian-based Mint, the installation went without any hiccups just by following the instructions at Picotech’s Linux Drivers page. Note that
sudo apt-get install picoscope also installs all drivers so you don’t need to install your model-specific driver separately. Essentially the installation is just:
sudo echo deb http://labs.picotech.com/debian picoscope main >> /etc/apt/sources.list
wget -O - http://labs.picotech.com/debian/dists/picoscope/Release.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install picoscope
Continue reading Picoscope Beta for Linux
Christmas holidays are a wonderful time to invent new projects. I decided I’d do some desktop coding for a change, and try to code an optimized image viewer for my old zipped pocket camera photos. First task of course was to read a zip file.
To my surprise, there wasn’t a “GNU standard library” available for this task like there is zlib for general compression, or libjpeg and libpng for images. Best match for my simple needs seemed to be Minizip, but at 7378 lines of code, and 2125 for just unzip.c (utilizing zlib so basically just file handling), I was not convinced, especially because I knew I had some very specific requirements to cater for (namely uncompressing all JPEGs to memory for fast rendering and thumbnail generation).
Zip File Structure – The Essentials
The ZIP file format turned out to be surprisingly simple, especially since I decided I would be sticking to bare essentials and skipping zip64 support, encryption, multifile zips, and all other compression methods than “store” (no compression) and “deflate” (easily decompressed with zlib, see below). Even with barebones setup, my zip routines would handle about 99.9 % of zips out there just fine.
Drawing on excellent ZIP format documentation from InfoZip’s latest appnote, the file structure I needed to parse seemed to have the following structure:
- Local file header 1
- File data 1
- Data descriptor 1
- Local file header N
- File data N
- Data descriptor N
- … optional decryption / extra stuff …
- Central directory
- … zip64-specific extra stuff …
- End of central directory record
Continue reading Unzip Library for C
The keyboard is something that I use daily, and whether I’m writing e-mails or coding, I’ll likely do several hours of typing a day. Last summer when I switched to US layout in coding and started using Vim, I started thinking that maybe I should upgrade my seven year old Logitech keyboard to something hopefully better. And when I get such a project, I did what I always do: Went totally overkill with research and ended up spending a few hundred euros once I had made up my mind on the “most optimal choice” for me. :)
Update: If you’re interested in this review, you might want to check out my continuation with the Topre Realforce 88UB.
My worldview after 2000 was essentially that laptop type flat keyboards are the way of the future, and keyboard choice mainly depends on whether you buy a Logitech or Microsoft one, and do you get the top of the line model or an OEM version for 15 euros. Enter Geekhack and some interesting discussions at Stack exchange, and it quickly became apparent that there is more to it.
First choice one needs to make is the layout of the keyboard. Kinesis makes some weird looking ones that some people swear by, and there are matrix-type layouts, I decided I would continue to risk carpal tunnel syndrome with a “normal” layout for the time being, as I don’t want to optimize my brain for a keyboard type that would only be available at home.
Continue reading HHKB Professional 2 Keyboard Review
I made a big step in coding geekdom this summer by upgrading the most low-level part of my programming workflow. It started when I got frustrated with Mac keyboard shortcuts on Scandinavian keyboard layout (they Just Don’t Work for most apps), and switched to US layout in coding. Once I made that transition, I started thinking that maybe I could improve my coding speed a bit more, and see what all the fuzz is about Vim.
The greatness of Vim in coding comes from the fact that Vim has separate modes for editing text, and navigating around. While not editing, all normal keys become powerful commands, and you can do text manipulation like duplicating lines, indenting sections etc. without ever leaving this “normal mode”.
Well, Vim is great, but an additional bonus to its power is the fact that almost every *nix system has it preinstalled. So even if I’m not on my own computer, I can just launch an SSH client and use Vim to edit the piece of code I’m working on. No need to compromise. Except color schemes, which I just couldn’t get working over Putty. Today I solved that puzzle after one and half hours of googling, and thought to share the findings, maybe someone will find this the next time they face the problem.
Continue reading Vim Colorschemes with Putty aka. GUI vs. xterm-color256
The WebFaction web server hosting Code and Life (and other my sites) has been experiencing filesystem issues and has been down for fscking several times. Apologies for site readers, hopefully the provider gets these glitches ironed out soon.
I’ve been quite busy the last two weekends, first on a weekend holiday trip to Tallinn, Estonia, and then playing in the Helsinki Casual go tournament which successfully took most of my time last weekend. This has somewhat delayed my continuation to the composite video decoder project.
However, I haven’t been resting on my laurels completely even electronics-wise. My trip to Tallinn had one good by-product, namely new Audiotechnica ATH-M50 headphones. They are a marked improvement over my previous HD-500 Sennheisers, and got me inspired to getting a headphone amp, a tube-based Little Dot mkIII to be more exact. The 32 ohm ATHs don’t necessarily need an amp, but now I’ll at least be prepared if I ever end up getting something like HD-650s.
While researching for a proper USB DAC I came across an amazing audio blog by NwAvGuy. Compared to a lot of “audiophile” coverage he seems to have a solid engineering perspective to audio issues, and he has put an amazing effort to long articles that deal with many issues that surround headphone amp gear.
In addition to great scientific info, NwAvGuy has also designed a USB DAC called ODAC, which I ordered from Head’n’Hifi (they conveniently ship inside EU so no customs). And while I was at it, I couldn’t resist getting a DIY version of NwAvGuy’s O2 headphone amplifier. Read on for my experiences on building it and pitting it against the Little Dot mkIII tube amp.
Continue reading A bit of audio tinkering
In case anyone missed it the first time around, there are codeandlife.com ATtiny2313 breadboard headers still available for donations that exceed $10 ($10.01, $15, etc.) to the blog. If you want one, please send me an e-mail (jokkebk at codeandlife.com) with your postal address after donating, and I’ll ship one of these cuties to you as a small thanks!
All proceeds from the PayPal donations will go towards acquiring new interesting stuff to write about in this blog, so if you like the content, please consider donating!
I have some great news regarding the site. As long time readers probably remember, I’ve done several hacks with my Picoscope 2204 in the past, including a $5 logic analyzer and the latest composite video decoding article. Since I really like their product, I contacted Picotech and asked if they would be interested in working together more closely.
To my delight, the friendly people at Picotech had also noticed the hacks and agreed to sponsor the Code and Life with the extremely capable Picoscope 3206B. In return, I’ve added a “Sponsored by” box to the right which features Picotech and their Picoscope products, and will continue to feature Picoscope-related stuff in the future, and they’ll also have the permission to use those articles on their own. My warmest thanks to Picotech for their donation!
The first concrete result of the new, beefier 200 MHz scope is that I was able to redo many of the measurements in my Raspberry Pi GPIO benchmark. While excellent otherwise, my older Picoscope 2204 with 10 MHz bandwith and 100 MS/s sampling rate was not capable of analyzing the 14-22 MHz waveforms generated by the Pi very accurately, while this was no problem for the 3206B which has 10x the maximum sampling rate: See Benchmarking Raspberry Pi GPIO Speed for details!
Now that I have a scope with more buffer memory, I’m also going to revisit the composite video decoding and see if I can get full resolution, maybe even colors out of my Raspberry Pi composite output using the 3206B. After I get some experience with the new scope, I’ll likely do a review similar to my previous Picoscope 2204 review.