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.

CCS/AM3352: NAND boot time too long

Part Number: AM3352

Tool/software: Code Composer Studio

Hi

    I have writen sbl and app to the nand flash successful,

but the startup time is too long.

the is the start log:

[18:06:10.509]收←◆
StarterWare Boot Loader
BOARDInit status [0x0]
SoC : [AM335X]
Core : [A8]
Board Detected : [UNKNOWN]
Base Board Revision : [[JD-signal]]
Daughter Card Revision: [[JD-signal]]
enter ddr init
NAND flash is connected to GPMC on this board111
111

**** Nand Device Info ****
Manufacturer Id is 2c
Device Id is d3
Page size is 2048 bytes
Block Size is 131072 bytes
Pages per Block is 64
*************************

Reading Image From NAND
[18:06:23.523]收←◆Jumping to StarterWare Application...


[18:06:34.592]收←◆open gpmc succeful!!

------------ app_EDMA_Init --------------
EDMA_Params_Init successful!
I2C initialize succesed!
Swi_create successful

[18:06:34.633]收←◆Timer create successful
FPGA version is 8810, arm version is 2020

[18:06:34.776]收←◆RS485 call time is 12001

[18:06:34.824]收←◆SetPhyMode:000021e1 Auto:1, FD10:64, HD10:32, FD100:256, HD100:128, FD10
[18:06:34.966]收←◆00:8192 LPBK:0
RS485 call time is 12001
mmcsd open successed!

it cost about 13s to read app from flash,and arfter load the app to ddr,it cost 11s to start up.

what cause these? Can the starting time be reduced to less than 5S?

