Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed from November 25 through December 2. Thank you for your patience.

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: BSL Scripter not working on linux

Part Number: MSP432P401R

Hi,

i have compiled the BSL Scripter myself and have it running on ARM architecture running Debian Linux.

So here is the output:

root@:/BSL_QT# ./BSL_QT MSP432/script_MSP432_uart.txt
---------------------------------------------------------
BSL Scripter 3.2.1
PC software for BSL programming

---------------------------------------------------------
Input file script is : /home/BSL_QT/MSP432/script_MSP432_uart.txt
//
//Script example MSP432 UART BSL
//Device : MSP432P401R
//Download blink application to
//MSP432 device through UART BSL
//
LOG
MODE P4xx UART 9600 /dev/ttymxc3
[ERROR_MESSAGE]Initialization of BSL P432 failed! Exit the scripter!

 

Do i have to flash the MSP432 with BSL configuration first?

I am using the UART BSL Ports P1.2 and P1.3 and they are working fine with my Linux system, since i use them on my application.

The error message comes from the class UartComm from the SourceCode:

void UartComm::transmitP4xxInitialization()
{
const uint8_t loopInitialization = 10;
bool initP432 = false;
uint8_t uartTxBuffer[1] = { 0xFF };

for (uint8_t i = 0; i < loopInitialization; i++)
{
ack = 0xFF;
boost::system::error_code ec;
boost::asio::write(port, boost::asio::buffer(uartTxBuffer, 1), ec);
if (ec)
{
throw std::runtime_error("Error from writing occurs...");
}
receiveBuffer(-1);
if (ack == 0x00)
{
initP432 = true;
break;
}
}

if (initP432 == false)
{
throw std::runtime_error("[ERROR_MESSAGE]Initialization of BSL P432 failed! Exit the scripter!"); <---------------------------Here it throws the message
}
else
{
std::cout << "Initialization of BSL P432 succeed!" << std::endl;
}
}

The ack is from the "BslResponseHandler" class and  0x00 means: static const uint8_t FLASH_ACK = 0x00;

So BSL Scripter doenst receive 0x00 back and that is causing the scripter to stop.

But why is the MSP432 not sending 0x00 back but an other value?

Obs: Also measured the RX and TX UART lines and the communication is running

Thanks,

