This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCZAD: Serial Flash for a file system using a Tiva CPU

Part Number: TM4C1294NCZAD
Other Parts Discussed in Thread: TM4C1294NCPDT, EK-TM4C1294XL, SYSBIOS

I have a TM4C1294NCZAD and I am using the following Software:

ccs 8.2.0 
TIRTOS 2.16.0.08,
compiler 5.2.7 and
XDC 3.31.1333
TM4C1294NCPDT

I would like to add a serial flash part to my board  and implement a non volatile flash file system.   Assume I will be adding it to a EK-TM4C1294XL eval board. 

What are the requirements to select the flash part that will be needed for the TI-RTOS and Tiva to implement a flash file system?

This link http://processors.wiki.ti.com/index.php/TI-RTOS_Examples_SerialFlash recommended a AT45DB but I am seeing that the AT45DB is no longer recommended for a development.

Any recommendations for a replacement for the AT45DB?

Thanks,

Doug

I

  • Interesting. Mouser shows over 2,000 available and the datasheet does not indicate the part is no longer recommended for new designs.

  • Here is a list of parts still active: https://www.digikey.com/products/en/integrated-circuits-ics/memory/774?k=AT45DB&k=&pkeyword=AT45DB&sv=0&pv7=2&sf=0&FV=1f140000%2Cffe00306%2C23805e0%2C23805e3&quantity=&ColumnSort=0&page=1&pageSize=25

    It looks to me like they are discontinuing the -SHD (2.5V to 3.6V)  option for the -SHF option (2.3V to 3.6V). It makes sense since the -SHF parts have a wider operating voltage range.

    You can contact Adesto for verification.

    You can use other SPI serial flash devices, but they may require some software modifications.

  • My goal is to prototype a file system with a flash part and not use a microSD card. 

    Thank you for providing the latest flash parts that can be used with the Tiva.

    I also have a DK-TM4C129x eval board with both microSD and a SPI flash part (MX66L5).  There are 2 examples for using the file system but from the readme files talks about using microSD only and not the MX66L5. 

    The examples are fatsd_DK_TM4C129X_TI_TivaTM4C129XNCZAD and fatsdraw_DK_TM4C129X_TI_TivaTM4C129XNCZAD.

    I verified both examples using the microSD card.  Should these two examples work if the microSD card is removed and the JP7 jumpers are changed so the MX66L5 can be used?

    In looking at the examples, I see that the function Board_initSDSPI() initializes the CPU pin PH4 that the microSD uses as a chip select.  If I were to remove the microSD card and use the MX66L5 should that work if I change the chip select to use PQ1 since PQ1 is the chip select to the MX66L5? 

    If the MX66L5 can be used for testing these examples where in the example app is the chip select PH4 being set and cleared?

    Thanks,

    Doug

  • Hi Doug,

    I would not try to use the SDSPI for the MX66L5. I would take the same approach as noted in http://processors.wiki.ti.com/index.php/TI-RTOS_Examples_SerialFlash. For example, write a MX66L5.c (use AT45DB.c as a template) and MX66L5FatFs.c (using AT45DBFatFs.c as a template). Ditto on the header files.

    Todd

  • Would you expect I could download and build the examples the wiki references in CCS 8.2.0?

    I downloaded the example projects and unzipped them and then imported them into CCS8.2.0 and I get the following errors when I try to build the projects linked in the wiki..

    I assume the fix is to download and install an older version of TI-RTOS to make this work.  I have 2.16.0.08 and 2.16.1.14 installed:

    What should I install to test these examples?

    Thanks,

    Doug

    From the problems tab in CCS 8.2.0.

    Description Resource Path Location Type
    can't locate the package 'ti.sysbios.fatfs' along the path: 'C:/TI/tirtos_tivac_2_16_00_08/packages;C:/TI/tirtos_tivac_2_16_00_08/products/tidrivers_tivac_2_16_00_08/packages;C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages;C:/TI/tirtos_tivac_2_16_00_08/products/ndk_2_25_00_09/packages;C:/TI/tirtos_tivac_2_16_00_08/products/uia_2_00_05_50/packages;C:/TI/tirtos_tivac_2_16_00_08/products/ns_1_11_00_10/packages;C:/ccs8p2/ccsv8/ccs_base;C:/TI/xdctools_3_32_00_06_core/packages;..;'. Ensure that the package path is set correctly. .xdchelp /serialFlash_TM4C129_LP line 53 C/C++ Problem
    gmake: *** [build-201117329] Error 2 serialFlash_TM4C129_LP    C/C++ Problem
    gmake: Target 'all' not remade because of errors. serialFlash_TM4C129_LP    C/C++ Problem
    gmake[1]: *** [build-201117329-inproc] Error 1 serialFlash_TM4C129_LP    C/C++ Problem
    Invalid project path: Include path not found (C:\TI\tirtos_tivac_2_16_00_08\products\TivaWare_C_Series-2.1.0.12573c). serialFlash_TM4C129_LP  pathentry Path Entry Problem
    Product 'TI-RTOS for TivaC' v2.12.1.33 is not currently installed. A compatible version 2.16.0.08 will be used. serialFlash_TM4C129_LP  serialFlash_TM4C129_LP Problem
    This project was created using a version of compiler that is not currently installed - 5.2.2 [ARM]. Another version of the compiler will be used during build - 18.1.3.LTS. See 'Help > Install New Software' and select 'Code Generation Tools Updates' to check if this compiler is available through a CCS update. Visit <a href="liveaction:OpenAppCenter">CCS App Center</a> to get the latest compiler support. Or <a href="software-dl.ti.com/.../a> and install the compiler, then register it with CCS through 'Preferences > CCS > Build > Compilers'. serialFlash_TM4C129_LP  properties Problem

    From The Console window:

    Building file: "../serialflash.cfg"

    Invoking: XDCtools

    "C:/TI/xdctools_3_32_00_06_core/xs" --xdcpath="C:/TI/tirtos_tivac_2_16_00_08/packages;C:/TI/tirtos_tivac_2_16_00_08/products/tidrivers_tivac_2_16_00_08/packages;C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages;C:/TI/tirtos_tivac_2_16_00_08/products/ndk_2_25_00_09/packages;C:/TI/tirtos_tivac_2_16_00_08/products/uia_2_00_05_50/packages;C:/TI/tirtos_tivac_2_16_00_08/products/ns_1_11_00_10/packages;C:/ccs8p2/ccsv8/ccs_base;" xdc.tools.configuro -o configPkg -t ti.targets.arm.elf.M4F -p ti.platforms.tiva:TM4C1294NCPDT -r release -c "C:/ccs8p2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS" --compileOptions "-mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me --include_path=\"C:/ccs8p2/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include\" --include_path=\"C:/TI/tirtos_tivac_2_16_00_08/products/TivaWare_C_Series-2.1.0.12573c\" -g --gcc --define=ccs=\"ccs\" --define=PART_TM4C1294NCPDT --define=ccs --define=TIVAWARE --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on " "../serialflash.cfg"

    configuring serialflash.xem4f from package/cfg/serialflash_pem4f.cfg ...

    subdir_rules.mk:19: recipe for target 'build-201117329-inproc' failed

    js: "C:/Tiva File system testing/Tiva FS example/serialFlash_TM4C129_LP/serialflash.cfg", line 53: xdc.services.global.XDCException: xdc.PACKAGE_NOT_FOUND: can't locate the package 'ti.sysbios.fatfs' along the path: 'C:/TI/tirtos_tivac_2_16_00_08/packages;C:/TI/tirtos_tivac_2_16_00_08/products/tidrivers_tivac_2_16_00_08/packages;C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages;C:/TI/tirtos_tivac_2_16_00_08/products/ndk_2_25_00_09/packages;C:/TI/tirtos_tivac_2_16_00_08/products/uia_2_00_05_50/packages;C:/TI/tirtos_tivac_2_16_00_08/products/ns_1_11_00_10/packages;C:/ccs8p2/ccsv8/ccs_base;C:/TI/xdctools_3_32_00_06_core/packages;..;'. Ensure that the package path is set correctly.

    "./package/cfg/serialflash_pem4f.cfg", line 184

    xdctools_3_32_00_06_core\gmake.exe: *** [package/cfg/serialflash_pem4f.xdl] Error 1

    js: "C:/TI/xdctools_3_32_00_06_core/packages/xdc/tools/Cmdr.xs", line 51: Error: xdc.tools.configuro: configuration failed due to earlier errors (status = 2); 'linker.cmd' deleted.

    gmake[1]: *** [build-201117329-inproc] Error 1

    subdir_rules.mk:16: recipe for target 'build-201117329' failed

    gmake: *** [build-201117329] Error 2

    gmake: Target 'all' not remade because of errors.

    **** Build Finished ****


    This project was created using a version of XDCtools that is not currently installed: 3.31.0.24_core. Please install the XDCtools of this version, or migrate the project to one of the supported versions. serialFlash_TM4C129_LP  serialFlash_TM4C129_LP Problem

  • Doug,

    Sorry! I missed this reply.

    We moved FatFS out of SYS/BIOS in 2.16 release (long story why). Please remove the FatFS lines from the .cfg. You'll need to manually add in the include paths and library in the project settings. FatFS is now here: tirtos_tivac_2_16_01_14\products\tidrivers_tivac_2_16_01_13\packages\ti\mw\fatfs

    You can import a FatFS example from 2.16 and look at the project settings to make sure you are getting the correct paths.

    Todd

  • This is a project I have been working on.export2.zip

  • Hi Doug,

    Here's the FatFS version of the serial flash example that works with 2.16: /cfs-file/__key/communityserver-discussions-components-files/908/serialFlash_5F00_FatFS_5F00_TM4C129_5F00_LP_5F00_with_5F00_2_5F00_16.zip

    I cheated a bit with the f_mount change. I hard-coded "0:" instead of using handle->driveNumber in AT45DBFatFS.c. Also there are a couple compiler warnings that should be cleaned up.

    I'm going to mark this as TI Thinks Resolved since this appears to be a HW issue (we've been working this off-line). If it turns out to be a SW issue, let's update this thread.

    Todd

  • I have not been able to get this example to work correctly.   I can confirm that the project serialFlash_TM4C129_LP builds and executes correctly and I think that project uses the same hardware as this example .

    The project posted in the link above serialFlash_FatFS_TM4C129_LP builds with a warning on line 114

    fresult = f_mkfs(at45dbHandle->driveNumber, 0, AT45DBFatFs_FLASH_SECTOR_SIZE );

    With warning "Description Resource Path Location Type  #169-D argument of type "UInt" is incompatible with parameter of type "const TCHAR *" serialflash.c /serialFlash_FatFS_TM4C129_LP line 114 C/C++ Problem"

    When I step through the code the it gets to the function f_mkfs() below and it aborts because  f_mkfs() returns FR_INVALID_DRIVE.

     

    AT45DBFatFs_init();

    AT45DBFatFs_Params_init(&params);

    at45dbHandle = AT45DBFatFs_open(spiHandle, Board_CS, &params, DRIVE_NUM);

    if (spiHandle == NULL) {

    System_abort("AT45DBFatFs_open failed\n");

    }

    fresult = f_open(&src, inputfile, FA_WRITE|FA_READ);

    if (fresult != FR_OK) {

    if (fresult == FR_NO_FILESYSTEM) {

    System_printf("Formatting Flash disk\n");

    fresult = f_mkfs(at45dbHandle->driveNumber, 0, AT45DBFatFs_FLASH_SECTOR_SIZE );

     

     

    I looked at the documentation for TI RTOS and it points to this online documentation but in the link the f_mkfs() has 5 arguments in the function call so that's different that the example code.

     

    Can someone help me get this example working?

     

    Thanks,

    Doug:

     

  • Hi Doug,

    The version of FatFS in TI-RTOS for TivaC 2.16 is R0.11a (the 2.12 version had R0.08a). The one on the elm site is newer (R0.13c). The .11a version only has three parameters to f_mkfs...but they are different from 08a!! The first parameter is a string instead of a value...doh! Sorry for missing this the first time. I must have ran the 2.12 FatFS one and it called f_mkfs properly so when I ran the 2.16 version the f_mkfs was never called. When I just tried calling the non-FatFs one (and killed the filesystem) and then tried the 2.16 FatFs one, I got the same result as you.

    I changed the call to f_mkfs to (again I hard-coded it for a quick test).

    fresult = f_mkfs("0", 0, AT45DBFatFs_FLASH_SECTOR_SIZE)

    and then it worked. I checked out the other two compiler warnings and they we ok. I went ahead and changed them also 

    before:

    DRESULT             AT45DBFatFs_diskRead(UChar drv, UChar *buf, ULong sector,
                                             UChar count);
    DRESULT             AT45DBFatFs_diskWrite(UChar drv, const UChar *buf,
                                              ULong sector, UChar count);
    

    after:

    DRESULT             AT45DBFatFs_diskRead(BYTE drv, BYTE *buf, DWORD sector,
                                             UINT count);
    DRESULT             AT45DBFatFs_diskWrite(BYTE drv, const BYTE *buf,
                                              DWORD sector, UINT count);
    

    and then I changed the actual function calls to match.

    Can you give that a try and see if it works?

    Todd

  • I changed the function call to the following and it works now:  Thanks for the help!!!!

    fresult = f_mkfs("0", 0, AT45DBFatFs_FLASH_SECTOR_SIZE);

    Do you know where I can find the documentation for the following function calls?

    1) AT45DBFatFs_init();

    2) AT45DBFatFs_Params_init(&params);

    3) at45dbHandle = AT45DBFatFs_open(spiHandle, Board_CS, &params, DRIVE_NUM);

    4) fresult = f_open(&src, inputfile, FA_WRITE|FA_READ);

    5) fresult = f_mkfs("0", 0, AT45DBFatFs_FLASH_SECTOR_SIZE);

    6) fresult = f_open(&src, inputfile, FA_CREATE_NEW|FA_READ|FA_WRITE);

     

    I looked in the RTI-TOS Doc and it refers to:

    The Document linked above refers to the following (this doesn't seem to match the API):

     

     

     

     

     

     

     

     

  • Hi Doug,

    The first three are sample code and we don't typically document them much.

    The last three are from FatFS. You can download the desired FatFs version (check the FatFs header files to see the version) from http://elm-chan.org/fsw/ff/archives.html. The zip has the documentation for that version.  In hindsight, we should have included this documentation in the TI-RTOS product.

    Todd

  • Todd,

    Where is the number of sectors specified or isn't it specified?   I see the call:

    f_mkfs("0", 0, AT45DBFatFs_FLASH_SECTOR_SIZE);

    specifies the sector size but where is the number of sectors specified?

    The sector size is defined as:

    #define AT45DBFatFs_FLASH_SECTOR_SIZE 512

    I assume if I get a larger flash device I would need to specify the size of the new part some place.

    Thanks,

    Doug

  • Doug,

    Number of sectors (pages) is in AT45DB.h: AT45DB161_NUMBER_OF_PAGES. This is returned to FatFs in the AT45DBFatFs_diskIOctrl() call when the ctrl message is GET_SECTOR_COUNT.

    Yes, if you use a new part, these would have to be adjusted accordingly.

    Todd

  • Thanks for the help on this!!


    One more question, as per a recommendation above from Bob on  Jun 17, 2019 3:08 PM, I assume I can use any of the parts listed in the link below with only minor changes to the software setup (sector size/number of sectors. possible SPI speed).

    www.digikey.com/.../774

    If I wanted more memory that 16 Mbit, is there a part you would recommend?  The largest part I see is 16 Meg and that may be OK for our application but if I needed more that 16Mbit are there any parts that would be recommended I could use?


    Thanks,


    Doug

  • Hi Doug,

    Sorry, I cannot be much help on this one since I'm not familiar with SPI Flash devices (other than the AT45DB one).

    Todd

  • I took the working example "serialFlash_FatFS_TM4C129_LP" and replaced the flash part with the flash part in the data sheet in the link below.

    https://www.winbond.com/resource-files/w25q128fv%20rev.l%2008242015.pdf

    In the application "serialFlash_FatFS_TM4C129_LP" I made the following changes:

    1) I changed AT45DBFatFs_FLASH_SECTOR_SIZE from 512 to 4192

    2) I changed AT45DB161_NUMBER_OF_PAGES from 4096 to 65535.

    3) I changed AT45DB161_PAGE_SIZE from 528 to 256.

    With the three changes listed above the example serialFlash_FatFS_TM4C129_LP no longer works correctly and it fails on the f_open() call.

    Is one of my parameters wrong or is there another parameter I need to change to use this memory chip?

    Thanks,

    Doug

     

  • I don't think that is a valid sector size based on the following comment in ff.h

    WORD	ssize;			/* Bytes per sector (512, 1024, 2048 or 4096) */

  • That's well noted - appears poster has 'illegally merged/contracted.'    (4096 & 8192 - yielding the errant 4192)

    Firm/I have 'no interest' in '4C129' - yet many such Flash memory devices provide their 'Vendor/Model Number' - and the existing code (if it interrogates the Flash memory) may not 'recognize' the upgraded device...

  • Todd, thanks for pointing out that the limit of AT45DB161_NUMBER_OF_PAGES is (512, 1024, 2048 or 4096).

    From the document on the flash chip it states:

    "The W25Q128FV array is organized into 65,536 programmable pages of 256-bytes each. Up to 256 bytes can be programmed at a time. Pages can be erased in groups of 16 (4KB sector erase), groups of 128 (32KB block erase), groups of 256 (64KB block erase) or the entire chip (chip erase). The W25Q128FV has 4,096 erasable sectors and 256 erasable blocks respectively. The small 4KB sectors allow for greater flexibility in applications that require data and parameter storage. (See Figure 2.)" 

    Is the flash chip I am trying to make work not going to be easily configured to work with the FFS just by changing a few #defines or am I using the work value of AT45DB161_NUMBER_OF_PAGES for this part?


    cb1_mobile, Good catch, that was a typo.

    Thanks,


    Doug

     

  • Hi Doug,

    Since the device page size is 256, you'll need to set the sector size to 512. Then when a read/write/etc. comes down for 512, you'll need to act on two adjacent 256 byte pages. Does that make sense?

    Todd

  • I don’t really understand this so I’ll go through where I got the numbers and maybe you can point out what I am missing.

    If I understand this correctly the chip is 16Mbyte in size and the page size is 256 Bytes so:

    Each Page is = 256 Bytes

    65,535 pages x 256 bytes per page = 16 M Bytes Chip

    Each Sector is 4096K Bytes

    Each Block = 65,535 (4KB Sectors * 16 Sectors)

    4096 sectors * 4 K Byte/sector = 16 M Bytes Chip

     

    16 pages X 256 Bytes / Page = 4K Byte erase block

    128 pages X 256 Bytes / Page = 32K Byte erase block

    256 pages X 256 Bytes / Page = 64K Byte erase block

    I used:

    #define AT45DBFatFs_FLASH_SECTOR_SIZE   4096

    #define AT45DB161_NUMBER_OF_PAGES       65535 <<<As you pointed out this is invalid

    #define AT45DB161_PAGE_SIZE           256

    Is the AT45DB161_NUMBER_OF_PAGES the total number of pages on the chip because if it is then 65,535 would be what the flash chip really has? If the AT45DB161_NUMBER_OF_PAGES is the number of pages per sector then it would be 16.  Looking at the code though it looks like this value AT45DB161_NUMBER_OF_PAGES is put in for the sector count.

     

    One more thing we found in the data sheet is the flash chip has a write enable instruction 0x06 that it says:

    The Write Enable instruction (Figure 5) sets the WriteEnable Latch (WEL) bit in the Status Register to a 1. The WEL bit must be set prior to every Page Program, Quad Page Program, Sector Erase, Block Erase, Chip Erase,Write Status Register and Erase/Program Security Registers instruction. The Write Enable instruction is entered by driving /CSlow, shifting the instruction code “06h” into the Data Input (DI) pin on the rising edge of CLK, and then driving /CShigh.”

    Would this write enable command require changes to the low level to make this work with this part?

    Is this chips something that could be “easily used” with the Tiva and TI ROTOS by just modifying some #defines or should I find another part that would be a better fit?

    Thanks,

    Doug

  • Todd,

    Doug and I met up today to talk more about this.  The Atmel device substituted for the original memory TI selected for this, which has since been labeled 
    'not intended for new designs' is not a drop-in memory device from a software perspective.  Doug has confirmed that.  We suspect the memory partitioning and sectoring in general are different, therefore, not a drop-in.

    Has your team done work with any other substitute memory devices that you can suggest to Doug, or frankly other customers in the same predicament?  We would welcome any input you can extend.  We realize this is memory and not something TI manufactures themselves, but we are hopeful from a TI-RTOS and overall project standpoint, that your team can provide some additional guidance.  Ultimately, we want to find a larger memory density device to the original, that provides as close to drop-in as possible, or at least with identifiable changes to the RTOS project and corresponding software.

    Thank you,
    Chris