Using the BusPirate V3 with Mac OSX

First install the FTDI drivers from here

Now you can connect to your bus pirate with screen:

press i to view your firmware version

If your firmware < 6.1, you should update your BusPirate to the latest and greatest version:
press $ and acknowledge with yes to get into the bootloader mode, the green mode led should now be burning
press ctrl + a +k to kill the screen window and flash the new firmware with:

unplug and replug your device and recheck your installed firmware.

press ? to show the help menu
press m to change bus mode
press w/W to disable/enable the builtin powersupply
press v to monitor the voltages
press p/P to disable/enable the builtin pullup resistors
enter (0) to show the macros

If you are unsure how to connect to different bus types, you can find a great reference card here.

In the following I will connect an Invensense MPU-9250 IMU I bought on eBay.

The output should look like this:

1. HiZ
2. 1-WIRE
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

Set speed:
1. ~5KHz
2. ~50KHz
3. ~100KHz
4. ~400KHz

Searching I2C address space. Found devices at:
0xD2(0x69 W) 0xD3(0x69 R)

Apparently that means that the sensor is available at address 0xD3 = 1101001+1 for read and at 0xD2 = 1101001+0 for write operations. That is in agreement with the datasheet.

Clear sleep mode bit (6), enable all sensors:
[0xD2 0x6B 0x00]
Read whoami register, should return 0x71:
[0xD2 0x75 [0xD3 r]

For the MPU-9150
[0xD0 0x6B 0x00]
[0xD0 0x75 [0xD1 r]
this should read 0x68

Now we will set up the BusPirate to sniff the i2c communication between a microcontroller and IMU.

This time I just hooked up the sda, scl and ground connection of the BusPirate.
PD0 = SCL = Pin 10 = gelb = BP lila
PD1 = SDA = Pin 9 = orange = BP grau

screen /dev/tty.usbserial* 115200
1. HiZ
2. 1-WIRE
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

Set speed:
1. ~5KHz
2. ~50KHz
3. ~100KHz
4. ~400KHz

Any key to exit

Another great way to analyze the I2C protocol is to use the Open Logic Sniffer on top of BusPirate.

A nice tutorial on how to setup and use the Open Logic Sniffer with the BusPirate can be found here.

Fix Homebrew .gitignore Permission denied

This morning when updating my brew, I was greeted by the following error:

This can be fixed by:

Write NTFS partitions with Mac OSX Mavericks

If just reading NTFS partitions is not enough and you really need to write them, this short HowTo is for you.

First install osxfuse:

Then install ntfs-3g

which might complain:
Error: The brew link step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink sbin/mkfs.ntfs
/usr/local/sbin is not writable.

This can be solved by chowning the directory:

Then backup the old and link in the new mount_ntfs file:

Voila, you should now be able to mount and write NTFS partitions. You may get a warning that the kernel extension is not from an identified developer but that doesn’t matter.

Solve OS X Prohibited Sign Boot Issue

Recently, I used my MacBook Pro to the end of its battery life and closed it shortly before the battery died. Something must have gone wrong there because when charging and awaking it, the touchpad ceased to work and logon didn’t work. Thus I cold rebooted it and was greeted by a nasty prohibited sign.

OS X Prohibited Sign

Unfortunately, Apple’s own recommendations did not solve the issue, so here is my solution:

Boot into the recovery partition by holding cmd+R at startup and open the terminal.

For me this looked like:

start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 409606
916770904 1269536 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
918040440 136
918040576 59064320 3 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
977104896 131
977105027 32 Sec GPT table
977105059 1 Sec GPT header

Apparently the GUID partition table got corrupted at index 1.

To fix this, first unmount the disk:

Remove the corrupt entry:

unmount the disk again:

If the partition was a normal HFS+ partition:

or for an encrypted partition as mine:

Now your partition table should be fixed. In disk utility, unlock your drive if its encrypted. Then repair the volumes and access rights as usual. For me disk utility still complains about a missing EFI Partition, but this is likely due to my refind boot loader.


After this procedure my recovery partition showed up on my desktop, you can hide it again with:

SSH Access with certificates

To easily access all your computers you may want to authenticate yourself with certificates.

On a Mac, first install the missing ssh-copy-id:

Then you can copy your public key to the ssh hosts you frequently need by:

You may get this warning if the host already is in known hosts:
Warning: the RSA host key for 'panda' differs from the key for the IP address ''
Offending key for IP in /Users/tatsch/.ssh/known_hosts:19
Matching host key in /Users/tatsch/.ssh/known_hosts:24
Are you sure you want to continue connecting (yes/no)? yes

If that happens, simply delete the offending lines by

and ctrl + K to delete the whole line

Spoof wifi MAC address on OSX

Install spoof-mac via pip:

Set a random MAC address for wifi interface:

or set to something specific:

The MAC address should be reset to its burnt in value after a restart or you can reset it manually without restart:

Cron Jobs with Mac OSX

Although launchd is the preferred method of scheduling jobs with Mac OSX, the good old cron job is easier to configure and still works:

Press i to go into vim’s insert mode.
Add a shebang if you want to run the jobs with you favorite shell:
enter your cron job e.g.
0 0 * * * brew update && brew upgrade
where 0 0 * * * stands for minute, hour, day, month, weekday
Press esc to exit vim’s insert mode
type ZZ ( in capital letters )
Verify by using

If a cron job fails, you will get a system mail.