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.

Can I write to flash data area using the BSL scripter?

Hello,

The BSL_scripter program takes up to 2 minutes to burn our current FW into our watches.

The watches are based on the EZ-430 Chronos model and use MSP4307623.

When the watches are reset after the FW burning, the time shown is usually 2 minutes before the actual time, though sometimes the time gets changed altogether.

I would like the BSL_scripter to save the PC date/time to the flash (in data area) after burning the FW. Then when the watch is reset with the new FW, its time and date will be correct.

Is this possible?

Please let me know.

Below is the code within the FW that updates the date/time on the flash.

Thanks,

Mechi


#define FLASH_BASE                     __MSP430_BASEADDRESS_FLASH__  // 0x0140 in the MSP4307623

#define FLASH_DATE_START       INFOB_START  // defined as 0x1900

currentTime is a Calendar struct from rtc_c.h:

             typedef struct {

uint8_t Seconds;
uint8_t Minutes;
uint8_t Hours;
uint8_t DayOfWeek;
uint8_t DayOfMonth;
uint8_t Month;
uint16_t Year;

} Calendar;

void flashSaveDate()

{
     uint16_t status;

     //Erase DATE area
     do
     {
              FLASH_segmentErase(FLASH_BASE, (uint8_t *)FLASH_DATE_START);
              status = FLASH_eraseCheck(FLASH_BASE, (uint8_t *)FLASH_DATE_START, NUMBER_OF_BYTES);
      } while (status == STATUS_FAIL);

      //Flash Write
      FLASH_write8(FLASH_BASE, (uint8_t *)&currentTime, (uint8_t *)FLASH_DATE_START, sizeof(currentTime));

}

  • After uploading the new firmware, you could run the scripter again with a dynamically created file that puts the current time into a certain memory location, before starting the firmware.

  • Hello Jens-Michael,

    Thanks for letting me know this.

    Above I gave the address and struct that I'd like to write to the flash.

    Can you please tell me how to go about doing this? 

    Is this before the BOR.txt is activated? Below is the script for the BSL_Scripter and the BOR.txt I've been using.

    Do I write a file similar to BOR.txt with an address? How do I do this?

    Thanks again,

    Mechi

    BOR.txt

    @120
    04 A5
    q

    ScriptShotMaxxFw_COM4.txt

    MODE 6xx COM4
    VERBOSE
    MASS_ERASE
    RX_PASSWORD
    RX_DATA_BLOCK ShotMaxxFw.txt
    DELAY 2000
    RX_DATA_BLOCK_FAST BOR.txt

     

  • Mechi Fendel said:
    Do I write a file similar to BOR.txt with an address?

    exactly.

    The generated file should look like this:

    TIME.txt

    @1900
    SS MM HH DW DM MM yy YY
    q

    The file needs to be generated immediately before the scripter is called. And the script needs the have a line
    RX_DATA_BLOCK TIME.txt
    right after writing ShotMaxxFw.txx.

    Since the time isn't set before the MSP is actually restarted, the total programming time should be considered when generating time.txt.

  • Thanks again for the timely and detailed answer.

    Mechi

**Attention** This is a public forum