Page 1 of 3

Flash W25 reading doesn't work

Posted: Fri Jan 28, 2022 2:53 pm
by Osta
Hello I use Atmega128 processor and AT25F4096 memory.
Writing to memory works correctly but reading always returns 1.

Re: Flash W25 reading doesn't work

Posted: Sat Jan 29, 2022 4:15 am
by Osta
Found my mistake, but the question remains...

Re: Flash W25 reading doesn't work

Posted: Mon Jan 31, 2022 3:19 pm
by BenR
Hello,

You might need to erase the block first before you try and program the location. Though 255 would potentially indicate an unprogrammed location.

Re: Flash W25 reading doesn't work

Posted: Thu Feb 03, 2022 11:07 pm
by Osta
Erasing does nothing!
Cleaning up didn't do anything either.
Made a write / read loop and the loop stops.
the program hangs. Recording doesn't work.
Only reading works.

Re: Flash W25 reading doesn't work

Posted: Fri Feb 04, 2022 1:50 pm
by BenR
Hello,

What do you have the WP pin connected to?

Re: Flash W25 reading doesn't work

Posted: Fri Feb 04, 2022 2:28 pm
by Osta
WP connected to VCC

Re: Flash W25 reading doesn't work

Posted: Fri Feb 04, 2022 2:32 pm
by Osta
Everything works in Proteus but not in hardware.
If connected according to the data sheet, the MISO and MOSI pins are reversed

Re: Flash W25 reading doesn't work

Posted: Fri Feb 04, 2022 2:39 pm
by Osta
When connected according to the datasheet, there is not even a read.
And if the pins MOSI and MISO swap places, the chip returns 255. This is the default value.
In the program you can see that I set the value to 0 and the return value to 255. So the reading is done. But the sector is not unlocked and therefore not written.
Respectfully Osta

Re: Flash W25 reading doesn't work

Posted: Fri Feb 04, 2022 2:42 pm
by Osta
Moreover, the program makes one iteration and stops at one of the commands.

Re: Flash W25 reading doesn't work

Posted: Fri Feb 04, 2022 2:51 pm
by Osta
It's in PROTEUS.