Use flash S25FL064L

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
hamtam
Active Member
Posts: 34
Joined: Wed Jun 28, 2017 7:37 am

Use flash S25FL064L

Post by hamtam »

I try to use the S25FL064L Flash.
Datasheet for s25FL064

I created a description file "S25FL064L":

Code: Select all

99,                     /* 1.  S25FL064L libflash device ID*/
256,                    /* 2.  Page size */
32768,                  /* 3.  Number of pages 64MBit / 8 = 8 MByte / 4 / 256 = 32768 */
3,                      /* 4.  Address size Datasheet page 119*/
3,                      /* 5.  Clock divider */
0x9F,                   /* 6.  RDID cmd */
0,                      /* 7.  RDID dummy bytes */
3,                      /* 8.  RDID data size in bytes / id size in bytes */
0x016017,               /* 9.  RDID manufacturer ID 0x016017 Datasheet page 121*/
0x20,                   /* 10. QSPI_SE Datasheet page 90*/
4096,                   /* 11. Sector erase is always 4KB */
0x06,                   /* 12. WREN cmd Datasheet page 69*/
0x04,                   /* 13. WRDI cmd Datasheet page 64 */
PROT_TYPE_NONE,         /* 14. no protection */
{{0,0},{0x00,0x00}},    /* 15. SR protect and unprotect cmds */
0x02,                   /* 16. Page Program (PP) cmd for 3 byte address Datasheet page 88 */
0xEB,                   /* 17. Quad I/O Read  QSPI_READ_FAST READ cmd, Datasheet page 84*/
1,                      /* 18. READ dummy bytes*/
SECTOR_LAYOUT_REGULAR,  /* 19. Sector layout */
{4096,{0,{0}}},         /* 20. Sector sizes */
0x05,                   /* 21. Read Status Register 1 (RDSR1 05h) RDSR cmd Datasheet page 66 */
0x01,                   /* 22. Write Registers (WRR 01h) WRSR cmd */
0x01,                   /* 23. WIP bit mask */
I tried to flash with:
xflash conet_8ch.xe --boot-partition-size 0x80000 --quad-spi-clock 15.62MHz --spi-spec S25FL064L

The output I got was:
Warning: F03098 Factory image and boot loader cannot be write-protected on flash device on node 0
xflash: Warning: F03149 QE_REGISTER and/or QE_BIT locations not found in XN file for this flash device. Using default quad_spi_qe_location_status_reg_0 and quad_spi_qe_bit_6.
Site Verify failed for page 0x00000000, offset 0x0000 (read 0x00, expected 0x7d).
Verify failed for page 0x00000000, offset 0x0001 (read 0x00, expected 0x30).
Verify failed for page 0x00000000, offset 0x0002 (read 0x7d, expected 0x00).
Verify failed for page 0x00000000, offset 0x0003 (read 0x30, expected 0x00).
Verify failed for page 0x00000000, offset 0x0004 (read 0x00, expected 0xf3).
...
Verify failed for page 0x00000000, offset 0x00fe (read 0xb7, expected 0xd1).
Verify failed for page 0x00000000, offset 0x00ff (read 0x70, expected 0xb7).
0 write 0x00000000. Error: F03013 Failed to run : 0x7fff126a9600.


ffomich
Experienced Member
Posts: 119
Joined: Mon Sep 15, 2014 1:32 pm

Post by ffomich »

mditsler
New User
Posts: 3
Joined: Sun Nov 05, 2017 4:05 am

Post by mditsler »

I would add the QE_REGISTER & QE_BIT definitions to your XN file. That will eliminate the warning message about them. However, it looks like xflash made the correct assumptions about their settings, so I don't think just adding them to your XN file will fix your issue.

Did you notice that the values read back during the verify appear to be two bytes behind what was expected? I suggest that you try changing parameter #18 (READ dummy bytes) in your specification file to 3.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Also, use the xflash command with the --verbose flag to better understand what the tool is doing and to offer more details as to why it is failing.
jallard
Member
Posts: 11
Joined: Thu Apr 07, 2016 8:10 pm

