xCore-200 MC dev board - failed to connect to SQI flash device with sample code

If you have a simple question and just want an answer.
Zed1970
Member++
Posts: 26
Joined: Tue Oct 15, 2019 10:36 am

Re: xCore-200 MC dev board - failed to connect to SQI flash device with sample code

Postby Zed1970 » Tue Nov 05, 2019 12:10 am

Is it possible for you to try the following? Download latest xTimecomposer, import the latest zip sw_usb_audio-[sw]_6.15.2.zip, select app_usb_aud_xk_216_mc, make option (5) 2i10o10xssxxx, adjust the nx if nesc. then using a xTag3, a xCore-200 MC Audio development board see if you flash the spi?

Thanks,
User avatar
mon2
XCore Legend
Posts: 1836
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Tue Nov 05, 2019 12:21 am

Ok. Let us reset this back to basics. You may have to solder back the original supplied flash device - a part of me wonders if there was a possible mix up on which flash should have been soldered on the PCBA by the contract manufacturer.

That is, when the kit is selected (or XCORE-200 Explorer kit) a tool generated XN file is inserted into the project. It is that flash device (S25FL116K) that is expected on the kit else the flash tool will fail. For sake of sanity, stick with the S25FL116K flash device.

We just took out the XCORE-200 MC-AUDIO kit -> loaded up the XMOS supplied Examples -> AN00155 -> compiled and FLASHED the default binary onto the kit just fine.

Please do the same.

Here is our tool generated XN file that worked for this kit:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Network xmlns="http://www.xmos.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xmos.com http://www.xmos.com">
  <Type>Board</Type>
  <Name>xCORE-200 Explorer Kit</Name>
  <Declarations>
    <Declaration>tileref tile[2]</Declaration>
    <Declaration>tileref usb_tile</Declaration>
  </Declarations>
  <Packages>
    <Package id="0" Type="XS2-UEnA-512-FB236">
      <Nodes>
        <Node Id="0" InPackageId="0" Type="XS2-L16A-512" OscillatorSrc="1" SystemFrequency="500MHz">
          <Boot>
            <Source Location="bootFlash"/>
          </Boot>
          <Tile Number="0" Reference="tile[0]">
            <Port Location="XS1_PORT_1B" Name="PORT_SQI_CS"/>
            <Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK"/>
            <Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO"/>
          </Tile>
          <Tile Number="1" Reference="tile[1]"/>
        </Node>
        <Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile" Oscillator="24MHz">
        </Node>
      </Nodes>
      <Links>
        <Link Encoding="5wire">
          <LinkEndpoint NodeId="0" Link="8" Delays="52clk,52clk"/>
          <LinkEndpoint NodeId="1" Link="XL0" Delays="1clk,1clk"/>
        </Link>
      </Links>
    </Package>
  </Packages>
  <Nodes>
    <Node Id="2" Type="device:" RoutingId="0x8000">
      <Service Id="0" Proto="xscope_host_data(chanend c);">
        <Chanend Identifier="c" end="3"/>
      </Service>
    </Node>
  </Nodes>
  <Links>
    <Link Encoding="2wire" Delays="5clk" Flags="XSCOPE">
      <LinkEndpoint NodeId="0" Link="XL0"/>
      <LinkEndpoint NodeId="2" Chanend="1"/>
    </Link>
  </Links>
  <ExternalDevices>
    <Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K">
      <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_0"/>
      <Attribute Name="QE_BIT" Value="quad_spi_qe_bit_6"/>
    </Device>
  </ExternalDevices>
  <JTAGChain>
    <JTAGDevice NodeId="0"/>
  </JTAGChain>
</Network>
The flash device expected to be on the kit MUST be p/n S25FL116K. Nothing else. They do come in assorted widths so be sure to order the proper flash.

If you do not have this exact p/n, consider to order through Digikey / Mouser / Arrow (usually Arrow is what we use here).

Goto left side of the tool -> Examples -> AN00155 -> keep hitting FINISH till all of the dependent files are auto-loaded -> compile the .xe file -> then RUN but will do nothing.

Flash -> select the AN00155 project -> this will then result in:

Code: Select all

Warning: F03098 Factory image and boot loader cannot be write-protected on flash device on node 0
xflash: Warning: F03148 --quad-spi-clock not given, using default 15.62MHz

Site 0 has started.         
Site 0 has type 005.        
Site 0 write    0x00000000. 
Site 0 verified 0x00000000. 
Site 0 write    0x00000400. 
Site 0 verified 0x00000400. 
Site 0 write    0x00000800. 
Site 0 verified 0x00000800. 
Site 0 write    0x00000c00. 
Site 0 verified 0x00000c00. 
Site 0 write    0x00001000. 
Site 0 verified 0x00001000. 
Site 0 write    0x00001400. 
Site 0 verified 0x00001400. 
Site 0 write    0x00001800. 
Site 0 verified 0x00001800. 
Site 0 write    0x00001c00. 
Site 0 verified 0x00001c00. 
Site 0 write    0x00002000. 
Site 0 verified 0x00002000. 
Site 0 write    0x00002400. 
Site 0 verified 0x00002400. 
Site 0 write    0x00002800. 
Site 0 verified 0x00002800. 
Site 0 write    0x00002c00. 
Site 0 verified 0x00002c00. 
Site 0 has finished successfully.        
Screen grab:
xcore200_mc_flash.png
This is on a Windows 7 box x64.

