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.

MSP432P401R: Invoke BSL via Software

Part Number: MSP432P401R

Hi,

i try to get the BSL running with invocation through my application software.

I got a board with a MAX3386E RS232 converter on it connected to eUSCI_A0. According to SLAU622G section 3.3.1 it's possible.

I've included the following code into my application software, which is called by a command over the serial connection.

#include "msp.h"
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>
...
#define BSL_PARAM 0xFC48DFFF // I2C slave address = 0x48, Interface selection = UART
//#define BSL_API_TABLE_ADDR 0x00202000 // Address of BSL API table
#define BSL_ENTRY_FUNCTION (*((uint32_t *)BSL_API_TABLE_ADDR))

...
main()
{
...
if (status & STATUS_BSL)
{
      status &= ~STATUS_BSL;
 
      MAP_Interrupt_disableMaster();
 
      NVIC->ICER[0] = 0xFFFF;
      NVIC->ICPR[0] = 0xFFFF;
      NVIC->ICER[1] = 0xFFFF;
      NVIC->ICPR[1] = 0xFFFF;

      ((void (*)())BSL_ENTRY_FUNCTION)((uint32_t)BSL_PARAM); // Call the BSL with given BSL parameters
}
...
}

When i now try to enter the BSL, the MCU leaves my application software ( doesn't respond to my commands on the serial) but the BSL_scripter can't establish a connection to the device. With a scope i can see the Signals comming from the Scripter, but no answer from the device.

When i use a brand-new MCU or a Device which got reset to factory defaults, it works.

The BSL_Scripter ist startet out of a cmd-window like the following

C:\EigeneDaten\Workspace_v7\Datenlogger\Debug>C:\EigeneDaten\Datenblaetter_u_sonstiges\MSP_Doku\MSPBSL_Scripter_win\BSL-Scripter.exe -d -g -n P4xx -i [COM1,UART,9600,PARITY] -b -z [RESET]
---------------------------------------------------------
BSL Scripter 3.3.0
PC software for BSL programming
2018-Apr-27 10:50:22
---------------------------------------------------------

Log mode is turned off!
C:\EigeneDaten\Datenblaetter_u_sonstiges\MSP_Doku\MSPBSL_Scripter_win\BSL-Scripter.exe -d -g -n P4xx -i [COM1,UART,9600,PARITY] -b -z [RESET]
Verbose is turned on!
Device : P4xx
Init communication parameters : [COM1,UART,9600,PARITY]
                [ERROR_MESSAGE]Initialization of P4xx BSL failed! Exit the scripter!

I got no idea left why it does not work correctly.

Regards

Thomas

  • Thomas,
    I do not see anything immediately that would suggest a reason for the error. Can you confirm that you are not erasing any portion of the information memory when you flash your application code to the device. In the case of a new part, that works, the default factory BSL is in place.

    Have you tried simply putting the BSL in AUTO instead of UART mode?

    There is a 10 second 'time out' in the bsl. How long is the delay between invocation and communication with the BSL?

    Regards,
    Chris
  • Hi Chris,

    the delay between invocation and communication with BSL is approximately 2 seconds.

    I also tried the auto-setting without any success.

    In the msp432p401r.cmd where all the Memorie-Sections are listet i only added 2 sections for data and config starting at 0x0003 B000 with a total length of 0x0000 4000.
    I didn't change anything at the section called INFO, where the BSL ist located.

    When i use memory browser and take a look at the adress of the BSL (0x0020 2000), it seems to be alright.

    Is there a possibility to Flash a clean new BSL into the device in case somehow something chnaged one byte in the BSL-Code?

    Regards,
    Thomas

  • THomas,
    The image and source code of the factory bsl can be found here: software-dl.ti.com/.../index_FDS.html

    Regards,
    Chris
  • Hi,

    after flashing the new BSL with uniflash, the scripter connects and transmits data. At the end i get an error.

    I'm a bit surprised that only 64532 bytes are written but my txt-file has 198kB. This would explain the CRC error but why does he stop after 64532 bytes?

    Regards,
    Thomas

  • As additional information:

    When i read the MCU with TX_DATA_BLOCK_32 starting at the adress 0x00e8 with a length of 64532 bytes, i get the correct code.

    When doing a CRC_CHECK_32 starting at 0x00e8 with a length of 16 bytes, the result is as expected.

    Another try with an intel-hex-file is also not working.

    Where can i readback the Size of my written firmware in css?

    Regards,
    Thomas

  • Comparing a TI-txt-file from an example with mine there is one difference
    at line 17 i got a second @-statement with the adress 0x0e8. In the Blink_LED.txt (BSL-Scripter zipfile Version 3.3.0) there is no second @-statement.

    Could it be that the error occures during the generation of my TI-Hexfile? Which settings should be checked?
  • Hi,

    i'm still trying to get the BSL working.

    Now i'm not able to flash any of my own programs to the mcu. A fresh programmed BSL with uniflash changes nothing. The blink.txt example works fine.

    I also tried to use the BSL with the MSP432 LaunchPad, which doesn't work also.

    I reduced my firmware to a minimum (Ti-TXT-file from 192kB reduced to 29kB) to verify that the size does not matter without any success. I get the same verification error and the firmware does not run.

    What must be considered in the settings of CCS?

    Regards,
    Thomas

    EDIT: May it help when i send the firmware-file to a TI-employee?

  • Hi,

    i now made up a complete new project in ccs7. This also works once with a new flashed bsl but then never again.

    I added the project to this post hoping someone can take a look...BSL_TEST.7z

    I'm hoping it's a little rookie error...

    Regards,
    Thomas

  • Thomas,

        I do not see any issue with you code, but I will ask a colleague to also look at it.  Can you also provide the script that the BSL scriptor is using as well as the .txt/.hex file that is being downloaded?  You mention that it works once with a newly flashed BSL, which leads me to believe that the BSL itself is being overwritten.  

    Also, can you explain the flow of the BSL update?  You have the code that you provided which invokes the BSL and then the firmware update takes place.  Does the firmware update contain another software BSL invocation which is not working?  Or are you reflashing the same program and then the software BSL invocation does not work.

        I will be able to run your code tomorrow with the blink LED example found in the BSL scripter and let you know if I am successful.   

    Regards,

    Chris 

  • Hello Thomas,

    I acknowledge this behaviour. There was a bug in 3.3.0 and been fixed in 3.4.0 that just released last week.

    It would be great if you could tested with the new version and let me know the result.

    http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPBSL_Scripter/3_04_00_01/index_FDS.html

  • Hello,

    this version does not work the same way the version 3.3.0. I took the simple example i posted befor and used the button on P1.1 to invoke the BSL on the launchpad. Within the 10s timeout i  started the scripter with the following command-line:

    BSL-Scripter.exe -d -n P4xx -i [COM2,UART,9600,PARITY] -b -w BSL_TEST.txt -v -z [RESET]

    This didn't work.

    I flashed a new BSL to the launchpad using uniflash and started the scripter the same way. This worked and the led P1.0 started to blink like programmed. i invoked the bsl on launchpad again (button P1.1) and started the scripter with the same parameters and it returned with an initialization error.

    Thsi is the ti-txt-file i try to flash into the mcu

    BSL_TEST.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    @0000
    00 00 01 20 33 0C 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 3F 0C 00 00
    3F 0C 00 00 00 00 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 0B 01 00 00
    3F 0C 00 00 3F 0C 00 00 3F 0C 00 00 3F 0C 00 00
    3F 0C 00 00 08 B5 C6 48 00 68 00 6A 01 46 C5 48
    88 47 C5 48 00 68 C0 68 01 21 02 46 01 20 90 47
    C2 49 08 68 40 1C 08 60 08 BD 08 B5 BE 48 00 68
    C0 68 01 21 02 46 02 20 90 47 BB 48 00 68 40 6B
    02 21 02 46 01 20 90 47 B9 49 04 20 08 70 08 BD
    08 B5 B5 48 00 68 00 68 FF 21 02 46 01 20 90 47
    B1 48 00 68 00 68 FF 21 02 46 02 20 90 47 AE 48
    00 68 00 68 FF 21 02 46 03 20 90 47 AA 48 00 68
    00 68 FF 21 02 46 04 20 90 47 A7 48 00 68 00 68
    FF 21 02 46 05 20 90 47 A3 48 00 68 00 68 7F 21
    02 46 06 20 90 47 A0 48 00 68 00 68 FF 21 02 46
    07 20 90 47 9C 48 00 68 00 68 FF 21 02 46 08 20
    90 47 99 48 00 68 00 68 FF 21 02 46 09 20 90 47
    95 48 00 68 00 68 FF 21 02 46 0A 20 90 47 92 48
    00 68 80 68 FF 21 02 46 01 20 90 47 8E 48 00 68
    80 68 FF 21 02 46 02 20 90 47 8B 48 00 68 80 68
    FF 21 02 46 03 20 90 47 87 48 00 68 80 68 FF 21
    02 46 04 20 90 47 84 48 00 68 80 68 FF 21 02 46
    05 20 90 47 80 48 00 68 80 68 FF 21 02 46 06 20
    90 47 7D 48 00 68 80 68 FF 21 02 46 07 20 90 47
    79 48 00 68 80 68 FF 21 02 46 08 20 90 47 76 48
    00 68 80 68 FF 21 02 46 09 20 90 47 72 48 00 68
    80 68 FF 21 02 46 0A 20 90 47 72 49 FF 20 08 80
    71 49 00 20 08 80 71 49 30 20 08 80 70 49 00 20
    08 80 69 48 00 68 C0 69 01 22 03 21 03 46 0B 20
    98 47 65 48 00 68 40 69 02 21 02 46 01 20 90 47
    61 48 00 68 40 6B 02 21 02 46 01 20 90 47 5E 48
    00 68 40 6A 02 21 01 22 03 46 01 20 98 47 5A 48
    00 68 80 6A 02 21 02 46 01 20 90 47 5D 48 00 68
    80 69 01 46 33 20 88 47 08 BD 10 B5 50 48 00 68
    00 68 04 46 4F 48 04 21 01 22 01 23 A0 47 4C 48
    00 68 55 49 80 68 02 46 4A 48 90 47 48 48 00 68
    51 49 40 68 02 46 47 48 90 47 50 49 29 20 00 F0
    91 FC 43 48 00 68 00 6A 01 46 42 48 88 47 40 48
    00 68 80 69 01 46 3F 48 88 47 3D 48 00 68 00 69
    02 46 3C 48 00 21 90 47 10 BD 08 B5 44 48 00 68
    00 68 80 47 FF F7 04 FF 4F F4 00 40 00 21 00 F0
    45 FC 03 20 00 F0 8A FC 3E 48 00 68 00 68 00 21
    00 22 03 46 4F F0 80 50 98 47 3A 48 00 68 00 68
    00 21 00 22 03 46 01 20 98 47 36 48 00 68 00 68
    03 21 00 22 03 46 08 20 98 47 32 48 00 68 00 68
    03 21 00 22 03 46 02 20 98 47 2E 48 00 68 00 68
    03 21 00 22 03 46 04 20 98 47 FF F7 96 FF 25 48
    00 68 00 68 80 47 00 BF 1D 48 00 78 00 21 00 B1
    01 21 00 29 F7 DD 18 48 00 68 C0 68 02 21 02 46
    02 20 90 47 16 49 00 20 08 70 1A 48 00 68 40 68
    80 47 1D 49 4F F6 FF 70 08 60 1C 49 4F F6 FF 70
    08 60 1B 49 4F F6 FF 70 08 60 1A 49 4F F6 FF 70
    08 60 19 49 4F F6 FF 70 08 60 18 49 4F F6 FF 70
    08 60 17 48 00 68 01 46 16 48 88 47 CB E7 C0 46
    5C 08 00 02 00 C0 00 40 24 08 00 02 FC 00 00 20
    00 01 00 20 24 4D 00 40 22 4D 00 40 2A 4D 00 40
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    The verification-error with the bigger ti-txt-file is still there. Same call for the BSL-Scripter on the same board.

    Datenlogger.txt

    Regards,
    Thomas

  • Thomas,

       I will need to look at the specifics of the hardware invocation but I wanted to share what I have done with the SW invocation.  I experimented with the BSL_PARAM but that did not make a difference. Please find the SW invocation example, the bsl script that I used, and the output log.  Can you use this file to confirm that you can program via the BSL with your setup? 

    swBSLinvoke.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    /* --COPYRIGHT--,BSD
    * Copyright (c) 2017, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    * --/COPYRIGHT--*/
    /*******************************************************************************
    * MSP432 GPIO - Input Interrupt
    *
    * Description: This example demonstrates a very simple use case of the
    * DriverLib GPIO APIs. P1.1 (which has a switch connected to it) is configured
    * as an input with interrupts enabled and P1.0 (which has an LED connected)
    * is configured as an output. When the switch is pressed, the LED output
    * is toggled.
    *
    * MSP432P401
    * ------------------
    * /|\| |
    * | | |
    * --|RST P1.0 |---> P1.0 LED
    * | |
    * | P1.1 |<--Toggle Switch
    * | |
    * | |
    *
    ******************************************************************************/
    /* DriverLib Includes */
    #include <ti/devices/msp432p4xx/driverlib/driverlib.h>
    /* Standard Includes */
    #include <stdint.h>
    #include <stdbool.h>
    #define PORT_BUTTON_INTERRUPT (GPIO_PORT_P6)
    #define PIN_BUTTON_INTERRUPT (GPIO_PIN7)
    #define BSL_PARAM (0xFC48FFFF)
    //#define BSL_PARAM (0xFC48DFFF)
    uint8_t flag_interrupt = 0;
    int main(void)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    script_test_01.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    //
    //Script example MSP432 UART BSL
    //Device : MSP432P401R
    //Comm Bridge: XDS110 - MSP432LP BackChannelUART
    // for this setting, the parity need to be
    // set from Scripter side
    // When MSP-BSL Rocket is used, parity will be
    // generated by the Rocket
    //
    //Download blink application to
    //MSP432 device through UART BSL
    //
    LOG
    MODE P4xx UART 9600 COM71 PARITY
    RX_PASSWORD_32 pass256_wrong.txt
    RX_PASSWORD_32 pass256_default.txt
    MASS_ERASE
    RX_DATA_BLOCK_32 Datenlogger.txt
    //RX_DATA_BLOCK_32 BSL_TEST.txt
    //RX_DATA_BLOCK_32 Blink_LED.hex
    TX_BSL_VERSION_32
    TX_DATA_BLOCK_32 0x0000 0x4000 ReadBlock_cleanDevice.txt
    //TX_DATA_BLOCK_32 0x0000 0x4000 ReadBlock_MSP432P401R.hex
    REBOOT_RESET
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    script_test_01_2018May17_141323.log
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    ---------------------------------------------------------
    BSL Scripter 3.4.0.1
    PC software for BSL programming
    2018-May-17 14:13:23
    ---------------------------------------------------------
    Input file script is : C:/MSPBSL_Scripter_win//customerRequest/script_test_01.txt
    MODE P4xx UART 9600 COM71 PARITY
    RX_PASSWORD_32 pass256_wrong.txt
    Read Txt File : C:\MSPBSL_Scripter_win\customerRequest\pass256_wrong.txt
    [ERROR_MESSAGE]BSL Password is error!
    RX_PASSWORD_32 pass256_default.txt
    Read Txt File : C:\MSPBSL_Scripter_win\customerRequest\pass256_default.txt
    BSL Password is correct!
    MASS_ERASE
    Mass Erase is successful!
    RX_DATA_BLOCK_32 Datenlogger.txt
    Read Txt File : C:\MSPBSL_Scripter_win\customerRequest\Datenlogger.txt
    Time elapsed of writing 65220 bytes : 80.41 seconds
    Speed of writing data :0.7921(kB/s)
    //RX_DATA_BLOCK_32 BSL_TEST.txt
    //RX_DATA_BLOCK_32 Blink_LED.hex
    TX_BSL_VERSION_32
    Vendor:[TI] CI:[0003] API:[0006] PI:[0203] Build-ID:[0008]
    TX_DATA_BLOCK_32 0x0000 0x4000 ReadBlock_cleanDevice.txt
    Write Txt File : C:/MSPBSL_Scripter_win/customerRequest/ReadBlock_cleanDevice.txt
    Time elapsed of reading 16384 bytes : 20.45 seconds
    Speed of reading data : 0.7825(kB/s)
    //TX_DATA_BLOCK_32 0x0000 0x4000 ReadBlock_MSP432P401R.hex
    REBOOT_RESET
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Regards,
    Chris

  • Chris,

    i can confirm that your code works in my enviroment. I compared it also with my code and can't find any differences, except the codesize in general and the way of invoking the bsl-launch (interrupt vs. serial command)

    Did you try to flash Datenlogger.txt with BSL-Scripter in commandline-mode with verification? I tried your code with a blank device (flashed a new BSL with uniflash) and then tried to flash my software in commandline-mode. Then the verification fails and the mcu doesn't work correctly anymore. Only flashing a new BSL helps then.

    I can send you the my complete project, but don't want to post it into the forum.

    Regards,
    Thomas

  • Thomas,
    I will need to speak with my colleague. I cannot get the command line to work. I keep getting a message that "The system cannot find the specified file. " I suspect that I have corrupted my installation, but removing and reinstalling did not resolve the issue.

    Regards,
    Chris
  • Hi Thomas,

    I found something wrong with the address in the image.
    First placement is @0 and it has (717 line * 16 bytes) = 11472 bytes = 0x2CD0
    so in line 719, the address shall be at least 0x2CD0, but in Datenlogger.txt @2CA8
    that's why it rewrites some part of previous section.
    How did you generate the image?
  • Hi Fatmawati,

    i enabled the ARM Hex Utility in the project properties in CCS 7.4 and changed output format to TI-TXT.

    Here's a screenshot:

    In a new created file there is also an adress in line 17 (@00e8) but i think it should be 00e4.

    Regards,
    Thomas

     

  • Hi Thomas,

    this is the way to create the TI TXT file. The problem comes from this overlapping address, so you could not get the application runs as expected.
    Is there any manual change in the linker command file to place the code? That could be the other reason why the overlapping occurs.
  • Hi Fatmawati,

    i inserted 2 sections to store data and config in flash (MYCONFIG and MYDATA). This is the command-file

    msp432p401r.cmd.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    /******************************************************************************
    *
    * Copyright (C) 2012 - 2017 Texas Instruments Incorporated - http://www.ti.com/
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the
    * distribution.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    *
    * Default linker command file for Texas Instruments MSP432P401R
    *
    * File creation date: 10/13/17
    *
    *****************************************************************************/
    --retain=flashMailbox
    MEMORY
    {
    //MAIN (RX) : origin = 0x00000000, length = 0x00040000
    MAIN (RX) : origin = 0x00000000, length = 0x0003B000
    MYCONFIG (RX) : origin = 0x0003B000, length = 0x00001000
    MYDATA (RX) : origin = 0x0003C000, length = 0x00004000
    INFO (RX) : origin = 0x00200000, length = 0x00004000
    #ifdef __TI_COMPILER_VERSION__
    #if __TI_COMPILER_VERSION__ >= 15009000
    ALIAS
    {
    SRAM_CODE (RWX): origin = 0x01000000
    SRAM_DATA (RW) : origin = 0x20000000
    } length = 0x00010000
    #else
    /* Hint: If the user wants to use ram functions, please observe that SRAM_CODE */
    /* and SRAM_DATA memory areas are overlapping. You need to take measures to separate */
    /* data from code in RAM. This is only valid for Compiler version earlier than 15.09.0.STS.*/
    SRAM_CODE (RWX): origin = 0x01000000, length = 0x00010000
    SRAM_DATA (RW) : origin = 0x20000000, length = 0x00010000
    #endif
    #endif
    }
    /* The following command line options are set as part of the CCS project. */
    /* If you are building using the command line, or for some reason want to */
    /* define them here, you can uncomment and modify these lines as needed. */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    And this are the settings in CCS

    Regards,
    Thomas

  • Hi Fatmawati,
    i just tried with a manually fixed ti-txt and the verification works fine but the program does not work at all. Maybe some jump-isntruction lead to a wrong place now.

    Regards,
    Thomas
  • Hi Chris,

    one Problem i just solved i think.
    I use the EUSCI_B0 for communication with another chip via SPI. After inserting the spi init in your testcode, the BSL does not work with param 0xFC48FFFF. When i change the parameter to use the UART (0xFC48DFFF) it works again. This happens also when no device is connected to the SPI-pins. Maybe you can verify this behaviour.

    Regards,
    Thomas
  • Thomas,

       Can you give me an idea for what is the SPI configuration for your application?  In the automode, the BSL will configure the UART, SPI, and I2C.

        // Initialize peripheral
        switch(BSL432_ActivePeripheral) {
            case BSL432_AP_Auto:
                BSL432_PI_initUARTdetect();
                BSL432_PI_initSPI();
                BSL432_PI_initI2C();
                break;

    The BSL initialization of the SPI will overwrite the control register for EUSCIB0.

    /**
     * PI initialization routine for SPI.
     *
     * Configures the SPI module and send and receive functions.
     *
     * \return None
     */
    void BSL432_PI_initSPI()
    {
        const eUSCI_SPI_SlaveConfig BSL432_SPIConfig =
        {
            EUSCI_SPI_MSB_FIRST,
            EUSCI_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT,
            EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_HIGH,
            EUSCI_SPI_4PIN_UCxSTE_ACTIVE_LOW
        };
    
        MAP_SPI_initSlave(BSL432_SPI_MODULE, &BSL432_SPIConfig);
    
        /* Enable SPI module */
        MAP_SPI_enableModule(BSL432_SPI_MODULE);
        MAP_SPI_registerInterrupt(BSL432_SPI_MODULE, BSL432_PI_IRQ_SPIdetect);
        MAP_SPI_enableInterrupt(BSL432_SPI_MODULE, EUSCI_B_SPI_RECEIVE_INTERRUPT);
    }

    Now if there is any activity on the SPI bus, then this means that the BSL will report that IRQ_receiving.

    /**
     * SPI interrupt routine used for detection of SPI activity.
     * After receiving the first byte the regular RX/TX SPI IRQ routine is registered.
     *
     * \return None
     */
    void BSL432_PI_IRQ_SPIdetect(void)
    {
        // Interrupt status flag doesn't need to be read or reset. Reading RX buffer clears the flag.
    
        MAP_SPI_registerInterrupt(BSL432_SPI_MODULE, BSL432_PI_IRQ_SPI_RX);
        BSL432_RAM_RX_Buf[BSL432_MAX_BUFFER_SIZE + 5] = BSL432_AP_SPI;  // Signal that SPI is PI active now
    
        uint8_t receivedData = MAP_SPI_receiveData(BSL432_SPI_MODULE);
    
        if(receivedData != 0xFF) // 0xFF is ignored. Just shifts data out
        {
            BSL432_RAM_RX_Buf[0] = receivedData;
            BSL432_PI_IRQ_RxDataCnt = 1;
            BSL432_IRQ_state = IRQ_receiving;
        }
    }

    If there is SPI activity, then it would make sense that the BSL, in auto mode, would interpret this activity as a potential BSL and prevent the UART BSL from working.

    Chris

  • Hi Chris,

    i've tested with the launchpad and no external components.

    This is my SPI-configuration

    /* SPI Master Configuration Parameter */
    const eUSCI_SPI_MasterConfig spiMasterConfig =
    {
        EUSCI_B_SPI_CLOCKSOURCE_SMCLK, // SMCLK Clock Source
        3000000, // SMCLK = DCO = 3MHZ
        500000, // SPICLK = 500khzI
        EUSCI_B_SPI_MSB_FIRST, // MSB First
        EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT, // Phase
        //EUSCI_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT, //CPHA=1
        //GGf. Phase tauschen für AD7719  EUSCI_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT
        EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_HIGH, // High polarity CPOL=1
        //EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW, // High polarity CPOL=1
        //EUSCI_B_SPI_3PIN // 3Wire SPI Mode
        EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_LOW|EUSCI_B_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE  //4Wire SPI Mode
    };

    void spi_init(void)
    {
        /* Selecting P1.5 P1.6 and P1.7 in SPI mode */
        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1,GPIO_PIN4, GPIO_PRIMARY_MODULE_FUNCTION);
        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1,GPIO_PIN5, GPIO_PRIMARY_MODULE_FUNCTION);
        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1,GPIO_PIN6, GPIO_PRIMARY_MODULE_FUNCTION);
        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1,GPIO_PIN7, GPIO_PRIMARY_MODULE_FUNCTION);
        
        /* Configuring SPI in 3wire master mode */
        MAP_SPI_initMaster(EUSCI_B0_BASE, &spiMasterConfig);
        
        /* Enable SPI module */
        MAP_SPI_enableModule(EUSCI_B0_BASE);
        
        /* Enabling interrupts */
        MAP_SPI_enableInterrupt(EUSCI_B0_BASE, EUSCI_B_SPI_RECEIVE_INTERRUPT);
        MAP_SPI_enableInterrupt(EUSCI_B0_BASE, EUSCI_B_SPI_TRANSMIT_INTERRUPT);

        //RESET for ext. chip set high
        MAP_GPIO_setOutputHighOnPin(GPIO_PORT_P5, GPIO_PIN0);
    }

    On my PCB there is one chip (Analog Devices AD7719)

    Regards,
    Thomas

  • After hours of tests and tires i found two further points an maybe the solution.

    I use Timer32 in my application. After activating the timer in your Example it doesn't work anymore. When halting the timer it works again. So the start with a command over UART works now.

    However the flashing failed again.

    In the cmd-script i use, i send the command first and then starting the BSL_Scripter after a timeout of 2 seconds. I get the error of an incorrect header. The following code works now repeatedly:

    REM @ECHO OFF

    mode COM2 BAUD=9600 PARITY=n DATA=8

    echo b > \\.\COM2 2>&1

    mode COM2 BAUD=9600 PARITY=e DATA=8

    REM wait 2 Sec

    ping localhost -n 2 > nul 2>&1

    c:\ti_bsl\BSL-Scripter.exe -d -g -n P4xx -i [COM2,UART,9600,PARITY] -b -z [RESET]

    ping localhost -n 2 > nul 2>&1

    C:\ti_bsl\BSL-Scripter.exe -d -n P4xx -i [COM2,UART,9600,PARITY] -j FAST -b -w Datenlogger.txt -v -z [RESET]

    Pause

    It seems that the BSL_scripter does not change the parity.

    Anyway now it works to me.

    The short form of the solution:

    - Disable the code optimization to prevent adress-errors in TI-TXT-file

    - Stop Timer32

    - Disable AutoMode of Uart when using SPI for other purposes

    - It works also with Scripter in Version 3.3.0

    Regards,

    Thomas

  • Hi Thomas,

    thank you for your confirmation. I would still suggest to use the BSL Scripter 3.4.0, because it is more robust and we implemented some bug fixes.

**Attention** This is a public forum