Post by jallard »

Is there a list of flash devices that are supposed to work with the xCore-200?

I'm trying to use a Winbond W25Q16JV, with no luck. I see the same problem as listed in this thread: verify errors.

I've followed the procedure of specifying a new flash specification file, using the xflash --spi-spec option, and adding the QE attributes in the xn file.

It would be nice to know if this part is compatible and I'm just doing something wrong or if the register setup is different enough that it's not compatible.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Guessing something was missed in the new flash definition. Post all of the relevant files for a review.

Are you using this new flash on an XMOS XCORE-200 board for initial testing or on a custom board? For a sanity check, best to apply this new flash onto a XMOS devkit so we can rule out any custom hardware issues.

Are you using the --verbose flag? What does this reveal?

In practice, yes, it should be very possible to insert a QSPI capable flash device and have it supported using xflash tool chain. Post your results and let us see if it can be debugged. This is important to receive your feedback. Far too many "users" in this forum are quick to not post their results as suspecting it then working but that does not supply closure for the next reader. We do not work for XMOS nor compensated in any way by them. Our time is not free but do not mind sharing the help, when we can. In return, common courtesy is to post at least the results, either way. Even a simple thanks would go a long ways.
jallard
Member
Posts: 11
Joined: Thu Apr 07, 2016 8:10 pm

Post by jallard »

I'm attempting to use Winbond W25Q16JV quad flash on the xCORE-200 multimedia dev board.

Here's my device definition file:

Code: Select all

    
    26,                     /* libflash device id */ 
    256,                    /* page size */ 
    8192,                   /* num pages */ 
    3,                      /* address size */ 
    8,                      /* log2 clock divider */ 
    0x9f,                   /* SPI_RDID */ 
    0,                      /* id dummy bytes */ 
    3,                      /* id size in bytes */ 
    0xef4015,               /* device id */ 
    0x20,                   /* SPI_SSE */ 
    0,                      /* full sector erase */ 
    0x06,                   /* SPI_WREN */ 
    0x04,                   /* SPI_WRDI */ 
    PROT_TYPE_SR,           /* protection through status reg */ 
    {{0x1c,0x00},{0,0}},    /* SR protect and unprotect cmds */ 
    0x02,                   /* SPI_PP */ 
    0x0b,                   /* SPI_READFAST */ 
    1,                      /* 1 read dummy byte */ 
    SECTOR_LAYOUT_REGULAR,  /* sane sectors */ 
    {4096,{0,{0}}},         /* regular sector size */ 
    0x05,                   /* SPI_RDSR */ 
    0x01,                   /* SPI_WRSR */ 
    0x01,                   /* SPI_WIP_BIT_MASK */
     
Here's the .xn file modification:

Code: Select all

  
  <ExternalDevices>
    <Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="WINBOND_W25X16">
      <Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
      <Attribute Name="PORT_SQI_SCLK"   Value="PORT_SQI_SCLK"/>
      <Attribute Name="PORT_SQI_SIO"  Value="PORT_SQI_SIO"/>
      <Attribute Name="QE_REGISTER" Value="quad_spi_qe_location_status_reg_1"/>
      <Attribute Name="QE_BIT" Value="quad_spi_qe_bit_1"/>
    </Device>
  </ExternalDevices>
  
And here's the output of the xflash command:

xflash --boot-partition-size 0x40000 --verbose --spi-spec WINBOND_W25X16 --loader loader.o --factory app.xe

Code: Select all

