Custom flash support in xTIMEcomposer Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
eez-open
Active Member
Posts: 60
Joined: Mon Oct 23, 2017 1:49 pm
Location: Croatia
Contact:

Custom flash support in xTIMEcomposer

Post by eez-open »

This topic is sort of follow up to this one and that one, and few others where adding of flash that is not supported by xTIMEcomposer was already discussed. In all of them I can find that separate config file is suggested that has to be specified to xflash when flashing is performed (i.e. from command line). I'd like to know is it allowed to simply add definition of the new flash to header files SpecMacros.h, SpecEnum.h or QuadSpecMacros.h and QuadSpecEnum.h? All of them has the following notice in the header:

Code: Select all

/*
 * Generated file - do not edit.
 */
Why is that? How and when they were generated? I'd like to add support for QSPI flash that is not currently supported, Adesto AT25SF041 (Datasheet). Therefore I'd like to append the following code to the QuadSpecMacros.h file (FL_QUADDEVICE_ADESTO_AT25SD041 used as template):

Code: Select all

#define FL_QUADDEVICE_ADESTO_AT25SF041 \
{ \
    ADESTO_AT25SF041,       /* AT25SF041-SSHDT */ \
    256,                    /* page size */ \
    2048,                   /* num pages */ \
    3,                      /* address size */                                   \
 ?   3,                      /* log2 clock divider, 16.6MHz from a 100MHz reference clock, i.e. 100 / (2*3) */                             \
    0x9F,                   /* QSPI_RDID, Section 11.1*/ \
    0,                      /* id dummy bytes */ \
    3,                      /* id size in bytes */ \
    0x1F8401,               /* device id, Table 11-2*/ \
    0x20,                   /* QSPI_SE (Block erase command), Table 5-1 */ \
 ?   4096,                   /* Sector erase is always 4KB */ \
    0x06,                   /* QSPI_WREN (Write Enable command), Table 5-1 */ \
    0x04,                   /* QSPI_WRDI (Write Disable command), Table 5-1 */ \
    PROT_TYPE_NONE,         /* no protection */ \
 ?   {{0,0},{0x00,0x00}},    /* QSPI_SP, QSPI_SU */ \
    0x02,                   /* QSPI_PP (Page Program command), Table 5-1 */ \
    0xEB,                   /* QSPI_READ_FAST (Quad I/O Read command), Table 5-1 */ \
 ?   1,                      /* 1 read dummy byte */ \
    SECTOR_LAYOUT_REGULAR,  /* mad sectors */ \
 ?   {4096,{0,{0}}},        /* regular sector/block sizes */ \
    0x05,                   /* QSPI_RDSR (Read Status Register Byte 1 command), Table 5-1 */ \
    0x01,                   /* QSPI_WRSR (Write Status Register command), Table 5-1 */ \
    0x01,                   /* QSPI_WIP_BIT_MASK, Table 5-1 */ \
}
(Please note that I added ? sign before value that I'm not sure that is applicable)

... and in QuadSpecEnum.h file:

Code: Select all

ADESTO_AT25SF041 = 8,
Then I can add into my .xn file the following:

Code: Select all

<ExternalDevices>
    <Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="ADESTO_AT25SF041">
      <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>


View Solution
User avatar
eez-open
Active Member
Posts: 60
Joined: Mon Oct 23, 2017 1:49 pm
Location: Croatia
Contact:

Post by eez-open »

I continued with my effort to make any action on custom flash (i.e. one that is not supported by xTIMEcomposer) but still without success, and probably once again due to my lack of understanding how xTIMEcomposer components works. For example, when I tried to use command line xflash utility to erase content of the flash (it's new but just to see if communication will be established):

./xflash --erase-all --target EEZ-XE216-512-EVAL

... got the following error in return:

Error: Failed to recognise flash device at node "0".

I put into EEZ-XE216-512-EVAL.xn <ExternalDevices> section as mentioned into first post, and also changed both QuadSpecEnum.h and QuadSpecMacros.h. But, if changing mentioned header files is not allowed, where to put description of the custom flash: maybe in e.g. platform.xn file, or some place else?
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Hi. See sections 30 and 31 of the xtimecomposer user guide. The trick we used is to locate one of the definitions already supported by the tool and alter the definition to match the custom flash. Then proceed to use that modified file using the original older part number. The tool thought we were using the older flash from ISSI but was really fetching the new parts. Been a while so this is from memory. No pun:)

Plan 2 is to see section 31.13 and access your custom ascii / text defn using the

--spi-spec yourflash.txt

flag. We recall using this method for standard spi custom flash testing so this should work as initial testing but now your xn file must be for standard spirit pins. Then your pcb must boot using standard spi flash boot mode. This testing was on the xmos startkit.
User avatar
eez-open
Active Member
Posts: 60
Joined: Mon Oct 23, 2017 1:49 pm
Location: Croatia
Contact:

Post by eez-open »

Thanks a lot for reply. So far I tried all type of flash config file (attached) settings changes, but without any success. To be completely sure that line multiplexers are not source of problem, I also removed them, but xflash continued to report the same error. Command:

./xflash --erase-all --spi-spec Adesto.txt --target EEZ-XE216-512-EVAL --verbose

Response:

XFlash_Options::ListDevices : xgdb --batch -q --ex listdevices devl-32ff68cb
XFlash::DoXFlash
XFlash::DoReadWriteErase
XFlash_Programmer_Erase_NoChan::DoErase
XFlash_Programmer_Erase_NoChan::IssueCompileCommand
xcc -w -Xmapper --dontenablesodlinks -Xmapper --nochaninit -Xmapper --noinitialtidy -Xmapper --bootstyle=forsim -x xn "<hidden>/Community_14.3.2/targets/EEZ-XE216-512-EVAL/EEZ-XE216-512-EVAL.xn" -O2 -lquadflash -D xnPORT_SQI_CS0=PORT_SQI_CS -D xnPORT_SQI_SCLK0=PORT_SQI_SCLK -D xnPORT_SQI_SIO0=PORT_SQI_SIO -x xc "fe-7421efde" -o "fe-a79bfaf7"
XFlash_Utils::BuildRunCommand : xrun --io fe-a79bfaf7
Error: Failed to recognise flash device at node "0".


Now I'll try to use your trick and let you know the result.
Attachments
EEZ-XE216-512-EVAL.xn
(2.24 KiB) Downloaded 273 times
EEZ-XE216-512-EVAL.xn
(2.24 KiB) Downloaded 273 times
Adesto.txt
(873 Bytes) Downloaded 268 times
Adesto.txt
(873 Bytes) Downloaded 268 times
User avatar
eez-open
Active Member
Posts: 60
Joined: Mon Oct 23, 2017 1:49 pm
Location: Croatia
Contact:

Post by eez-open »

I tested what you suggested but without success. I simply changed device ID of the existing AT25SD041 with 0x1F8401 in QuadSpecEnum.h file. Nothing is happened, the same error is reported. It seems to me that the last resort is to find somewhere one of supported models (possible one that is used on xCore-200 eXplorer board) and check what will happened.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Try the following:

1) Start the xtimecomposer tool and launch AN00185 from the examples button on the left - this project is for the XCORE-200 series and suitable for your interest.

