Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 12 of 12

Thread: W25Q256 breakout for Teensy 4.1

  1. #1

    W25Q256 breakout for Teensy 4.1

    Hi, guys.

    I want to use a W25Q256 SOIC16 flash ship with the Teensy 4.1 and I thought I could try making a breakout. The idea is similar to the one of this post, but in my case, with the Teensy 4.1 and without using the Audio Board.


    This is the pinout of the IC:
    Click image for larger version. 

Name:	w25q256.PNG 
Views:	39 
Size:	25.1 KB 
ID:	22102


    My idea is to use these pins on the Teensy 4.1:

    Click image for larger version. 

Name:	t4.1.png 
Views:	34 
Size:	498.4 KB 
ID:	22101


    The mapping would be the following:
    Code:
    Pins 1, 2 ,3 and 9 of the W25Q256 go to 3.3V. I have added a decoupling capacitor of 0.1uF.
    Pin 7 of the W25Q256 goes to pin 10 of the Teensy. I have added a 10K pullup resistor.
    Pin 8 of the W25Q256 goes to pin 12 of the Teensy. 
    Pin 10 of the W25Q256 goes to GND.
    Pin 15 of the W25Q256 goes to pin 11 of the Teensy. 
    Pin 16 of the W25Q256 goes to pin 13 of the Teensy.

    Here is the design I have done:

    Click image for larger version. 

Name:	both.PNG 
Views:	50 
Size:	53.8 KB 
ID:	22103

    Click image for larger version. 

Name:	front.PNG 
Views:	35 
Size:	54.2 KB 
ID:	22104

    Click image for larger version. 

Name:	back.PNG 
Views:	31 
Size:	33.0 KB 
ID:	22105

    Click image for larger version. 

Name:	render.PNG 
Views:	31 
Size:	91.7 KB 
ID:	22106

    It is my first design, so I would appreciate any insights or recommendations. Am I missing anything important there?

    Thank you.

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,504
    The W25Q256 is 16MB flash. It supports QSPI. For T_4.1 usage it would make sense to use the QSPI capable pads on the bottom side for much better processor supported Quad SPI performance. It would likely take minimal update to the W25Q128 8 MB Flash already supported that solders directly to that. That would require a second tiny PCB or manual wiring of some sort to bring those signals to the W25Q256 PCB.

    That would keep those pins free and offer much better and faster access.

  3. #3
    Thank you for your response, defragster.

    I think I should have added in my previous post that my intention is to use the flash chip for playing audio files. And AFAIK the Audio library does not support playback from a flash chip through QSPI.

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,504
    Seems it should - QSPI reads from FLASH as 'just a pointer'? Can't confirm - but seems that is the case - others may knwo for sure to say not or point to example ???

  5. #5
    Hi, all.

    I have finally been able to get my breakout board and test it.

    Click image for larger version. 

