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.

MSP430F5419A firmware update from main programe over i2c interface.

Other Parts Discussed in Thread: MSP430F5419A, MSP-FET

Hi ,

I am trying to implement a firmware update in msp430F5419A over i2c . I have gone through several blogs and online material over couple of weeks but as of now I haven't progress much. I am looking for some starting point . Totally new to MSP . I will appreciate any help . 

Thanks a lot!!

  • Hi Dhruvalkumar Patel,

    Have you seen the following Application Reports?

    www.ti.com/.../slaa450c.pdf
    www.ti.com/.../slaa600a.pdf

    MSPBoot would be particularly useful for creating a main-memory bootloader using I2C. I would start by getting the demo applications to work and then move towards porting from the available device examples to a MSP430F5419A.

    Regards,
    Ryan
  • Hi Dhruvalkumar,

     

    Ryan makes a good point about MSPBoot, but in this case, since you are using F5xx, I would actually recommend you to use BSL.

    The Bootstrap loader (aka BSL) of MSP430F5xx resides in flash and it can be pre-programmed and customized according to your needs.

    Some benefits include: residing in a reserved and protected memory location which is not erased with a mass erase, it's more difficult to execute it unintentionally, it's independent of the reset and interrupt vectors (so, you don't need vector relocation). The biggest disadvantage is that it's limited to 2KB (but it should be enough for I2C).

     

    SLAU319 (http://www.ti.com/lit/slau319) describes the default BSL in F5xx (in section 3), but please note that the default BSL in F5419A is UART-based. You might still find it useful to understand the protocol, entry sequence, etc. 

    SLAA450 (mentioned by Ryan) describes how to customize the BSL. In summary, I recommend you to follow the next steps:

    1. Download the CUSTOM-BSL430 software available here: http://www.ti.com/tool/mspbsl

    2. Try building the default UART BSL.

    2.1) Note that you need IAR but you can use the free version since the code is <2KB. 

    2.2) Open 5xx_6xx_BSL_Source\BSLs.eww workspace. Then open & build the MSP430F543xA_TA_UART project.

    3) Optionally, download and try the UART BSL to get familiar with it

    3.1) You can use BSL Scripter as your host tool to send the application from the PC to the device

    3.2) You can use something like the "BSL Rocket" (https://www.olimex.com/Products/MSP430/BSL/MSP430-BSL/) or the MSP-FET as your physical interface. Please note that these tools support both UART and I2C.

    4) Modify the project to use I2C instead of UART

    4.1) The project has a BSL430_PI_TA.c file which supports UART communication. You need to modify/replace this file.

    4.2) The same BSL software package has a file supporting I2C in 5xx_6xx_BSL_Source\Peripheral_Interfaces\USCIB_I2C\BSL430_PI_USCIB_I2C.c

    4.3) The file is being used for a different device (F522x). However, since the F5419A has the same USCI, you should be able to use it.

    4.4) Make sure you use the correct SDA/SCL pins, though

    5) Try the I2C BSL similarly to step #3

     

    Regards,

    Luis R

  • Thanks Luis and Ryan for quick update . I am looking into the links and documents suggested by you. How can I invoke a BSL from host (linux system) if it's only interface is over I2C and no other target pins are connected with host (such as /RESET ). Another question is my current firmware image is 37kb  and I have 128kb of flash . Is it possible to just copy the firmware image into remaining free memory and than force the MCU to execute fromthere. I am just asking it out of the box , may be completely wrong.

  • By default, the BSL can be invoked by the hardware sequence (TEST & RESET), or by software (check Section 3.8.1 of SLAU319).
    In order to use the software invoke, you need to have a working application already on the device. The application can check for a particular sequence or command, and then force BSL by jumping to 0x1000. You'l have to implement this feature in your application.

    Now, it's important to remark that the device will always execute BSL after a BOR reset and the first function executed is "BSL_Protect" which is in BSL430_Low_Level_Init.s43. This file is in assembly, but you can modify it as needed if you need a different entry sequence.
    For example, the following line checks for the hardware entry sequence:
    bit #SYSBSLIND,&SYSCTL ;check for BSL start request

    By modifying this file, you can implement other entry mechanisms, such as: checking if the reset vector is blank (so that the device stays in BSL instead of jumping to application when blank); checking for a different GPIO; or more complicated things like validating the application through a CRC, etc.


    Regarding your second question: you can put your application wherever you want in the whole memory, but the question is whether or not the MSP430 will execute the code properly.
    You will always build your application with a particular linker file which will place the application in a particular memory location (for example, F000-FFFF). If you download the image to this area, you expect the application to work.
    However, if you download the same image to 0xE000-0xEFFF, then it won't work for 2 reasons: 1) the vector/interrupt table is always located in the top of 16-bit memory; and 2) if the compiler doesn't support "Position Independent Code", then the application won't probably run correctly.

    Now, if you change the linker file to use a different memory location (0xE000-0xEFFF, but keeping interrupt vectors in top of memory), then you'll be able to download and run the image.

    Regards,
    Luis R

**Attention** This is a public forum