Storage read/write failure after connecting cape

I wrote a small script which should simply switch the state of an output pin around 1000 times from 1 to 0 and back again. When running this script standalone (i.e. no cape attached), everything works. But as soon as I attach a cape (self-created), I get a lot of write-errors in the memory (according to dmesg), when running the script, and the BBB shuts down after a short time. After disconnecting the cape and rebooting everything is fine again. Why? Is the cape doing some damage?

How could anybody answer this without looking at your design?

I thought that there are some common possibilities for such a bug, but I can provide the schematics later, too.