XFlash_Options::ListDevices : xgdb --batch -q --ex "listdevices" devl-1234124b
XFlash_Application found _start :40000 on Node 0
XFlash_Application found _DoSyscall :439fc on Node 0
XFlash_Application found _DoException :42e94 on Node 0
XFlash_Application found _start :40000 on Node 0
XFlash_Application found _DoSyscall :45904 on Node 0
XFlash_Application found _DoException :44d68 on Node 0
XFlash_Application : Attempting to Compress Binary Data
libcompressor marker 1=187
libcompressor marker 2=246
libcompressor marker 3=83
libcompressor best marker length 3 2 2
libcompressor best marker length 3 2 3
libcompressor best marker length 3 2 4
libcompressor best marker length 3 2 5
libcompressor best marker length 4 2 5
libcompressor DoCompression_Compress took : 390ms
libcompressor compile command=xcc -nostartfiles -Xmapper --bootstyle=forsim -x assembler-with-cpp "decompressor-54893827" -x xn "target-xn-v0-10862654
" -o decompressor-cdb5e8be
libcompressor validating decompressor decompressor-cdb5e8be
libcompressor launching simulator decompressor-cdb5e8be --disable-syscalls --max-cycles 100000000
libcompressor simulator starting @0x40000
libcompressor simulator terminate @0x7ff5a
libcompressor decompressor validated
XFlash_Application on Node : 0 compressed from : 20384 bytes to : 13156 bytes (35.46%)
libcompressor marker 1=187
libcompressor marker 2=218
libcompressor marker 3=222
libcompressor best marker length 3 2 2
libcompressor best marker length 3 2 3
libcompressor best marker length 3 2 4
libcompressor best marker length 4 2 4
libcompressor DoCompression_Compress took : 1130ms
libcompressor compile command=xcc -nostartfiles -Xmapper --bootstyle=forsim -x assembler-with-cpp "decompressor-1bd06657" -x xn "target-xn-v0-10862654
" -o decompressor-72c14fe3
libcompressor validating decompressor decompressor-72c14fe3
libcompressor launching simulator decompressor-72c14fe3 --disable-syscalls --max-cycles 100000000
libcompressor simulator starting @0x40000
libcompressor simulator terminate @0x7ff58
libcompressor decompressor validated
XFlash_Application on Node : 0 compressed from : 30740 bytes to : 21112 bytes (31.32%)
XFlash::DoXFlash
XFlash::DoImageProgramming
XFlash::GetDeviceInfo
XFlash_DeviceInfo::GetDeviceInfo_Hardware
XFlash_DeviceInfo::GetDeviceInfo_Hardware_IssueCompileCommand : xcc -Xmapper --dontenablesodlinks -Xmapper --wnoXN -x xc "spiinfo-f65af5bb" -x xn "tar
get-xn-v0-10862654" -o "spiinfo-b93177ac" -lquadflash -D xnPORT_SQI_CS0=PORT_SQI_CS -D xnPORT_SQI_SCLK0=PORT_SQI_SCLK -D xnPORT_SQI_SIO0=PORT_SQI_SIO

