RP2040 Boot Stage 2 Question - Page 1
Forum section: electronics / general

author: Rob Morley
author_rank: Newbie
timestamp: February 20, 2024, 10:02:54 pm
content: I am trying to understand the steps the RP2040 boot stage 2 takes to set up the flash chip in XIP mode. I have read through the RP2040 datasheet (section 2.8.1.3, and Section 4.10) about what boot stage 2 does and looked at the assembly language examples in the Pico-SDK repository. I understand what is being done. Where I run into problems with the setting is when they put the Flash IC into continuous mode after Fast Read Quad IO command for "W25Q" flash devices. In the RP2040 datasheet and the example assembly files it says you can set the mode bits (M7-0) to 0xA0, and the Flash chip goes into continuous mode allowing you to skip the command part of the flash read access. However, I cannot find this in the Winbond W25Q128JV datasheet. The only mention of it is a small note in Figure 24a, saying that M7-0 should be set to 0xFx. I've searched for other documents explaining the mode bits but there is nothing on the Winbond site or in the google searches I've done.Could someone point me to a document or website that explains the mode bits for the "W25Q" flash chips or where the Raspberry PI people got this information.Thanks.

author: ataradov
author_rank: Super Contributor
timestamp: February 20, 2024, 10:46:34 pm
content: Memory datasheets are really bad about documenting this stuff. 0xA0 is a common code for this. So, I guess they just assumed that any reasonable flash will support it.A random memory datasheet that explicitly mentions 0xA0 (0xAx actually) is S25FS512S, for example. But most QSPI flash devices would support it, nobody would want to market incompatible product.

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 21, 2024, 12:55:41 am
content: 0xA0 sets a continuous read mode. I'm unfortunately not completely sure all Flash chips do support it, although I agree that the info omitted in some datasheet is not by itself evidence that said chip doesn't support it, as those datasheets often omit a lot of stuff.I've found this thread on the RPi forum:https://forums.raspberrypi.com/viewtopic.php?t=356424with approx. zero reply.

author: Rob Morley
author_rank: Newbie
timestamp: February 21, 2024, 03:20:43 am
content: I do understand that 0xA0 after the address should put the QSPI flash IC into continuous mode, but how do I confirm that when there no documentation and wasting money on PCBFor example:Boot 2 asm file for W25Q80:https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/boot_stage2/boot2_w25q080.SIn the Boot 2 asm file, lines 57 - 60 explains continuous mode, then implements it on line 229W25Q80DV datasheet:https://www.winbond.com/hq/support/documentation/downloadV2022.jsp?__locale=en&xmlPath=/support/resources/.content/item/DA00-W25Q80DV.html&level=1However, in the data sheet there is no mention of the mode bits, except that should be constant, 0xFF.I can only assume that memory IC vendors think that stuff is standard knowledge to most of its clients that buy millions of these IC's but It makes it dam frustrating when trying to confirm vague claims from third party vendors in their SDK's when you're only buying a handful. I did look on the raspberry pi forum about this issue first but most posts including the one posted here were unanswered, not a good sign. So I came here.QuoteAgain, this comes down to the documentation issue of not documenting a feature or assuming everyone knows about it. Is there a JEDEC type standard for QSPI Flash memory, they all seem to follow the same command values?... A few hours later ...Ok, I found JEDEC standards that relate to xSPI Interface, JEDEC216, and JEDEC251, but no help there. Then ... (Copilot to the rescue)Found this in a Microchip doc :https://onlinedocs.microchip.com/oxy/GUID-C0DEC68F-9589-43E1-B26B-4C3E38933283-en-US-1/GUID-CF766800-7EB7-4611-B926-21177855F899.html#GUID-CF766800-7EB7-4611-B926-21177855F899__ID-00000E88, It shows details about mode bits and what code enter/exit SPI 0-4-4 mode (XIP). Again, it's third-party documentation, but better than nothing.Thanks for your help.

author: ataradov
author_rank: Super Contributor
timestamp: February 21, 2024, 04:01:27 am
content: You will find that this is not the only piece of information missing. This specific W25Q is particularly crap, but other are not much better.I assume Pi people had enough pull to confirm directly with Windbond. I doubt that would reply to random people, so your only real option is to test. You don't really need a PCB, it is an 8-pin IC, easy enough to dead bug.