What do you see with the above procedure?

This kit is in the lab @ work so more R&D will have to be tomorrow. Leaving for the evening now...
You do not have the required permissions to view the files attached to this post.
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm

Postby johned » Tue Nov 05, 2019 2:43 pm

Hi Ed,

As per our separate email discussion, my board works perfectly out of the box.
The app and tools you are using are correct.
The error absolutely relates to incorrect SPI ID. The tools generate C source for the xcore which is compiled to make the flashing agent which is downloaded to the chip during xflash. That what all of those tmp files are that appear - flash source files. You can look at them - they are quite interesting..

The tools generator does the following:

Code: Select all

  file << "  //Connect to the SPI device\n";
  file << "  if(fl_connectToDevice(phs, deviceSpecs, sizeof(deviceSpecs)/sizeof(fl_DeviceSpec)) != 0)\n";
  file << "  {\n";
  file << "    sprintf(error_str,\"Error on %s: failed to connect to flash device. Please verify that SPI type is supported and that the correct SPI ports are defined within your xn file.\\n\", tile_name);\n";
  file << "    return 1;\n";
  file << "  }\n\n”;
The API for the fl_connectToDevice function is as follows:

fl_connectToDevice opens a connection to an SPI device. It iterates through an array of n SPI device specifications, attempting to connect using each specification until one succeeds.
If it fails, it means it can’t see a flash ID it knows.

You can override the know SPI devices using:

Code: Select all

  --spi-spec arg             Enable support for the user defined SPI device;
                             arg = <spidevicefile>
Here’s an example:

Code: Select all

    0,        /* IS25LQ016B */
    256,                    /* page size */
    8192,                   /* num pages */
    3,                      /* address size */                                  
    3,                      /* log2 clock divider */                            
    0x9F,                   /* QSPI_RDID */
    0,                      /* id dummy bytes */
    3,                      /* id size in bytes */
    0x9D4015,               /* device id */
    0x20,                   /* QSPI_SE */
    4096,                   /* Sector erase is always 4KB */
    0x06,                   /* QSPI_WREN */
    0x04,                   /* QSPI_WRDI */
    PROT_TYPE_NONE,         /* no protection */
    {{0,0},{0x00,0x00}},    /* QSPI_SP, QSPI_SU */
    0x02,                   /* QSPI_PP */
    0xEB,                   /* QSPI_READ_FAST */
    1,                      /* 1 read dummy byte */
    SECTOR_LAYOUT_REGULAR,  /* mad sectors */
    {4096,{0,{0}}},        /* regular sector sizes */
    0x05,                   /* QSPI_RDSR */
    0x01,                   /* QSPI_WRSR */
    0x01,                   /* QSPI_WIP_BIT_MASK */
However, the fact it should work out of the box and you get “Response to SPI ID command on tile[0]: 0x0, 0x0, 0x0.” suggests a HW issue… It’s not reading a valid SPI ID.

Finally, as per our separate emails, I would suggest that you refit the original device and try Mon2's suggestions, above.

Best regards,
John
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm

Postby johned » Tue Nov 05, 2019 4:16 pm

For completeness, when I do the following under Windows, with my MC board, fitted with IS25LQ008 :
xflash --spi-read-id 0x9f --target-file xk-audio-216-mc.xn
I get :
Response to SPI ID command on tile[0]: 0x9d, 0x40, 0x14.

The project you built also flashes and runs correctly.
John
Zed1970
Member++
Posts: 26
Joined: Tue Oct 15, 2019 10:36 am

Postby Zed1970 » Wed Nov 06, 2019 8:02 pm

Hi Johned and mon2,

Resolved! Ended up ordering some S25FL116 from RS and things slowly fired up including our design. In all a simple fix and have learnt a lot but hopefully these mismatches will be sorted out between development board, qspi part stated on the circuit and demo code for the next fellow!

Really appreciate all your help.

Thanks.
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm

Postby johned » Wed Nov 06, 2019 8:15 pm

Excellent news, thanks for the update.
Best,
John
fabra
Member
Posts: 13
Joined: Sat May 09, 2020 4:20 pm

Postby fabra » Wed Sep 16, 2020 4:36 pm

Thanks for all the helfpul notes here.
Finally the update to xTimeComposer 14.4. solved a lot of my flash issues! Support for more flash types was added there.

Who is online

Users browsing this forum: No registered users and 0 guests