XFlash_Utils::BuildRunCommand : xrun --io spiinfo-b93177ac
Warning: F03098 Factory image and boot loader cannot be write-protected on flash device on node 0
XFlash::BuildFlashBinaryFile
XFlash_Builder_S2L::BuildStage2Loaders Factory
Stage2_Loader::Compile : xcc -Wno-bidirectional-buffered-port -Xmapper --dontenablesodlinks -Xmapper --nochaninit -Xmapper --noinitialtidy -Xmapper --
image-base -Xmapper 0x40080 -Xmapper --image-size -Xmapper 0x3ff80 -Xmapper --wno110 -Xmapper --wno226 -Xmapper --wnoXN -std=c99 -O2 -x xn "target-xn-
v0-10862654" -x xc s2l-n0-30ec200c -lstage2loader -lswitchsetup -lsqiaccess -x none loader.o -lxcc -o s2l-n0-c13d7405
Stage2Loader found _DoSyscall : 0x40558 on Node 0
Stage2Loader found _DoException : 0x403c8 on Node 0
Stage2_Loader : Attempting to Compress Binary Data
libcompressor marker 1=37
libcompressor marker 2=38
libcompressor marker 3=42
libcompressor best marker length 3 2 2
libcompressor best marker length 3 2 3
libcompressor best marker length 3 2 4
libcompressor best marker length 3 2 5
libcompressor best marker length 4 2 4
libcompressor best marker length 4 2 5
libcompressor DoCompression_Compress took : 110ms
libcompressor compile command=xcc -nostartfiles -Xmapper --bootstyle=forsim -x assembler-with-cpp "decompressor-a58d5298" -x xn "target-xn-v0-10862654
" -o decompressor-884cea36
libcompressor validating decompressor decompressor-884cea36
libcompressor launching simulator decompressor-884cea36 --disable-syscalls --max-cycles 100000000
libcompressor simulator starting @0x40000
libcompressor simulator terminate @0x7feda
libcompressor decompressor validated
Stage2_Loader on Node : 0 compressed from : 3620 bytes to : 2788 bytes (22.98%)
Stage2_SwitchSetup::Compile : xcc -c -march=xs2a -x assembler-with-cpp swstup-n0v0-ca4b4a30 -o swstup-n0v0-8881eb1f
Stage2_SwitchSetup::Compile : xcc -nostartfiles -Wno-bidirectional-buffered-port -Xmapper --first -Xmapper swstup-n0v0-8881eb1f -Xmapper --dontenables
odlinks -Xmapper --nochaninit -Xmapper --noinitialtidy -Xmapper --wno110 -Xmapper --wno226 -Xmapper --wnoXN -std=c99 -O2 -x xn "target-xn-v0-10862654"
 -x xc swstup-n0v0-ace4c4da -lswitchsetup -o swstup-n0v0-3c525896
XFlash_Builder_Image::BuildImages Factory
XFlash_Builder_Image::BuildImageTable
  master node = 0
    node = 0
XFlash_Builder_Image::BuildImageTable num cores for image table = 2
XFlash_Builder_Image::CalculateBufferSize Starting calculation _total_image_size=0
XFlash_Builder_Image::CalculateBufferSize Add Image Header _total_image_size=34
XFlash_Builder_Image::CalculateBufferSize Add Switch Setup header _total_image_size=3c
XFlash_Builder_Image::CalculateBufferSize Add Per Core header _total_image_size=54
XFlash_Builder_Image::CalculateBufferSize_SwitchSetup _total_image_size=78c
XFlash_Builder_Image::CalculateBufferSize_Application application size = 3368 _total_image_size = 3af4
XFlash_Builder_Image::CalculateBufferSize_Application application size = 527c _total_image_size = 8d70
XFlash_Builder_Image::BuildImageTable allocated image buffer size = 8d70
XFlash_Builder_Image::WriteBuffer_ImageHeader
XFlash_Builder_Image::WriteBuffer_SwitchSetup current switch setup table offset : 34
XFlash_Builder_Image::WriteBuffer_SwitchSetup current application data offset : 54
XFlash_Builder_Image::WriteBuffer_SwitchSetup size : 734
XFlash_Builder_Image::WriteBuffer_SwitchSetup aligned_size : 738
XFlash_Builder_Image::WriteBuffer_SwitchSetup init_vec_shift : 0
XFlash_Builder_Image::WriteBuffer_Application
XFlash_Builder_Image::WriteBuffer_Application for node : 0
XFlash_Builder_Image::WriteBuffer_Application for core : 0
XFlash_Builder_Image::WriteBuffer_Application current core table offset : 3c
XFlash_Builder_Image::WriteBuffer_Application current application data offset : 78c
XFlash_Builder_Image::WriteBuffer_Application size : 3364
XFlash_Builder_Image::WriteBuffer_Application aligned_size : 3368
XFlash_Builder_Image::WriteBuffer_Application init_vec_shift : 0
XFlash_Builder_Image::WriteBuffer_Application chan end : 80020002
XFlash_Builder_Image::WriteBuffer_Application for core : 1
XFlash_Builder_Image::WriteBuffer_Application current core table offset : 48
XFlash_Builder_Image::WriteBuffer_Application current application data offset : 3af4
XFlash_Builder_Image::WriteBuffer_Application size : 5278
XFlash_Builder_Image::WriteBuffer_Application aligned_size : 527c
XFlash_Builder_Image::WriteBuffer_Application init_vec_shift : 0
XFlash_Builder_Image::WriteBuffer_Application chan end : 80030002
XFlash_Builder_Image::WriteBuffer_CRC
XFlash_Builder_Binary::BuildBinary
XFlash_Builder_Binary::CalculateBufferSize_Factory
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding s2l size word (4)4
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding s2l app (b64) b68
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding s2l crc (4)b6c
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding factory app (8d70) 98dc
XFlash_Builder_Binary::CalculateBufferSize_Factory : Adding sector padding (724) a000
XFlash_Builder_Binary::CalculateBufferSize_Factory : First User Sector offset = a000
XFlash_Builder_Binary::GetSearchLimitPadding : current size (a000) 0
XFlash_Builder_Binary::CalculateBufferSize_Data
XFlash_Builder_Binary::BuildBinary : Allocating buffer - a000
XFlash_Builder_Binary::GetSearchLimitPadding : current size (a000) 0
XFlash_Builder_Binary::WriteBufferToBinary : flash_bin_node0
XFlash_Programmer_Program::DoProgram
XFlash_Programmer_Program::GenerateSource
XFlash_Programmer_Program::IssueCompileCommand :xcc -w -Xmapper --dontenablesodlinks -O2 -lquadflash -x xc "fp-5d59133c" -x xn "target-xn-v0-10862654"
 -D VERBOSE=1 -D MONITOR=1 -D ERASE_ALL_FIRST=1 -o "fp-a2701068"
