/* Step1 we find offset 137 seems to be unused */ (none):/mnt/ramfs/root# ./spi_read 137 A:buff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff: [151(decimal)] /* Step 2 write 7 bytes to offset 137 starting at value=2 */ (none):/mnt/ramfs/root# ./spi_write 137 7 2 /* Step3 verify write */ (none):/mnt/ramfs/root# ./spi_read 137 A:buff:02:03:04:05:06:07:08:ff:ff:ff:ff:ff:ff:ff: [151(decimal)] /* Step 4 One by One restire 8 bytes to 0xff */ (none):/mnt/ramfs/root# ./spi_write 137 1 255 (none):/mnt/ramfs/root# ./spi_write 138 1 255 (none):/mnt/ramfs/root# ./spi_write 139 1 255 (none):/mnt/ramfs/root# ./spi_write 140 1 255 (none):/mnt/ramfs/root# ./spi_write 141 1 255 (none):/mnt/ramfs/root# ./spi_write 142 1 255 (none):/mnt/ramfs/root# ./spi_write 143 1 255 /* Step 5 verify with read */ (none):/mnt/ramfs/root# ./spi_read 137 A:buff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff: [151(decimal)] Note: For block writes it is safer to use smaller numbers such as 7. I found writes were unreliable with counts of 8 and 9 even though the Atmel was receiving the correct byte sequence.