I did not add pull up resistors to WP and HOLD but seems to work without it (did not try writing yet).
Just a followup - I found out that I bought W25Q16JVUXIQ where the last Q means it is permanently in Quad SPI mode after reset and this mode cannot be cleared. However normal SPI commands still work in this mode so it is OK, the only difference is that /WP and /HOLD pins are data pins and its classic functionality is disabled which is actually good for me as those pins are floating (in theory it is even possible to wire them from unpopulated pull up resistor pads to some nrf pins to have quad mode working but it is not worth it)
So everything should work as floating WP or HOLD would not interfere with writes however I could not make writes work with software SPI! All other SPI commands worked - getting ids , putting in and out of sleep, reading unique 64bit id, reading all 3 status registers, write enable (0x6) (the WE bit in status register is set), even the writing or erase command (0x2, 0x20) would clear the WE bit in status register but the data did not change. Checked various flash protection bits and everything was disabled as it should be by default according to datasheet but still nothing.
So I built 2MB SPI flash storage area into the firmware by adding
So I enabled hardware SPI in the build and tried that
var sf=SPI1;//new SPI();
var FCS=D19;FCS.write(1);
sf.setup({sck:D12,mosi:D11,miso:D18,baud:80000000,mode:3});
and suddenly everything worked. The very same lines now started to work, I even saw for the first time the busy bit set in status register when erasing
And what is interesting is that since then also the software serial and the builtin espruino flash storage started to work - I could erase again and write different data and it all works now.
So not sure what really happened. Did not try removing battery yet if it breaks again, will try.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Just a followup - I found out that I bought W25Q16JVUXIQ where the last Q means it is permanently in Quad SPI mode after reset and this mode cannot be cleared. However normal SPI commands still work in this mode so it is OK, the only difference is that /WP and /HOLD pins are data pins and its classic functionality is disabled which is actually good for me as those pins are floating (in theory it is even possible to wire them from unpopulated pull up resistor pads to some nrf pins to have quad mode working but it is not worth it)
So everything should work as floating WP or HOLD would not interfere with writes however I could not make writes work with software SPI! All other SPI commands worked - getting ids , putting in and out of sleep, reading unique 64bit id, reading all 3 status registers, write enable (0x6) (the WE bit in status register is set), even the writing or erase command (0x2, 0x20) would clear the WE bit in status register but the data did not change. Checked various flash protection bits and everything was disabled as it should be by default according to datasheet but still nothing.
So I built 2MB SPI flash storage area into the firmware by adding
and the espruino code did not work too
So I enabled hardware SPI in the build and tried that
and suddenly everything worked. The very same lines now started to work, I even saw for the first time the busy bit set in status register when erasing
And what is interesting is that since then also the software serial and the builtin espruino flash storage started to work - I could erase again and write different data and it all works now.
So not sure what really happened. Did not try removing battery yet if it breaks again, will try.