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.

CCS/MSP430FR6989: CCS/MSP430FR6989:

Part Number: MSP430FR6989
Other Parts Discussed in Thread: REP430F, MSP430F5437, MSP430G2553, MSPBSL, MSP430F5529, MSP-EXP430F5529LP, MSP-EXP430FR6989, MSP430F5659, MSP-GANG

Tool/software: Code Composer Studio

Hi

I'm trying to creat a replicator from msp430fr6989 launchpad (host side) to ms430g2553 launchpad as a target.

I'm following the instructios from slau320z document and it's attached project slau320y.zip (in chapter 2). 

From some reason the program get's trapped a this function, void SetVCoreUp (word level),  LowLevelFunc430X.c  .

The function  call: SetVCoreUp (2);

void SetVCoreUp (word level)
{
// Open PMM registers for write access
PMMCTL0_H = 0xA5;
// Set SVS/SVM high side new level
SVSMHCTL = SVSHE + SVSHRVL0 * level + SVMHE + SVSMHRRL0 * level;
// Set SVM low side to new level
SVSMLCTL = SVSLE + SVMLE + SVSMLRRL0 * level;


// Wait till SVM is settled
while ((PMMIFG & SVSMLDLYIFG) == 0);


// Clear already set flags

PMMIFG &= ~(SVMLVLRIFG + SVMLIFG);
// Set VCore to new level
PMMCTL0_L = PMMCOREV0 * level;
// Wait till new level reached
if ((PMMIFG & SVMLIFG))
while ((PMMIFG & SVMLVLRIFG) == 0);
// Set SVS/SVM low side to new level
SVSMLCTL = SVSLE + SVSLRVL0 * level + SVMLE + SVSMLRRL0 * level;
// Lock PMM registers for write access
PMMCTL0_H = 0x00;
}

This is the loop  in which the program get's trapped:

// Wait till SVM is settled
while ((PMMIFG & SVSMLDLYIFG) == 0);

 

Thanks in advance,

