The way the game works is that you first write to the scratchpad. Then if you like, you can read the scratchpad and make sure that what you think you wrote is actually there. Then you command the chip to copy the scratchpad to memory.
There are some fine points. The first is that you work one 32 byte page at a time. You can write a partial page, but for my tests, I use an offset of 0 and write all 32 bytes.
The second is that when you write to the scratchpad, you give a full 9 bit offset (which requires 2 bytes). The offset within the page only requires 5 bits. The upper 4 bits indicate which page this will ultimately go into. Apparently the write to scratchpad command "saves" these 4 bits for the copy to scratchpad which should follow later.
Given this understanding, I was able to write working code. I gave the offset as 0x20 (page 1, offset 0) and wrote 32 bytes. It seemed to work, but the final test was to turn power off and back on again and see if the data was retained. It was.
Tom's software pages / tom@mmto.org