2) The .XN file will be autogenerated for you but be sure the mux is not a factor. You noted it has been bypassed :)

3) Note the default flash supported in QSPI mode is the S25FL116K.


Image

4) So search for the .h file that references the definition which you already found:


Image

Now locate the offset in the .h file for the S25FL116K and leave the header label of SPANSION_S25FL116K alone but change the others to suit your new flash device.

If done properly, the tool will think you are working with the original Spansion device but you will be really working with the Adesto part.

Crazy work around but it will work - fairly sure we started with this trick the first time around for our standard SPI mode use. You are using XCORE-200 and wired your PCB for QSPI mode so you most support QSPI methods for this tool.

Post your results.

Path is: C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.3.2\target\include



Image

More suggestions:

1) Try the XCORE project as-is with the Spansion. It should fail since Adesto IDs and commands may not be the same as the Spansion. No worries and to be expected.

2) Next alter the .h file for this Spansion part with ONLY the IDs for the Adesto part - nothing else. Try again. This time the verbose output should proceed further since it thinks the IDs are matching as they should.

3) Then proceed to alter the other commands as required to support the Adesto part but using the Spansion as the index.
User avatar
eez-open
Active Member
Posts: 60
Joined: Mon Oct 23, 2017 1:49 pm
Location: Croatia
Contact:

Post by eez-open »

Ok, I tried what you suggested. Muxes are removed, and used flash definition is changed. Flashing from xTIMEcomposer I got the following error:

Error on tile[0]: failed to connect to flash device. Please verify that SQI type is supported and that the correct SQI ports are defined within your xn file.
Last edited by eez-open on Fri Feb 23, 2018 11:49 am, edited 1 time in total.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Can you post your modified .h file?
User avatar
eez-open
Active Member
Posts: 60
Joined: Mon Oct 23, 2017 1:49 pm
Location: Croatia
Contact:

Post by eez-open »

mon2 wrote:Can you post your modified .h file?
Please find in attachment...
Attachments
QuadSpecMacros.h
(8.82 KiB) Downloaded 282 times
QuadSpecMacros.h
(8.82 KiB) Downloaded 282 times
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Our experiments with the flash devices to date have been with the StartKit and XRHA PCBs and in standard SPI mode so lacking some real experience here but try the following:

Code: Select all

xflash --spi-read-id 9f --spi-spec adesto.txt --target XCORE-200-EXPLORER.xn --verbose
Not sure if the spi-read-id command is passed as 9f or as 0x9f but give it a try.

Does this return the IDs for your Adesto flash?
Post Reply