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

Bootloader to Application switching troubles ....

Hello,

I have a home-made bootloader on a lpc2378 that upgrade the firmware
from a SD card. It works well except there's some troubles that
appears when the application is launched.

The interrupt vectors seem to be well remapped to RAM, since the
software part that used interrupts are OK.
But , I have trouble with the UART for example : no or random
characters are sent. I seems like there's troubles with the clock
settings.

Is there particular points to consider when you set the clock
controller twice ? (at the boot time and in the startup of the
application)

Thanks in advance !

  • In fact , for testing example, the application is the blinky example from keil .

    There's ADC measures made by interrupts and displayed on the led bargraph and on the lcd screen. Moreover, every one second (timer interrupt) the value is send on a 9600 baud rs232.

    Sometimes the application is launched well : all is ok , I have the values displayed on the lcd, the serial line, and the led.

    But when it failed , the startup screen of the LCD is displayed, the first value of the ADC is displayed on the bargraph. But after there's no more update of the LCD bargraph.
    BUT the led bargraph is always ok ! Oo

    here's the interresting part of the main code (the ADC and LED displaying is under interrupt)

      lcd_init();
      lcd_clear();
      lcd_print ("  MCB2300 DEMO  ");
      set_cursor (0, 1);
      lcd_print ("  http://www.keil.com  ");
    
      for (i = 0; i < 20000000; i++);       /* Wait for initial display           */
    
      while (1) {                           /* Loop forever                       */
        AD_value = AD_last;                 /* Read AD_last value                 */
        if (AD_value != AD_last)            /* Make sure that AD interrupt did    */
          AD_value = AD_last;               /* not interfere with value reading   */
        AD_print  = AD_value;               /* Get unscaled value for printout    */
        AD_value /= 13;                     /* Scale to AD_Value to 0 - 78        */
        if (AD_old != AD_value)  {          /* If AD value has changed            */
          AD_old = AD_value;
          Disp_Bargraph(0, 1, AD_value);    /* Display bargraph according to AD   */
        }
        if (clock_1s) {
          clock_1s = 0;
          printf ("AD value = 0x%03x\n\r", AD_print);
        }
      }
    

  • Is there particular points to consider when you set the clock controller twice ?

    I'm not sure if you mean the RTC, a timer or the baudrate generator when you write "the clock controller".

    However, the normal action when reconfiguring a device is to first disable it, then give it new settings and finally reactivate it. It is easy to forget to deactivate the device, since a lot of example code assumes a first-time configuration, i.e. that the device is in the default state after a processor reset.

  • Maybe you can drive one of the LEDs with the clock that your suspect?

  • Thanks for the tips.
    After some debug, the clock is not the source of the trouble but the UART is !

    the sendchar-) function used is not under interrupt but use a flag that wait for a bit . And that flag is never set ...
    In fact, when the bootloader start , it sets the UART1,
    does it job and when the application is launched the UART1 is re-configured. And it's here there's something wrong .
    I have to do a particular process to deactivate the UART1 in the bootloader before launching the app.
    But I realla don't know why and how :)

  • good work. I had a feeling it was not the clock...