Avraham

  • Hi Avraham,

    Thanks for posting. The code that you have posted refers to PMM registers and settings in the MSP430F5xx/6xx flash devices. However, the MSP430FR5xx/6xx FRAM devices, like the MSP430FR6989 you are using, have a totally different PMM module that does not have the same registers and bits. The replicator code you are building is written for the REP430F board with the MSP430F5437 device, which is from a different device family and is not 100% code-compatible with the MSP430FR6989 device you are using (they have different core modules like clock system and the PMM, even though other modules like the timers are compatible). I'm surprised if the replicator code builds without errors for MSP430FR6989 - did you change the device in the project settings to MSP430FR6989? There would then be a significant code porting effort needed to port the replicator code to this FRAM device.
     
    Additionally, could you share your reason for needing to implement the replicator code on the MSP430FR6989 to program the MSP430G2553? The MSP430G2553 Launchpad already includes an on-board emulator. Or, if you are needing this as an example for field firmware updates, generally it is simpler to implement the BSL bootloader host for the MSP430G2553 as this is based on a simple UART interface, rather than complex JTAG/SBW programming. I would recommend BSL if at all possible for your application. There is more information on the MSPBSL tool folder and in the BSL user's guide document www.ti.com/.../slau319

    Regards,
    Katie

  • Dear Katie
    Thanks for the detailed replay and sorry on the delay in mine response.
    My goal is to create a similar device to the msp430 REP in order to flash msp430g2553 mcu without pc host.
    I was uder the impression that the jtag interface is more ideal for this purpose but since i have no need in debugging the mcu, i will try out your suggestion and check the BSL interface option.
    I will probebly seek for guidance soon : )
    Best regards,
    Avraham
  • Hi Katie

    I have recently ordered and received msp430f5529 lp.
    I assumed that it woulde be esaier to adjust the msp430 replicator code (from slau320y.zip) to it and use it as host for flashing the msp430g2553 (as i have posted before).
    And yet i'm struggling a lot to do so.
    I'm using CCS V6.2 and the replicator430 (for original MSP430 architecture devises) code.
    I intend to use SBW connections between host (msp430f5529lp) and the target (msp430g2553).
    The current situation is that the program gets trapped at the the InitController(void) function at the

    loop --->// Loop until XT1,XT2 & DCO stabilizes

    //! \brief Initialization of the Controller Board
    void InitController(void)
    {
    // Stop watchdog timer to prevent time out reset
    WDTCTL = WDTPW + WDTHOLD;

    // Set higher Vcoree, to be able to handle the MCLK freq = 18 MHz
    SetVCoreUp( 2 );

    //****** set XT1 clock - crystal 12 MHz **********

    // P7SEL = 3; // Port select XT1
    P5SEL |= BIT4+BIT5; // Port select XT1
    UCSCTL5 = 0; // DIVPA, DIVA, DIVS, DIVM -> all direct (DIV=1)
    UCSCTL6 = XT2OFF+XT1DRIVE_1+XTS;
    // XT2 OFF, XT1-ON
    // Drive strength - 8-16MHz LFXT1 HF mode


    // Loop until XT1,XT2 & DCO stabilizes
    do{
    // Clear XT2,XT1,DCO fault flags
    UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
    // Clear fault flags
    SFRIFG1 &= ~OFIFG;
    }while( SFRIFG1 & OFIFG );



    // Select ACLK = LFXT1 = 12MHz
    // SMCLK = LFXT1 = 12MHz
    // MCLK = LFXT1 = 12MHz
    UCSCTL4 = SELA_0+SELS_0+SELM_0;

    #ifdef MCLK_18MHZ
    // DCO-freq range up to min 39MHz (must be higher then 18MHz*2 = 36 MHz)
    UCSCTL1 = 6*DCORSEL0_L;
    // DCO-DIV/2, PLL MULTI*(23+1), freq = 24*0.75 = 18 MHz
    UCSCTL2 = FLLD0 + 23*FLLN0;
    // Reference - XT1-CLK, XT1/16 = 0.75MHz
    UCSCTL3 = FLLREFDIV_5;
    // Loop until XT1,XT2 & DCO stabilizes
    do{
    // Clear XT2,XT1,DCO fault flags
    UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
    // Clear fault flags
    SFRIFG1 &= ~OFIFG;
    }while( SFRIFG1 & OFIFG );

    UCSCTL4 = SELA__XT1CLK + SELS__DCOCLKDIV + SELM__DCOCLKDIV;
    #endif

    // Setup timer_A for hardware delay
    TA0CTL = 0; // STOP Timer
    TA0CTL = ID_3+TASSEL_1; // Timer_A source: ACLK/8 = 1.5 MHz
    TA0CCR0 = ONEMS; // Load CCR0 with delay... (1ms delay)

    //****** clock setup is done **********

    #if(0) // can be enabled for test /debug
    // SMCLK (18 or 12 MHz) freq test on the S1 switch (open) - test time ~ 10ms
    P1SEL = 0x40; // SMCLK - to P1.6 (S1 - button)
    P1DIR = 0x40; // for clk test only - must be disabled later
    MsDelay( 5 );

    P1SEL = 0;
    // END OF SMCLK freq test on the S1 switch
    #endif

    TRSLDIR = 0;
    // set port to output from MSPF5437 to I/O translators
    TRSL_CDIR = TEST_DIR + RST_DIR + TCK_DIR + TMS_DIR + TDOI_DIR + TDI_DIR;
    // set all directions from I/O translators to MSP430F5437
    // (all I/O JTAG lines to input)
    TRSLDIR = TEST_DIR + RST_DIR + TCK_DIR + TMS_DIR + TDOI_DIR + TDI_DIR;

    // set LED ports direction
    LED_DIR |= LED_YELLOW+LED_GREEN+LED_RED;
    // TURN-ON all LEDs at the startup
    LED_OUT |= LED_YELLOW+LED_GREEN+LED_RED;

    // set SW ports pull-ups
    SW_PULLUP |= SW_MODE0+SW_MODE1+SW_1; // set pull-up/pull-down
    SW_OUT |= SW_MODE0+SW_MODE1+SW_1; // select pull-up

    SetTargetVcc (0);
    SetVpp( 0 );
    }



    i have configured the XT1 crystal to the msp430f5529 lp
    // P7SEL = 3; // Port select XT1
    P5SEL |= BIT4+BIT5; // Port select XT1

    I hope we will find a way to implement this program in to this mcu (msp430f5529) since it's highly importent for our App.

    thanks in advance
    Avraham
  • Hi Avraham,

    The code that you are using appears to select XT1 for high frequency crystal at 12MHz. If you are using the MSP430F5529 Launchpad, looking at the schematic included in the user's guide www.ti.com/lit/pdf/slau533, that has a low frequency 32kHz crystal on XT1. So this would be why there is a crystal fault showing up. Looking at the MSP430F5529 device, XT1 doesn't support high-frequency crystals on this device. To keep using the MSP-EXP430F5529LP Launchpad I'd recommend simply changing the clock initialization code.

    The clock initialization code should be changed. Because the replicator code is very frequency dependent, likely you should keep the 12 or 18MHz MCLK speed that it is expecting. You could change the code to init the DCO + FLL to 12MHz MCLK with FLL referenced off of the low speed 32kHz on XT1. Or, you could reference the FLL off of the 4MHz ceramic resonator that is populated on the Launchpad on XT2. Because that's only 4MHz you'd have to still use code to set the DCO + FLL to 12MHz, referenced off of the 4MHz.

    The code example http://dev.ti.com/tirex/#/?link=Software%2FMSP430Ware%2FDevices%2FMSP430F5XX_6XX%2FMSP430F5529%2FPeripheral%20Examples%2FRegister%20Level%2FMSP430F55xx_UCS_03.c includes code for setting the DCO to 12MHz. That code references the FLL off the internal 32kHz REFO, but since you have XT1 populated you may want to use it instead for the FLL for potentially a more accurate clock. You could also use Driverlib instead, or base your code off of the UCS_initFLLSettle function from driverlib:

    I hope this helps to give you some ideas for a path forward.

    Regards,

    Katie

  • HI Katie

    Thanks alot for your quick and detailed response i very grateful for it.
    I will try to change the code (according to your advices) and i will get in to it right away.
    I just want to confirm with you one more thing.
    Is my assumption regarding to the implementation of the Replicator code to the msp420lp correct?
    Because i cant find any reason why not .
    I will update soon...
    Thank again,

    Avraham
  • my assumption is regarding to the implementation of the Replicator code to the msp430f5529 lp (not msp420lp)...
  • hi

    i just want to currect katie`s comment:  On Msp430F5529  - XT1 - DOES NOT support high frequency crystal,  ONLY XT2

    thanks

    avi

  • Hi Avi,

    Thanks for the correction. I was thinking generally of F5xx/6xx family devices, some of which can support high frequency crystal on XT1, but you are correct now that I check F5529 datasheet specifically only supports low frequency on XT1. I will update my original post so it is more clear for people reading this thread.

    Regards,

    Katie

  • Hi Avraham,

    I'm not sure which assumption you are referring to. Are you asking if it is easier to port the Replicator code to the MSP-EXP430F5529LP than to the MSP-EXP430FR6989? It will probably be easier since the code was originally written for the MSP430F5437 device which is in the same family as MSP430F5529, so they have similar clock system, PMM modules, etc. However, you will still have to make some clock initialization changes as you have found, and likely some changes of what port pins are used etc.

    Regards,
    Katie
  • Katie,

    is there any similar code as the replicator but only for 2 wire (SBW) only, more simple code. we also would like to use a host controller as a programmer of multiple msp430g2553 devices.

    it would be great if u fimiliar with that . our future host MCU will be MSP430F5659 / or similar

    our project will require a large qty`s of your products.

    thanks
    avi
  • Hi Avi,

    As I mentioned earlier in my first post, the replicator SBW code itself (even if it was just implementing SBW) is quite complicated because it is muxing 3 JTAG signals onto a single bi-directional communication line via time-division multiplexing - it gets very time sensitive and it is essentially bit-banging the signals. I would strongly recommend bootloader BSL as a preferable programming solution instead, because it is very simply a list of commands implemented on top of a basic 9600 baud UART interface. There is more information about the MSP430G2553 BSL found in the BSL User's Guide www.ti.com/.../slau319 and that should include all of the information you would need to create a host interface for G2553. You just have to generate the entry sequence, and then the rest is all commands over UART as described in the document.

    Regards,
    Katie
  • Also, are you aware of the MSP-GANG programmer tool which can program up to 8 MSP430s stand-alone (doesn't have to be connected to PC)? If you simply need a production programming solution, perhaps this would be better supported than having to create your own.
    -Katie
  • Katie,

    you have to understand better out project. i am not looking to build a tool for a production line - that`s why MSP-GANG is irrelevant.

    we have a system that have 8 devices. each device is controlled by msp430g2553. we are building a device (backplane host controller) that will act as a datalogger , event logger , and more. we want to be able to upload a binary.txt file of a firmware that related to the MSP430G2553 devices and the host controller will update the msp430G2553 devices one by one. we do not have a timing issue. we just want to able to flash the msp430g2553 devices from a main host location.

    please advice as much as possible.

    thanks
    avi

  • HI Katie

    I read the slau319 and other guides (including the threds in the e2e support) as well and i have a few questions in order to complete our costum programmer project for the msp430g2553 .
    In order to program the msp430g2553 MCU via BSL, as i uderstood, i can only use custum BSL methode.
    First i need to program the target with the BSL commands in to its flash memory (since i cant invok the BSL in MSP430G2553 ROM) , than to Invoked it externally (from the host) by the correct BSL sequence and than program my desired code to the available flash memory (alongside with the BSL commands for the next programming)?
    Am i the first one to creat such a project or is there anything similar to it that i can costumize somehow to our goals?

    Thanks for all the attention,
    Best regards,
    Avraham
  • Hi Avraham,

    You should not have to create a custom bootloader for the G2 device, you will only have to create the host software that talks to the ROM BSL that is already built-in to the device. You should be able to invoke the built-in ROM BSL on the MSP430G2553 if you use the correct sequence on TEST and RST pins. This sequence is described in the BSL user's guide www.ti.com/.../slau319 section 1.3 Standard RESET and BSL Entry Sequence. See the device datasheet www.ti.com/.../msp430g2553 section titled "Bootstrap Loader (BSL)" which explains which pins are used for BSL TX and RX on this device. The BSL user's guide SLAU319 explains in chapter 2 the protocol that you should follow for the G2xx device to implement a BSL host.

    There is PC software existing called BSLDEMO that is included in the BSL Scripter download (see the MSPBSL page) that includes source code. But that is written to run on a PC so it may not be the easiest to adapt. There is also included in the BSL Scripter Download, in the Deprecated folder once you unzip it, BSL Replicator code including documentation and source code.

    Regards,
    Katie
  • Katie,

    why there is no simple code example for bsl / uart that can simplified that - host controller and target controller flashing code.

    i am sure it was made in the past many times.

    please let me know if there is any.

    thanks!

  • Hi Avi,

    Please see the BSL Replicator included in the BSL Scripter download I mentioned in the post above - it really is only 1 c file so very simple. Additionally, I believe that someone from TI may have been working with your company off of the forum as well to provide you a more full-featured example already ported for the particular host controller you are using - can you check?

    Regards,
    Katie

**Attention** This is a public forum