Michael

  • Hi,
    Thanks for posting.
    Let me look into this and get back to you.

    Regards,
    Priya
  • Hi Michael,

    The BSL will be invoked and reply with 0x00 if the device at address @0x0-0x100 is still empty.
    have you programmed the device before?
  • So i found this:

    "MSP432 MCUs
    For the MSP432 BSL UART, BSL invocation on a blank device does not use the RST and TST
    pins. Instead, the BSL Scripter starts with the selected baud rate (for example, 9600 or 19200) and
    sends "0xFF" to the BSL. For these devices, the invoke byte (instead of the invoke sequence)
    invokes the BSL. The MSP-BSL "Rocket" and MSP-FET do not generate the invoke sequence as in
    the MSP430. If the BSL in the MSP432 device is invoked, then the device returns "0x00" as
    succeed status. If "0x00" is not returned, BSL Scripter shows "Initialization failed" on the screen.
    The invocation with "0xFF" cannot succeed when the device is already programmed (@0x0 to
    @0x100 already filled). In this case, the BSL must be invoked using hardware invocation. For
    details about configuring the BSL by hardware invocation, see the Bootloader (BSL) Configuration
    section of the SimpleLink™ MSP432™ Security and Update Tool User's Guide"

    Inside of that document it says:
    "For a programmed device, every time the device starts, it executes the main application. To run the BSL
    instead and perform a firmware update on a programmed device, BSL code can be called through
    software or hardware invocation. For details, see the MSP432™ SimpleLink™ Microcontrollers Bootloader
    (BSL) User's Guide. The security features of the MSP432 MCU provide the configuration for the BSL
    hardware invocation."

    And inside that document:

    "4.3.1 Software BSL Invocation
    The BSL has an API table at address 0x0020:2000 that the application can call. The table contains the
    address of the function that starts the BSL execution. The application must pass a certain set of
    parameters that determines the following:
    1. BSL interface (automatic, UART, I
    2C, SPI)
    2. BSL I
    2C slave address (default = 0x48)"

    "The following C code example demonstrates how the address from the API table is used to start the BSL
    and pass the BSL entry function parameters by the application:
    #define BSL_PARAM 0xFC48FFFF // I2C slave address = 0x48, Interface selection = Auto
    #define BSL_API_TABLE_ADDR 0x00202000 // Address of BSL API table
    #define BSL_ENTRY_FUNCTION (*((uint32_t *)BSL_API_TABLE_ADDR))
    ((void (*)())BSL_ENTRY_FUNCTION)((uint32_t)BSL_PARAM); // Call the BSL with given BSL parameters"



    How and where do i use the C code?
    Do i have to change the BSL Scripter so that it can start the BSL excecution through the BSL API from MSP432 ?
  • So i found this BSL Entry Function in msp432p401r.h file:

    /******************************************************************************
    * BSL *
    ******************************************************************************/
    #define BSL_DEFAULT_PARAM ((uint32_t)0xFC48FFFF) /*!< I2C slave address = 0x48, Interface selection = Auto */
    #define BSL_API_TABLE_ADDR ((uint32_t)0x00202000) /*!< Address of BSL API table */
    #define BSL_ENTRY_FUNCTION (*((uint32_t *)BSL_API_TABLE_ADDR))

    #define BSL_AUTO_INTERFACE ((uint32_t)0x0000E0000) /*!< Auto detect interface */
    #define BSL_UART_INTERFACE ((uint32_t)0x0000C0000) /*!< UART interface */
    #define BSL_SPI_INTERFACE ((uint32_t)0x0000A0000) /*!< SPI interface */
    #define BSL_I2C_INTERFACE ((uint32_t)0x000080000) /*!< I2C interface */

    #define BSL_INVOKE(x) ((void (*)())BSL_ENTRY_FUNCTION)((uint32_t) x) /*!< Invoke the BSL with parameters */

    So in my case:

    x= 0xFC48F8FF (I2C slave address 48 and Interface selection UART)


    So i think i will have to implement a C function code in my MSP432 application and call it first before i start the BSL Scripter.
    Right?
  • So i did a function and called it via UART before diong the BSL Script.
    In the function i called BSL_INVOKE fuction and pass my paremeters as argument.
    Now i start the BSL Scripter and got the same issue:
    root:/home/devel/BSL_QT# ./BSL_QT MSP432/script_MSP432_uart.txt
    ---------------------------------------------------------
    BSL Scripter 3.2.1
    PC software for BSL programming
    2000-Jan-01 03:54:11
    ---------------------------------------------------------
    Input file script is : /home/devel/BSL_QT/MSP432/script_MSP432_uart.txt
    //
    //Script example MSP432 UART BSL
    //Device : MSP432P401R
    //Download blink application to
    //MSP432 device through UART BSL
    //
    LOG
    MODE P4xx UART 9600 /dev/ttymxc3
    [ERROR_MESSAGE]Initialization of BSL P432 failed! Exit the scripter!

    What could be wrong?
  • Hi Fatmawati,

    yes it is already programmed and i am trying to do the steps to software invoke bsl and try to run the BSL scripter after.
    But i am getting the same issue.
    Any idea?
  • Hi Michael,

    this might be the case:

    The BSL in MSP432 (any peripherals--UART, I2C, or SPI) will be invoked when the address @0h-@100 is empty or all FFh. This region is the BSL password and at the same time where the interrupt vector located. Once this region is programmed, we cannot invoke the BSL on the same way.

    But, we have so called BSL hardware invocation. You write the parameter to invoke the BSL by applying certain polarity in  certain pin. When the devices starts or run from reset, the bootcode will see the polarity on this pin. If it is match with the configuration that you set, then the BSL will be invoked.

    Configuring the flashmailbox is simple writing the configuration in the information memory , reset the device, and then you have the configuration stored in the device system. the example is available:

    So I would suggest you to first erase the device using JTAG in IDE you are using (CCS/IAR/KEIL), try to invoke the BSL again. This should work. Then we can confirm that the invocation before didn't work because the device is programmed. Then erase the device again, configure BSL hardware invocation parameters.


    Let me know if you have other questions.

  • Hi Fatmawati,

    so is it not possible with software bsl invoke on MSP432?
    I mass erase the MSP432 with CCS and got the same issue.
    What is wrong with my setup?
    I can measure the UART RX and TX lines and it is sending data.
    But why does the MSP432 not responding?
  • Hi Fatmawati,
    i did the Mass Erase on CCS but is there any settings that i should consider that allow read/write/erase BSL on CCS?

    The Linux system is sending 0xFF to the UART-RX Line from MSP432 in PORT 1.2.

    So the script sends in the loop 10x times the 0xFF value before it throws the error message.

    The UART-TX line from MSP432 is always HIGH. 

    My problem is the MSP432 that is not responding or the BSL part is not programmed.

    Could you help me on those steps getting MSP432 ready for BSL?

    Obs:

    I download and install BSL Script on Windows and with an USB/UART converter i got a COMPort on Windows and tryied to flash the same script file.

    I used the MSP432 Launchpad in RED and pluged out the jumpers and left only 3V3 and GND on.

    I connect in the RX and TX pins the USB/UART converter TX and RX. So the setup is correct and tryied now to flash with win BSl scripter but got the same error.

    This is the log output:

    ---------------------------------------------------------
    BSL Scripter 3.2.1
    PC software for BSL programming
    2017-May-11 09:35:48
    ---------------------------------------------------------
    Input file script is : C:/Users/ml/Desktop/MSPBSL_Scripter_win/ScriptExample/P4xx_uart/script_P4xx_uart.txt
    MODE P4xx UART 9600 COM6 PARITY
    [ERROR_MESSAGE]Initialization of BSL P432 failed! Exit the scripter!

    I have measured also the TX and RX Lines and got the same issue like on my linux machine. So the MSp432 is not responding the BSL scripter command.

    Also here i did the Factory reset via CCS on the launchpad.

  • Hi Fatmawati,

    i donwload the latest CCS 7 today set everything for the MSP432.
    Now here i have the same error on bsl scripter too.
    Could you please help me?

    OBS:

    Here is a picture from what i am measuring with an oscilloscope. The scripter send this command 10x times to the MSP432.

    regards,

    Michael

  • After installing CCS7 and set Factory reset the MSP432 Launchpad Red, i measured the RX and TX again and looks like MSP432 pulls its TX line Low:

    The problem is that BSL Scripter keeps sending 0xFF even when MSP432 send 0x00 back.

    The BSL Scripter throws here the same error as before.

    Any idea?

  • HI Michael,

    sorry for the late reply. Could you inform me which launchpad you are using? Is the device Rev. C or Rev. D?

    I better try this also in my PC and see what happens.

  • Hi Fatmawati,

    it is the Launchpad MSP432P401 Rev. 2.0 (RED).

    I didnt found any revision code with C or D, only 2.0

    Thank you for looking in this.

    Best regards,

    Michael

  • Hi Michael,

    Sorry for the late reply. This is might be the cause:

    BSL in 432 works with parity format. The backchannel UART in Launchpad doesn't. Please try to use the command: MODE P4xx UART 9600 COM<number> PARITY.

    And please keep in mind that once the memory on @0h-@100h programmed, you can not invoke the BSL. You can refer to this application note to have the BSL hardware invocation being setup. http://www.ti.com/lit/an/slaa659c/slaa659c.pdf

    I hope this is the cause for you as well, and now you can communicate with BSL :)

  • Hi Fatmawati,

    i add the PARITY in the example and i have the same issue.
    I measure the TX UART and i have the PARITY Bit at the end but the MSP432 doenst do anything.
    Could you do BSL using your MSP432 LaunchPad in Windows or Linux?
  • Hi Michael,

    I am using launchpad (Red one) and BSL Scripter in Windows and Linux PC (Ubuntu 14.04), and both are working. Other thing you can try, are you using CCS to develop application? i would suggest to erase all main memory and info memory using debugger. if the device is totally empty, then BSL shall be invoked.
  • Hi Fatmawati,

    how do i erase all main memory and info memory on CCS using the on board debugger?
    I only know how to factory erase the MSP432.

    Thanks,
    Michael
  • Hi Michael,

    A factory reset will erase the main memory and that should be enough to invoke the BSL.

    Regards,

    David
  • Hi DavidL, Hi Fatmawati,

    sorry to disapoint you guys but i still couldnt get it to work.

    So maybe you can find what i am doing wrong on this steps:

    1-First Mass Erase MSP432 on CCS on Target Configuration-> Load Select Configuration->Show all cores-> Connect to Target-> Scripts->Default-> MSP432_Factory_Reset:

    2- Check the COMPORT and change in uart script msp432 bsl examples

    3- Excecute BSL with example script

    4- Measure the RX and TX Lines from MSP432:

    The BSL Scripter tryies 10 times sending 0xFF to MSP432 and i dont know but the MSP432 looks like "sending" back 0x00

    but the BSLScripter doenst recognize it maybe.

    Any idea?

  • Hi Michael,

    thank you for trying our suggestion. What I could suggest next is to make sure the BSL application on the device is not corrupted. Let's try to reprogram the BSL then. The BSL resides inside flash information memory, so you can reprogram it. here are the steps if you are not yet familiar with it:

    1. download the package under:
    2. import the project in CCS (should work with version 6.1.3 above). you can copy the project into workspace or simply import it.
    3. in CCS, build the project in Release mode
    4. after it is successfully built, but before programming the device, go to Project Properties
    5. on the list on the left side choose Debug
    6. Then on the next column on the right, there is MSP432 settings
    7. on the next column on the right, choose erase method to be Erase main and information memory, also check the checkbox of Allow BSL information memory
    8. then you can start the program the BSL.
    9. close / terminate the debug session, then try to communicate with BSL again
  • Hi Fatmawati,

    can you send me the link?

    Is it this once Custom-BSL432?:  

  • Hi Michael,

    sure, sorry I forgot to copy it before:

  • Hi Fatmawati,

    thank you so much!

    You save my day =)

  • HI Michael,

    so happy that it is working at the end! :)
    by the way, is it also working with the ARM host (I think you are using the processor to replace the BSL Scripter)?

**Attention** This is a public forum