element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Probing the RP2040 QSPI Flash Interface
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 24 replies
  • Subscribers 661 subscribers
  • Views 10486 views
  • Users 0 members are here
Related

Probing the RP2040 QSPI Flash Interface

scottiebabe
scottiebabe over 2 years ago

As you know SD Cards are bigger Divas than me! With latencies of up to several hundreds of milliseconds and the complexity of a file they can be trying to deal with at times. Not to mention, I don’t usually need gigabytes of storage.

Today there are so many memory chips with a simple SPI interface available. You can get several megabytes of flash/f-ram/psram in an 8-pin package for a dollar or two.

So, I am just trying to learn more about these QSPI memory chips.

I guess the best place to start is by probing known working designs, like the many RP2040 development boards like the RPI Pico or Adafruit’s RP2040 feather.

When the RP2040 comes out of reset it begins execution of its internal bootrom code:

https://github.com/raspberrypi/pico-bootrom/blob/master/bootrom/bootrom_main.c

Where it tries to initialize an SPI memory IC over its SSI interface. It does this by trying to read the first 256 bytes with different CPOL CPHA combinations and looking for a valid second stage bootloader image.

image
image

The last 4 bytes of the 256 byte page are a checksum that the Rp2040 uses to validate that a second stage boot image was found.

image

The RP2040 starts executing the loaded second stage bootloader image and eventually gets ready to start running of external flash.

image

Just before switching over from the 1-bit xx25 interface to QuadSPI the firmware reads status register 2:

image

To switch over to using “Quad I/O Fast Read with Continuous Read Mode” The 0xEB command is sent:

image

With command bits M5-4 = (1,0) subsequent flash reads can omit the command portion:

image

The unfortunate part for me is, I don’t have a QSPI protocol decoder (though it appears neither does a $20,000 oscilloscope *shakes head*). Using a clocked parallel bus decoder gets me close enough I suppose:

image
image

It isn’t too difficult to follow along:

image

For some reason micropython compiled for an Adafruit feather never switches over to QSPI, So in that case I get a nice tabular report using a SPI memory protocol decoder:

image

It is looking quite likely I might be able to boot an RP2040 off an 8MB PSRAM chip in 1-bit SPI mode.

I don’t know enough yet to know how common the QuadIO mode commands and wait cycle counts are between chips.

Thanks for reading Slight smile

Onwards and upwards!

  • Sign in to reply
  • Cancel
Parents
  • michaelkellett
    michaelkellett over 2 years ago

    Hello,

    Interesting !

    Following your post about them I've ordered 100 of the 8Mbyte quad spi RAMs. !

    Picking up on your comment re. logic analysers on scopes or else where.

    You need one of these:

    image

    www.zeroplus.com.tw/.../products.php

    http://www.zeroplus.com.tw/logic-analyzer_en/products.php?pdn=10&pdnex=12

    They have a QSPI decoder - haven't used it yet.

    I used to use a scope (LeCroy Zi6) based logic analyser but I'me given up on the scope based ones for most things and taken to using the 32 channel Zero plus.

    You get a much better logic analyser, with better software and 130 decoders in the price. The 32064M which I have costs about £1400, not  alot more than the probes for a Tek or Keysight scope.

    The 15 channel one is a lot cheaper at about £900.

    (The picture is a current project, an Intel MAx 10 FPGA doing something with signals from shaft encoders. The boards are a Sparkfun ATP MicroMod  carrier board with an Alorium SnoM2 MicroMod on it. These parts were chosen for development as the only way we could get MAX10s to paly with in a hurry. We don't use any of the Alorium software or FPGA code stuff.)

    MK

    • Cancel
    • Vote Up +8 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • michaelkellett
    michaelkellett over 2 years ago

    Hello,

    Interesting !

    Following your post about them I've ordered 100 of the 8Mbyte quad spi RAMs. !

    Picking up on your comment re. logic analysers on scopes or else where.

    You need one of these:

    image

    www.zeroplus.com.tw/.../products.php

    http://www.zeroplus.com.tw/logic-analyzer_en/products.php?pdn=10&pdnex=12

    They have a QSPI decoder - haven't used it yet.

    I used to use a scope (LeCroy Zi6) based logic analyser but I'me given up on the scope based ones for most things and taken to using the 32 channel Zero plus.

    You get a much better logic analyser, with better software and 130 decoders in the price. The 32064M which I have costs about £1400, not  alot more than the probes for a Tek or Keysight scope.

    The 15 channel one is a lot cheaper at about £900.

    (The picture is a current project, an Intel MAx 10 FPGA doing something with signals from shaft encoders. The boards are a Sparkfun ATP MicroMod  carrier board with an Alorium SnoM2 MicroMod on it. These parts were chosen for development as the only way we could get MAX10s to paly with in a hurry. We don't use any of the Alorium software or FPGA code stuff.)

    MK

    • Cancel
    • Vote Up +8 Vote Down
    • Sign in to reply
    • Cancel
Children
  • scottiebabe
    scottiebabe over 2 years ago in reply to michaelkellett

    Ooh that is extra fancy!!!

    I'm not sure I am against having my scope sample the signal, but I agree with you I much preferer  examining/analyzing digital data on my PC!

    I tried downloading the zeroplus software to see if I could import a csv file, but no luck! O well can't blame them for making one purchase the product to use their software. 

    I also noticed they have a glitch filter included. Neither digilent or opensource pulse view do that for you. My protocol decoders were quite upset see the chipselct line toggle mid transaction... But it happens with fast edges and big long hookup leads. I added a zerophase lowpass filter in matlab to deglitch the signals from crosstalk.

    I love the reset button in the machinist vice! Classy! 

    I am amazed you were even able to buy an FPGA at all, looks like a really neat project Slight smile

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw over 2 years ago in reply to michaelkellett

    I use a lot of vises, but I obviously don't have enough of that type - they look very handy.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 2 years ago in reply to scottiebabe

    If you are looking for small cheap and avaialble FPGAs right now then your best bet is Efinix.

    You need to fork out £65 for a dev board to get a software license but once you have done that Digikey have tens of K parts in stock:

    eg Trion 8 (8k LUT in TQFP144), 54057 parts in stock or Trion 20 (20k LUT in TQFP144), 20700 parts in stock at £13.20 each (1 off price)

    I'm working on a test board with a T20 and two of the PSRAM chips and a few other bits. (Because I need to have one on a board of my own and working before I can really recomend to paying customers that they design it in to a product.)

    MK

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 2 years ago in reply to dougw

    I bought these (two small and one large) half price quite recently from my usual metalwork tool supplier. I wasn't sure if they would be useful but they are so nice to use that I think I might even buy some more !

    I'll wait until they next have them on offer.

    MK

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe over 2 years ago in reply to dougw

    They are a little too pricey for me:

    image

    But, they look wonderful!

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 2 years ago in reply to scottiebabe

    There are very low-cost aluminium versions, not precise : ) but good for holding boards or components. They are really handy, I like using this style of vise too. Quite a lot more lightweight, so it isn't as good for building up a slightly more rugged test scenario as the proper tool vises however.

    image

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw over 2 years ago in reply to scottiebabe

    Me too. I just ordered a plastic one and cheap aluminum one to tide me over until a decent sale comes along.

    image

    image

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe over 2 years ago in reply to dougw

    Those rubber bumpers look really handy too! I found one that comes with a set of drill bits too

    image

    Thanks for the tip!

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • scottiebabe
    scottiebabe over 2 years ago in reply to shabaz

    With a quick release! I suppose you can't have too many of these things! Thanks for the recommendation Slight smile

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube