Skip to main content
Visitor II
June 1, 2007
Question

Aplication downloaded from bootloader

  • June 1, 2007
  • 6 replies
  • 1340 views
Posted on June 01, 2007 at 09:22

Aplication downloaded from bootloader

    This topic has been closed for replies.

    6 replies

    k_arthurAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:43

    I found that aplication downloaded from bootloader(writen by me)

    RCLK = fMSTR = fPLL = 96Mhz

    not work when aplication compiled(FMICLK = RCLK)

    but work when aplication compiled(FMICLK = RCLK/2)

    It seems like after writing to flash( clock was limited to

    RCLK = fMSTR = fPLL = 48Mhz , FMICLK = RCLK/2 ) aplication also

    can not work on maximum FMICLK)

    Is it a silicon limitation ?

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:43

    Hi kesart,

    I have the same experience with application loaded by bootloader.

    For FMICLK=96MHz the FMI_ReadWaitState must =FMI_READ_WAIT_STATE_3

    and FMI_WriteWaitState must =FMI_WRITE_WAIT_STATE_1.

    This is set by FMI_Config function prior to switching the MCLK

    to PLL at 96MHz.

    Problem is, that the ST's Software Library has a bug in 91x_fmi.c right

    in FMI_Config.

    So originally the processor stucks just in moment of executing the FMI_Config(......) in newly downloaded application in Bank0.

    Here is the corrected fuction:

    void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,u16 FMI_LVDEN, u16 FMI_FreqRange)

    {

    /* Configure the write wait state value */

    if (FMI_WriteWaitState == FMI_WRITE_WAIT_STATE_1)

    {

    FMI->CR |= FMI_WRITE_WAIT_STATE_1;

    }

    else

    {

    FMI->CR &= FMI_WRITE_WAIT_STATE_0;

    }

    /* Write a write flash configuration register command */

    *(vu16 *)0x80000 = 0x60;

    /* Configure the flash configuration register */

    *(vu16 *)(0x80000|FMI_ReadWaitState|FMI_PWD|FMI_LVDEN|FMI_FreqRange) = 0x03;

    }

    It works either booting from Bank0 or Bank1.

    I wish the software library from ST will be soon updated.

    miluk

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:43

    Most likely you have overlooked, that boot and non-boot banks have exchanged places.

    In Keil it is necessary to correct Flash Configuration Register initialization:

    ; Write ''Write flash configuration'' command (60h)

    LDR R0, =FMI_BBADR_Val ;

    MOV R1, #0x60

    STRH R1, [R0, #0]

    ; Write ''Write flash configuration confirm'' command (03h)

    LDR R2, =(FLASH_CFG_Val:SHL:2)

    ADD R0, R0, R2

    MOV R1, #0x03

    STRH R1, [R0, #0]

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:43

    I apologize to ST, the reason for not functioning the FMI_Config was due to wrong configuration of my ST library, not the bug in the library itself.

    I'm using RIDE and have selected the using of ST libraries (STRx-LIB).

    The library is probably compiled for booting from Bank0 and when booting from Bank1 the FMI_Config hangs.

    k_arthurAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:43

    Hi AlexandrY,

    Please answer me.

    I also think that this is the exactly the problem.

    But in my aplication that must be downloaded via bootloader

    i disable the Flash Memory Interface (FMI) option because i use

    software remaping before jump to aplication. That is why

    this line : LDR R0, =FMI_BBADR_Val ;

    not compatible

    i prefer to use it in such way. Is there any way not to disable

    Flash Memory Interface (FMI) option ? And to use it exactly

    as you wrote.

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:43

    My programs perfectly work on 96 MHz without disabling EMI check box in Keil startup both in the loader and in an application.

    I have written the loading program using an example from ST but without use of their libraries.

    However procedures of work with FLASH in my program are executed from RAM