I have a device in which there is a SPI flash and a I2C EEPROM, W25Q256JV (32MB) and AT24C1024 (1MB) respectively.


The MCU writes data packets in the flash fifo and saves its read write pointers in eeprom.

Sometimes the data read from flash is bad data = 0x3F instead of valid data.

I am trying to find reasons what is specific about "0x3F"? Where can it come from?

Just in case the read pointer went awry to some unwritten location then I should get "0xFF" instead of "0x3F".

Or possibly that wrong data was written during write operation. In this case where can "0x3F" come from in the MCU? If its some uninitialized array even then it should be "0xFF".

Or is it possible that the data gets corrupt during SPI read or write communication? Is there any chance that "0x3F" comes from some power supply problem during this read or write operations?

This values "0x3F" is consistent and every time whenever I get bad data it is always "0x3F".

I am interested to know at an abstract level what could be the phenomenon of this "0x3F" showing-up in the data?

  • 1
    \$\begingroup\$ That is not enough info to debug this, almost anything could be wrong. Post code and schematics to narrow it down. \$\endgroup\$ – Justme Aug 23 '19 at 4:19
  • 1
    \$\begingroup\$ Is is still 3F after chip erase? Are you sure the write protects are off? \$\endgroup\$ – Jeroen3 Aug 23 '19 at 6:00
  • \$\begingroup\$ @Jeroen3 Chip erase is never used but only pointers are reset. 'Write protects' I don't know what is meat by this? \$\endgroup\$ – alt-rose Aug 23 '19 at 6:10
  • 2
    \$\begingroup\$ You need to add more details. 0x3F is close to 0xFF, which is all ones, active high, unprogrammed cell etc. Could be anything, though the most likely culprit is your microcontroller software. When trouble-shooting SPI, you first of all need to watch /SS, MOSI and clock simultaneously. 2 channel scope with ext. trigger or logic analyser is mandatory equipment. \$\endgroup\$ – Lundin Aug 23 '19 at 6:48
  • \$\begingroup\$ flash corruption during power off or on or reset \$\endgroup\$ – Mitu Raj Aug 27 '19 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.