2007-04-12 12:15 AM
Bootloader: Main App not running after system reset
2011-05-17 12:39 AM
Hello Gager,
I suppose that you are using the IAP via UART provided by ST. If this is the case, so the behavior you are observing is normal and considered as a limitation. Please find below the root cause of the observed behavior: ---------------------------------------------------------- As you know, in the STR91x, there are two types of reset generated internally, defined as System Reset (such as the Hardware reset using a push button) and Global Reset (such as Power On reset). A global reset sets all the registers to their reset values whereas a system reset sets all registers to their reset values EXCEPT the Clock control register (SCU_CLKCNTR), PLL configuration register (SCU_PLLCONF), System status register (SCU_SYSSTATUS) and the FMI Bank address and Bank size registers. When the Bank0 and the Bank1 are hardware remapped using CAPS tool, the FMI bank addresses become 0x80000 for Bank0 (Non Boot bank) and 0x00 for Bank1 (Boot bank). As you know, before jumping to the user application, software remapping of Bank0 and Bank1 at 0x00 and 0x80000, respectively, is performed. Apparently, if a hardware reset is applied, the FMI Bank address and Bank size registers will keep the last values (corresponding to this software remapping), i.e. Bank1 base address is 0x80000 and Bank0 base address is 0x00. Consequently, a boot from bank1, where the IAP driver is loaded, is not possible: the IAP driver will not be executed: neither the IAP menu will be displayed on the HyperTerminal (even the Joystick button is at ‘Right’ position) nor a jump to the user application will be performed. At this moment, a Power On reset should be used to reset the FMI Bank address and Bank size registers in order to be able to boot from the Bank1 to re-execute the IAP driver. This analysis can be confirmed by the following: If the software remapping is suppressed from the IAP software and simply a jump to address 0x80000 is performed to execute the user application, there is no problem and the driver behaves normally when a Hardware Reset is applied. Just to remind: The software remapping of Bank0 at address 0x00 and Bank1 at address 0x80000 in the IAP driver is mandatory because the user application may use interrupts. Hope this was clear. Please let me know if you have further questions. Regards, Najoua.2011-05-17 12:39 AM
Hi,
When My Bootloader jump to MainApp, MainApp works fine, but when i use ResetButton MainApp don't starting and I must switching power off/power on on My DevBoard. MLCK is 25 Mhz.2011-05-17 12:39 AM
Hmm.
Yes I know about limitation in STR9, I read errata. But my App still hang-off after I use ResetButton. After ResetButton CPU don't jump in IAP and don't jump in MyApp section. I use ST project AN2475, and this project also don't work correctly and after I use ResetButton CPU hang-off2011-05-17 12:39 AM
Hello again gajer,
I think there is a misunderstanding. The limitation I am speaking about is not mentioned in the STR91x erratasheet. This limitation is STR91x IAP driver related: the fact of having a problem with IAP when pressing the Reset push button is normal (explanation is described in my previous answer) and a Power On Reset should be applied instead of a Hardware Reset when using IAP driver. Please let me know if the explanation was no clear enough. Regards, Najoua.2011-05-17 12:39 AM
2011-05-17 12:39 AM
>Because after software (or watchod) reset FMI register ''do not change''
>then after reset, CPU jump to address 0x00 whitch means, run >application from bank 0 because bank 0 is software remaping from address >0x80000 to address 0x00. --> There is one thing to be verified: Verifiy if FMI registers: ** do not change at all after a system reset and they keep the last values(corresponding the the software remapping). In this case, the application in Bank0 should execute without problems even after a hardware reset. OR ** are modified without keeping the last values corresponding to the software remapping (and are not reset to their default values corresponding to the hardware remapping using CAPS). I will check this point and keep you informed. Best regards, Najoua. [ This message was edited by: Najoua on 14-03-2007 11:46 ]2011-05-17 12:39 AM
Hello gajer,
As I told you, this is a normal behavior. You said that ''you want to boot from Bank 0 after reset'' but this is not possible using the IAP driver provided by ST. The IAP driver is located in Bank1 hardware remapped at address 0x00 using CAPS tool. The IAP driver main program has the following structure: void main(void) { /* If Joystick position is 'Right' */ if (Push_Button_Read() == 0x60) { /* Execute the IAP driver in order to re-program the Flash */ } else { /* Keep the user application running */ } while (1); } So, to be able to run the user application located in Bank0 after reset, a boot from Bank1 (and not from bank0) is MANDATORY because the jump to the user application in Bank0 is done from Bank1. After software remapping, using a hardware reset, a Boot from Bank1 is not possible(as I had already explained) ,that's why the user application in Bank0 will not be executed after a hardware reset: a Power On reset should be applied to recover the FMI Bank address and Bank size registers' values(Bank1 and Bank0 mapped respectively at 0x00 and 0x80000 respectively). If your application doesn't use interrupts, the software remapping of both Banks is unuseful and a jump to address 0x80000 should be performed.The 'void StartUserApplication(void)' routine becomes: void StartUserApplication(void) { void (*StartApp)(void); StartApp = (void *) 0x80000; StartApp(); } In this case, the behavior will be normal, i.e the user application will be executed successfully after applying a Hardware reset. Just a remark: Are you using the STR91x IAP driver provided by ST. I noticed that you are using different routine name 'StartUserApplication' instead of 'Execute_STR9Application' etc... Hope this answers your question. Kind regards, Najoua. [ This message was edited by: Najoua on 14-03-2007 10:05 ]2011-05-17 12:39 AM
2011-05-17 12:39 AM