Name:	20201202_202240.jpg 
Views:	20 
Size:	105.4 KB 
ID:	22716

    Unfortunately it failed the RawHardwareTest of the SerialFlash lib. I ran it several times, always after the EraseEverything sketch, with similar results:


    Code:
    Raw SerialFlash Hardware Test
    
    
    
    Read Chip Identification:
    
      JEDEC ID:     EF 40 19
    
      Part Nummber: W25Q256FV
    
      Memory Size:  33554432 bytes
    
      Block Size:   65536 bytes
    
    
    
    Reading Chip...
    
      Previous data found at address 3026944
    
      You must fully erase the chip before this test
    
      found this: FF FF FF FF 7F FF FF FF 
    
         correct: 00 2E 30 00 CB E9 A6 57 
    
    
    
    Tests Failed  :{
    
    
    
    The flash chip may be left in an improper state.
    
    You might need to power cycle to return to normal.
    Any idea of what the problem could be? a damaged/fake chip?

    Thanks in advance.

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,546
    The sketch identifies the part:
    Code:
    Part Nummber: W25Q256FV
    but I think you need W25Q256JV for it to work.

    Pete

  7. #7
    True. I didn't realized it has an F instead a J, that is what the chip is supposed to be.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,504
    The supported Winbond Flash chips used here are the 8 pin variants

    They are 8MB and 16MB - and just received 64MB are being supported ( 8 pin WSON format ) - at least in the LittleFS work in progress - but I have not soldered one up yet.

    With those 8 pin chips - soldering to the T_4.1 bottom pads as noted would allow the faster QSPI access at higher clock speeds.

    Applicability to "playing audio files" would be an open question ...

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,786
    Quote Originally Posted by JotaEfe13 View Post
    Any idea of what the problem could be? a damaged/fake chip?
    My best guess is SerialFlash is using a 32 bit address with the traditional commands, but this chip defaults to legacy 24 bit addresses on those commands, unless this config bit is written:

    Click image for larger version. 

Name:	sc.jpg 
Views:	17 
Size:	88.7 KB 
ID:	22719

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,786
    These larger Winbond chips (which I did not have available last time I worked on SerialFlash) have a special 32 bit versions of their commands, which work regardless of that config bit setting.

    With that in mind, here's a very quick and dirty hack to try.

    Find this:

    Code:
                    if (f & FLAG_32BIT_ADDR) {
                            SPIPORT.transfer(0x03);
                            SPIPORT.transfer16(addr >> 16);
                            SPIPORT.transfer16(addr);
                    } else {
                            SPIPORT.transfer16(0x0300 | ((addr >> 16) & 255));
                            SPIPORT.transfer16(addr);
                    }
    and change 0x03 to 0x13.

    Then find this:

    Code:
                    if (flags & FLAG_32BIT_ADDR) {
                            SPIPORT.transfer(0x02); // program page command
                            SPIPORT.transfer16(addr >> 16);
                            SPIPORT.transfer16(addr);
                    } else {
                            SPIPORT.transfer16(0x0200 | ((addr >> 16) & 255));
                            SPIPORT.transfer16(addr);
                    }
    and change 0x02 to 0x12.

    Finally, find this:

    Code:
            if (f & FLAG_32BIT_ADDR) {
                    SPIPORT.transfer(0xD8);
                    SPIPORT.transfer16(addr >> 16);
                    SPIPORT.transfer16(addr);
            } else {
                    SPIPORT.transfer16(0xD800 | ((addr >> 16) & 255));
                    SPIPORT.transfer16(addr);
            }
    and change 0xD8 to 0xDC.

    Do those edits make it work?

  11. #11
    Quote Originally Posted by PaulStoffregen View Post
    Do those edits make it work?
    Thank you for the insights Paul. Unfortunately, I have just tried it and did not work.

    Code:
    Raw SerialFlash Hardware Test
    
    
    Read Chip Identification:
    
      JEDEC ID:     EF 40 19
    
      Part Nummber: W25Q256FV
    
      Memory Size:  33554432 bytes
    
      Block Size:   65536 bytes
    
    
    Reading Chip...
    
    
      Previous data found at address 323584
    
      You must fully erase the chip before this test
    
      found this: 7F FF FF FF FF FF FF FF 
    
         correct: 00 04 F0 00 59 81 D3 EF 
    
    
    
    Tests Failed  :{
    
    
    
    The flash chip may be left in an improper state.
    
    You might need to power cycle to return to normal.

    I will try to look deeper into it this weekend, any suggestion about what to look at?



    Quote Originally Posted by defragster View Post
    With those 8 pin chips - soldering to the T_4.1 bottom pads as noted would allow the faster QSPI access at higher clock speeds.

    Applicability to "playing audio files" would be an open question ...
    Yes, in fact I already have a 32MB 8 pin WSON soldered on the bottom, but I am not able to use it to play audio.
    BTW @PaulStoffregen, would it be too complicated for a not-really-advanced user to adapt the Audio lib/SerialFlash lib to adapt it for playing audio with the bottom flash chip of the T4.1? I guess if nobody has done it yet it probably will not be that easy.

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,786
    Quote Originally Posted by JotaEfe13 View Post
    any suggestion about what to look at?
    My only other suggestion, which doesn't come with any specific code, would be to craft the SPI message to program that ADP bit.


    would it be too complicated for a not-really-advanced user to adapt the Audio lib/SerialFlash lib to adapt it for playing audio with the bottom flash chip of the T4.1? I guess if nobody has done it yet it probably will not be that easy.
    Indeed it's not easy. But much of the reason behind the File & FS work that's going into 1.54-beta is to make this possible. I'm planning to look at it "soon". When that comes about, you'll need to use a 1.54-beta if you want to give it a try.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •