Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read "0xFF" or "0x00" #9

Open
hosseinghaheri opened this issue Mar 29, 2020 · 14 comments
Open

Read "0xFF" or "0x00" #9

hosseinghaheri opened this issue Mar 29, 2020 · 14 comments

Comments

@hosseinghaheri
Copy link

Hi,
Thank you for this library.
I add this to my project.
My MCU is STM32F103C8T6 and I use SPI2 for connect to W25Q128.

Code:

uint8_t rBuff[256]="";
#define PAGE(_x) _x* 0x100;
#define SEC(_x)  _x* 0x1000;
#define BLK(_x)  _x* 0x10000;
//----------------------------------------------
StartAddress=SEC(7);

W25qxx_EraseSector(StartAddress);
W25qxx_WritePage("0123456789", StartAddress, 0, 10);

sprintf(rBuff,"");
W25qxx_ReadPage(rBuff, StartAddress,0,10);

But I have a problem, After call "W25qxx_ReadPage" function , the all values of "rBuff" elements is "0xFF" or "0x00" (Null).

Thanks!

@nimaltd
Copy link
Owner

nimaltd commented Mar 30, 2020

Please try on address 0
Your address is wrong. See maximum page address in structure after init

@AlexKeisy
Copy link

AlexKeisy commented Mar 30, 2020 via email

@nimaltd
Copy link
Owner

nimaltd commented Mar 30, 2020

uint8_t rBuff[16];
W25qxx_EraseSector(0) // erase page 0~15;
W25qxx_WritePage("0123456789", 0, 0, 10);
W25qxx_ReadPage(rBuff, 0,0,10);

@hosseinghaheri
Copy link
Author

I tried this

uint8_t rBuff[16];
W25qxx_EraseSector(0) // erase page 0~15;
W25qxx_WritePage("0123456789", 0, 0, 10);
W25qxx_ReadPage(rBuff, 0,0,10);

For the first time everything was right, but after Reset MCU , I got "0xff" again.
Results:

w25qxx EraseSector 0 Begin...
w25qxx EraseSector done after 25 ms
w25qxx WritePage:0, Offset:0 ,Writes 0 Bytes, begin...

w25qxx WritePage done after 14 ms
w25qxx ReadPage:0, Offset:0 ,Read 0 Bytes, begin...

w25qxx ReadPage done after 0 ms

Have You correct report from chip on initialization stage?

I Receive this :

w25qxx Init Begin...
w25qxx ID:0x848480
w25qxx Unknown ID
w25qxx EraseBlock 0 Begin...
w25qxx Init Begin...
w25qxx ID:0xFFFFFF
w25qxx Unknown ID
w25qxx EraseBlock 0 Begin...
w25qxx EraseBlock done after 12 ms
+++w25qxx WriteSector:0, Offset:0 ,Write 0 Bytes, begin...
---w25qxx WriteSector Faild!
+++w25qxx ReadSector:0, Offset:0 ,Read 0 Bytes, begin...
---w25qxx ReadSector Faild!

Circuit:
w25q128

@MikhailNatalenko
Copy link

I've faced the same issue with stm32g070x. @hosseinghaheri any updates?

@AlexKeisy
Copy link

AlexKeisy commented Apr 1, 2020 via email

@MikhailNatalenko
Copy link

I already have tried with the lowest speed. I can read ID, and it looks like I can erase the chip. But later I always get 0 from Reading. WP and HOLD are high

@hosseinghaheri
Copy link
Author

hosseinghaheri commented Apr 1, 2020

I set Baud Rate on 9 MBits/s , and the problem was solved.
Sometimes I got "0x00" because of a problem with hardware connections.
Thanks to everyone! 👍

@nimaltd
Copy link
Owner

nimaltd commented Apr 1, 2020

Thanks for your feedback

@MikhailNatalenko
Copy link

MikhailNatalenko commented Apr 1, 2020

In my case, there was a kind of bad wiring/soldering. I resoldered the scheme and now it works like a charm

UPD: it was a power issue -_- VCC was very low - 3.1V instead of 3.3
UPD2: use as short wires as possible. 10cm - ok, 20cm - bad

@nimaltd
Copy link
Owner

nimaltd commented Apr 1, 2020

@MikhailNatalenko 👍👍👍

@AlexKeisy
Copy link

AlexKeisy commented Apr 3, 2020 via email

@namanPuri
Copy link

uint8_t rBuff[16];
W25qxx_EraseSector(0) // erase page 0~15;
W25qxx_WritePage("0123456789", 0, 0, 10);
W25qxx_ReadPage(rBuff, 0,0,10);

I tried this, but always getting 0xFF on read. WP and HOLD are pulled to high through 10K resistor.
Here, are output and schematic:
schematic

output_oxff

@nimaltd
Copy link
Owner

nimaltd commented Jul 11, 2020

@namanPuri change your flash chip and try again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants