SPI flash. 64 bytes read hangs.

shein
Posts: 5
Joined: Sat Jun 04, 2016 3:46 am

SPI flash. 64 bytes read hangs.

Postby shein » Sat Jul 16, 2016 10:06 pm

Hi,

I use only SPI registers to read/write flash and experience strange problem.
64 bytes write works fine, but 64 bytes read hangs.

There're 16 SPI data registers, each register is 32 bit. (W0-W15)
So, it seems like I should be able to read/write 64 bytes blocks of data.
For writing it is the case. I can write up to 64 byte block at a time. And can verify that operation is successful.
But reading works up to 63 bytes block. If attempt to read 64 bytes block system hangs.

Code: Select all

 
    int i;
    uint32_t buf[16];

    SPI(0).ADDR = TEST_ADDR | (64 << 24);
    SPI(0).CMD = SPI_CMD_READ;

    while (SPI(0).CMD) {};   // operation never ends, loop forever

    for (i = 0; i < 16; i++) {
        buf[i] = SPI(0).W[i];
    }
   


There's a sample project that demonstrates this problem https://github.com/sheinz/esp-spi-flash-test
It doesn't use any SDK libraries.

Thanks.

User avatar
pratik
Posts: 416
Joined: Wed Jun 29, 2016 7:17 pm
Location: India
Contact:

Re: SPI flash. 64 bytes read hangs.

Postby pratik » Sat Jul 16, 2016 11:20 pm

Hello,

Does the reading fail if you try to power up and just perform a read operation?
See if inserting a small delay after the write operation helps resolve this error.

Also, how do you know where the code is getting stuck? Posting the UART log will help as well. Things getting stuck should usually cause a WDT reset.
Regards,
Pratik Panda
Website: http://www.PratikPanda.com

Custom firmware, Knowledge base and freelancing (ESP8266/ESP32):
http://www.iot-bits.com

shein
Posts: 5
Joined: Sat Jun 04, 2016 3:46 am

Re: SPI flash. 64 bytes read hangs.

Postby shein » Sun Jul 17, 2016 4:27 pm

Hi Pratik,

The reading of 64 bytes block fails in every possible way. I tried it without writing with the same result.
And yes, I used serial output to pin point the place that hangs.

Originally I stumbled upon this issue when I was developing inside an SDK, and my module immediately resets after hang due to WDT.
But without any SDK, I assume WDT is not initialised and the chip simply hangs.

User avatar
pratik
Posts: 416
Joined: Wed Jun 29, 2016 7:17 pm
Location: India
Contact:

Re: SPI flash. 64 bytes read hangs.

Postby pratik » Mon Jul 18, 2016 12:31 pm

So you faced the same issue with the SDK as well? Which SDK version were you using?
Regards,
Pratik Panda
Website: http://www.PratikPanda.com

Custom firmware, Knowledge base and freelancing (ESP8266/ESP32):
http://www.iot-bits.com

shein
Posts: 5
Joined: Sat Jun 04, 2016 3:46 am

Re: SPI flash. 64 bytes read hangs.

Postby shein » Mon Jul 18, 2016 3:19 pm

pratik wrote:So you faced the same issue with the SDK as well? Which SDK version were you using?

I use esp-open-rtos, it's based on the last RTOS SDK that was MIT licensed.
But I specifically created stripped example to show that the problem is not SDK dependent.

User avatar
pratik
Posts: 416
Joined: Wed Jun 29, 2016 7:17 pm
Location: India
Contact:

Re: SPI flash. 64 bytes read hangs.

Postby pratik » Mon Jul 18, 2016 7:22 pm

Hello,

I will forward the issue to engineers.
Meanwhile, let me know which flash chip you are using (part number).
What is your test address? Is it properly boundary-aligned?
Regards,
Pratik Panda
Website: http://www.PratikPanda.com

Custom firmware, Knowledge base and freelancing (ESP8266/ESP32):
http://www.iot-bits.com

shein
Posts: 5
Joined: Sat Jun 04, 2016 3:46 am

Re: SPI flash. 64 bytes read hangs.

Postby shein » Tue Jul 19, 2016 4:31 pm

Hello Pratik,

pratik wrote:Hello,

I will forward the issue to engineers.
Meanwhile, let me know which flash chip you are using (part number).


I'm not sure what flash chip part number. I use ESP-12E module from AI-Thinker.

Code: Select all

> esptool.py flash_id
Connecting...
Manufacturer: e0
Device: 4016

The Internet says BergMicro 25q32A is used as a flash memory chip in ESP-12E.

pratik wrote:What is your test address? Is it properly boundary-aligned?


My test address is 0x200000.
I can read and write from/to it just fine.
I don't think boundary-alignment is necessary for reading. For writing the page boundary should not be crossed but for reading it is irrelevant as far as I understand.

Best regards

Who is online

Users browsing this forum: No registered users and 1 guest