my pdk version is pdk_am335x_1_0_13,thanks.

  • Hi,

    1. What is the board (evm335x, iceAM110 or custom board) you were using for the test?

    2. What MLO and app (ones come with the Processor SDK RTOS release or your own version of the SBL and app) you were using for the test?

    3. Have tried the latest Processor SDK RTOS for AM335x rev 6.1.0? (http://software-dl.ti.com/processor-sdk-rtos/esd/AM335X/latest/index_FDS.html)

    Ming

  • Hi

        the board is our custom board,and the MLO and app is build by myself,the  app size is about 2M bytes.

    and I build for debug.

    I don't try the latest PDK version.

    I found it will cost about 15.3ms to read a page of nand.

  • Hi,

    It is hard for us to pin point your problem, since you have changed the SBL for your custom board.

    My best guess is that the NAND flash settings are incorrect. 

    If you have a iceAM335x or evmAM335x, you can try the pre-built MLO and app for the on board NAND flash and do the measurement there as a reference point.

    Ming  

  • Hi

        Did you mean nandDeviceData_t gNandDeviceData[] set is incorrect?

    but it can read and write data to nand by this config.does it can influence speed?

    I tested a piece of code:

    for(uint32_t i = 0;i<0x100000;i++)
    {
            j = 4*4*4;
    }

    in bootloader,it will cost 700ms.but in the application it only cost 7.9ms.

    Can SBL program run slowly?

    SBL is running in RAM, and app is running in DDR. Is this the reason?

  • Hi,

    gNandDeviceData will definitely affect the NAND access time. Please make sure it is correctly set.

    There is a SRAM (64KB, 0x402F_0400 0x402F_FFFF) and a L3_OCMC(64KB, 0x4030_0000--0x4030_FFFF). They both should be faster than the DDR, unless the code is short, so it got cached in the L2 cache. Anyway, I cannot explain it.

    Ming

  • Hi

         I have modified gNandDeviceData ,reduced most time params,opportunities don't improve。

    I don't know what to do now。du you have any suggestions?

    Now we have two problems starting from NAND.

    One is that the speed of reading from NAND is slow.

    The other is that it will take 10s from NAND to read app to DDR and to execute the program.

    For example, if prefetch is useful, or DMA is used,

    but bootloader does not support DMA reading

  • Hi,

    As I mentioned before, it is hard for us to root cause your problem, since you have changed the SBL for your custom board.

    If you have a iceAM335x or evmAM335x, you can try the pre-built MLO and app for the on board NAND flash and do the measurement there as a reference point.

    If the same problem happens on either iceAM335x or evmAM335x with pre-built MLO and app, then we can help you to debug the issue on our side.

    If the problem does not happen on iceAM335x or evmAM335x, then you should compare the differences between two SBLs

    Have you benchmarked your NAND flash performance with a standalone program, especially the read performance?

    Ming  

  • Hi

        Now I don't have such a board on hand,

    I can only solve this problem.

    As far as I know, there is no enabled D-cache or MMU in the bootloader.

    I think it can also affect efficiency.

    Can I enable D-cache and MMU in the bootloader?

    If so, how can I enable them

    BR!

  • Hi Ming

    I downloaded a 96k serial port test program to NAND.

    It took 670ms from power on to program running, including 170ms for ROM startup, 500ms for SBL,

    470ms for 96k app reading. In this way, it took 30ms for DDR to run.

    To eliminate the problem of slow speed of reading program,

    I think it is wrong to start from DDR for 11S in my own app program.

    In my own app program, EMAC, GPMC, EDMA, UART, mmcsd and other modules are used.

    Is it because there are many loaded modules that lead to slow start?

    Or there are other configurations in the. Cfg file that can cause this problem

    I uploaded the cfg file. Can you help me see what's wrong

    2158.app.cfg

  • In bootloader, I added two api,

    MMUConfigAndEnable  and CACHEEnable, hoping to enable D-cache.

    But when debugging, I found that the program hung up when it was executed to CACHEEnable.

    I don't know why.

  • Hi,

    Did you use the following function calls to enable the MMU and D-cache?

    MMUConfigAndEnable(); (defined in C:\ti_am3_610\pdk_am335x_1_0_16\packages\ti\starterware\examples\example_utils\example_utils_mmu.c)
    CACHEEnable(CACHE_IDCACHE, CACHE_INNER_OUTER); (defined in C:\ti_am3_610\pdk_am335x_1_0_16\packages\ti\starterware\soc\cache_arm.c)

    I still think the root cause is the NAND read speed is the problem. Can do the NAND flash read performance benchmark? Measure the time to read 2MB data from NAND flash to DDR?

    Ming

     

  • Hi Hongping,

    Regarding to the CFG file, there two things caught my eye:

    1. heapTrackEnabled = true It may slow down your program execution.

    2. Program.stack = 0xF0000 (~980KB). I think it is too big.

    About the 11s delay before the program execution, the only possible reason is that you have a huge data buffer to initialize or a huge constant array.

    Ming 

  • Hi Ming

        I have test the read speed by example  :starterware\examples\nand\read_write.

    which use the same nandlib and configure,I tested read 2M bytes,it takes 880ms.

    in this example,it enabled mmu and D-cache,if I disable MMU and D-cache.it takes 16.4s to read 2M bytes datas.

    so I think if MMU and D-cache are enabled,the speed will greatly improved.

    but I failed in enable MMU and D-cache.

        MMUConfigAndEnable()  is the same to ../../starterware\examples\example_utils\example_utils_mmu.c.

    but it hung up when I got to this place.

    when exected this place:

    after this 

    it go to 

  • Hi

            I have enabled mmu and cache in bootloader by some modifications,NAND's reading speed has been greatly improved.

    It took less than 800ms to read 1.84M. I have solved the problem of slow reading speed in bootloader,

    but the problem of slow application execution has not been solved.

    I tried to reduce heapseze, and the program started to execute much faster.

    But how can I set heapsize?

    I have created hardware interrupt, software interrupt and four more Task,

    if I set heapsize smaller, the program will crash.

    In addition, if you have to define a large array, can not initialize it?

  • Hi Hongping,

    Glad to know that you fixed the problems.

    The heap size should be larger than the sum of the memory areas allocated by the SYS/BIOS dynamically, such as task stacks, memory allocation etc. the HWI and SWI have been included in the task stacks already.

    You can initialize the large array in your application program using memset(), unless the large array is for the pre-determined data (coefficients or constants)

    If all your problems are resolved, please mark this thread as "Resolved". Thanks!

    Ming

  • Hi ming

        Thank you very much for your help.

    At present, I set heap size to 0x20000, which is close to my practical application.

    at the same time, setting stack size to 0x8000 ,this takes about 3.7s to execute the program.

    I don't know if there are other ways to further shorten the time.

    Thank you very much, really!

    BR!