XFlash_Utils::BuildRunCommand : xrun --io fp-a2701068
Site Verify failed for page 0x00000000, offset 0x0000 (read 0x00, expected 0x9d).Verify failed for page 0x00000000, offset 0x0001 (read 0x00, expected
 0x20).Verify failed for page 0x00000000, offset 0x0004 (read 0x00, expected 0xf3).Verify failed for page 0x00000000, offset 0x0005 (read 0x00, expect
ed 0x37).Verify failed for page 0x00000000, offset 0x0007 (read 0x00, expected 0x09).Verify failed for page 0x00000000, offset 0x0009 (read 0x00, expe
cted 0x0a).Verify failed for page 0x00000000, offset 0x000a (read 0x20, expected 0x00).Verify failed for page 0x00000000, offset 0x000b (read 0x02, ex
pected 0x00).Verify failed for page 0x00000000, offset 0x000c (read 0x22, expected 0x00).Verify failed for page 0x00000000, offset 0x000d (read 0x02^C
What I don't understand is, even though the location of the QE bit is specified, how does xflash know how to access status register 1? (The 2nd status register, as the first status register is register 0.) It's command 35h and 31h to read and write this register, respectively. These commands are not specified anywhere. Are they known by convention?

On the other hand, the W25Q16JVIQ part that I'm using has the QE bit set (quad mode enabled) from the factory, so I guess this doesn't need to be set by xflash, anyway.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

@jallard, did you get this working?

See sections 30 & 31 of the xtime composer user guide for more details. There QSPI spec definition is different than the standard SPI definition posted by OP. Your definition file is for standard SPI command use only but the XCORE-200 current CPU series demands QSPI definition by default. However, if you plan to boot in standard SPI mode with your CPU then it is ok to use a standard SPI definition.

https://www.xmos.com/published/tools-user-guide

From the flash memory table shown in section 30, your Winbond flash is NOT supported as QSPI. However, you should be able to add the support as outlined in this document.
jallard
Member
Posts: 11
Joined: Thu Apr 07, 2016 8:10 pm

Post by jallard »

I didn't get the Winbond part working, even with the QSPI definition file. I determined that the QE (quad enable) bit location and status register setup in that part is not compatible. There''s no way that I can see to specify the locations of this bit / register in the definition options (even the QSPI definition).

I ended up using the IS25LQ040B, which I added support for by modifying the IS25LQ032B QSPI definition.

-Jim
Post Reply