A micro SD (sandisk 1GB) running in SPI mode, under linux, is (re)programmed by writing a 2MB image with dd and then the system is rebooted. Typically the sequence is:
dd if=firmware.bin of=/dev/sda1 sync ; sync; sync reboot
The anomaly is that every so often after reboot the microSD appears to be locked into some mode where I can only read my binary image correctly, in /dev/sda1, by increase the time between initiating commands ( the delay was obtained by dumping response bytes from the SPI to the UART ). Note that I'm already writing additional 0xff to the SPI in order to generate extra clock cycles in the microSD.
Note that the content in the micro SD appears correct. I can read correct content with a USB card reader.
Any help is appreciated.