This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Hardware reset

lpc1768 board or the MCB1700

does anybody know how to switch bins files using the hardware reset route, so when I press the reset button it will switch bins.

I know for software it could be something like this perharps

<

>
int main (void)
{
for (;;)
If

extern "C" void lpc1768_reset();

flash.write = binfile1

else

flash.write = binfile2

endif


}

<

>

thanks,

thomas

Parents
  • What "your business"? This is a forum for end users. We who write here are Keil customers - not Keil employees.

    By the way - post after post after post and you finally managed to mention mbed. Shouldn't mbed have been the first thing mentioned in your original post? How would anyone on this forum be able to answer any single question about mbed if you don't even tell that you do work with an mbed product?

Reply
  • What "your business"? This is a forum for end users. We who write here are Keil customers - not Keil employees.

    By the way - post after post after post and you finally managed to mention mbed. Shouldn't mbed have been the first thing mentioned in your original post? How would anyone on this forum be able to answer any single question about mbed if you don't even tell that you do work with an mbed product?

Children
  • Who the hell is Peter Jones? Why should we care? WTF!?

  • see you on mars later
    won't be there women are from Venus :)

    Erik

  • Well I have so many stars to choose from I am spoiled for choice, I heard lyran's women think your all annoying and never very professional in the forum what so ever:) like kindergarten children.

    I found code anyway

    #include "mbed.h"
     #include "rename.h"
     #include "ConfigFile.h"
    
    
     LocalFileSystem local("local");             // Create the local filesystem under the name "local"
     ConfigFile cfg;
     int lastStat;
      int main(void) {
    
        /*
         * Read a configuration file from a mbed.
         */
        cfg.read("/local/lastStat.cfg");
    
        * Read a configuration value.
         */
        if (cfg.getValue(key1, &value[0], sizeof(value))) {
    
    
    
    
    if (lastStat.cfg == 1) {  cfg.write("/local/lastStat.cfg", "0");
    
    } else {
     cfg.write("/local/lastStat.cfg", "1");
    }
    
    if (lastStat.cfg == 1) {  file_rename("/local/Test.bin", "/local/new_name.old");}
    
    if (lastStat.cfg == 0) {  file_rename("/local/new_name.old", "/local/Test.bin");}
    
    
    
    
    // int main() {
    
      //FILE *fp = fopen("/local/Test.txt", "w");  // Open "out.txt" on the local file system for writing
       // fprintf(fp, "Hello World!");
        //fclose(fp);
         //file_rename("/local/Test.bin", "/local/new_name.old");
    
    
    
        }
    

    and you all lied about the time stamp as well, http://www.keil.com/support/man/docs/rlarm/rlarm_lib_rl_time.htm

    FRESULT set_timestamp (
        char *obj,     <span>/* Pointer to the file name */</span>
        int year,
        int month,
        int mday,
        int hour,
        int min,
        int sec
    )
    {
        FILINFO fno;
    
        fno.fdate = (WORD)(((year - 1980) * 512U) | month * 32U | mday);
        fno.ftime = (WORD)(hour * 2048U | min * 32U | sec / 2U);
    
        return f_utime(obj, &fno);
    
    

    Maybe you should all talk in code instead of the stupid comments you always make.

  • I found code anyway
    so that was what it was about, you wanted us to do it for you.

    Erik

  • Congratulations sweetheart, you were given a real pearl. Enjoy from it while you can.

  • A standard MCB1700 board do not contain any file system unless someone have added such software
    to the board. And it is then that specific implementation that controls how to access files.
    

    How many times did we ask you to supply specific information about what software you did run, since the processor itself don't have any file system?

  • would any of you know how to detect when the mbed's hardware reset button has been pushed, so I can then use that to trigger a copy rename and delete of my bin file.

    I have the code for a software reset and plan to use an external push button to that if I can not figure out how to do above.

    I have a blue reset button on my MCB1700 as well I don't mind using that one if you prefer

    <

    >
    NVIC_SystemReset()
    
    #define NVIC_SYSRESETREQ            2         /*!< System Reset Request         */
    #define NVIC_AIRCR_VECTKEY    (0x5FA << 16)   /*!< AIRCR Key for write access   */
    
    static __INLINE void NVIC_SystemReset(void)
    {
      SCB->AIRCR  = (NVIC_AIRCR_VECTKEY | (1<<NVIC_SYSRESETREQ));                          /* Keep priority group unchanged */
      asm("DSB");
      while(1);                                                                            /* wait until reset */
    }
    <
    

    >

    <

    >
    
    /**
     * @brief  Initiate a system reset request.
     *
     * Initiate a system reset request to reset the MCU
     */
    static __INLINE void NVIC_SystemReset(void)
    {
      SCB->AIRCR  = ((0x5FA << SCB_AIRCR_VECTKEY_Pos)      |
                     (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
                     SCB_AIRCR_SYSRESETREQ_Msk);                   /* Keep priority group unchanged */
      __DSB();                                                     /* Ensure completion of memory access */
      while(1);                                                    /* wait until reset */
    }
    
    /*@}*/ /* end of group CMSIS_CM3_Core_FunctionInterface */
    
    <
    

    >