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.
Hi Gary, apologies for the delayed response. Covid has affected all our development. Hope you are well and safe.
We have tried "python -m msp430.bsl5.uart -eErw ClubMasterV4_8.txt" but get the same Protocol Error. The issue is strange because it only occur when we invoke the BSL in the firmware - see my original definition of the error:-
"The error only occurs in Linux command line and only if the BSL is invoked by software. We are able to flash the device successfully if we invoke the BSL with hardware (pulling up the PUR pin on power-up) using command line in Linux. We are also able to flash the device using the Python_Firmware_UpgraderGUI in Windows for both a software or a hardware invocation of the BSL."
Kind Regards
Warren
Hi Warren
I have try use the bsl5 in win10 but failed due to can't find the folder pywinusb. Have you try it in the win10 before?
This is the error I get
I am seek the help from other people now.
By the way, you can also try the BSL Scripter to use the command line to download a image by the USB
More information http://www.ti.com/lit/ug/slau655g/slau655g.pdf?&ts=1589187669687
Thanks for the response Gary
Good Afternoon Gary
I managed to flash a device using Python masp430.bsl5 in command line. I had to copy Python_Firmware_Upgrader files (see below files) to the Python directory to work - would not work by just adding Python directory to the path even after restarting my machine.
Also, I had to download Python-2.7.18. Could not get it to work on the latest Python-3.8. Please see successful programming below:-
Programming in Linux still remains an issue.
Hi Warren
I have successfully download the image with WIN10 with the command similar with yours.
For your problem that just the software invoke BSL not work problem.
Does the image you download with software invoke code include the USB function?
Best regards
Gary
Hi Warren
Any update from your side?
Can you share me your software invoke project ?
I have create a software invoke project and test on my win10 PC and works well with bsl5. You can try it with your Linux PC
/* --COPYRIGHT--,BSD_EX * Copyright (c) 2015, 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. * ******************************************************************************* * * MSP430 CODE EXAMPLE DISCLAIMER * * MSP430 code examples are self-contained low-level programs that typically * demonstrate a single peripheral function or device feature in a highly * concise manner. For this the code may rely on the device's power-on default * register values and settings such as the clock configuration and care must * be taken when combining code from several examples to avoid potential side * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware * for an API functional library-approach to peripheral configuration. * * --/COPYRIGHT--*/ //****************************************************************************** // MSP430FR5x9x Demo - Timer0_A3, Toggle P1.0, CCR0 Cont Mode ISR, DCO SMCLK // // Description: Toggle P1.0 using software and TA_0 ISR. Timer0_A is // configured for continuous mode, thus the timer overflows when TAR counts // to CCR0. In this example, CCR0 is loaded with 50000. // ACLK = n/a, MCLK = SMCLK = TACLK = default DCO = ~1MHz // // MSP430FR5994 // --------------- // /|\| | // | | | // --|RST | // | | // | P1.0|-->LED // // William Goh // Texas Instruments Inc. // October 2015 // Built with IAR Embedded Workbench V6.30 & Code Composer Studio V6.1 //****************************************************************************** #include <msp430.h> unsigned long long TickGet16(void); #pragma LOCATION(g_nTVal, 0x214c) // This is important for reproducing problem volatile unsigned long long g_nTVal,g_nBlinkTimer; // Different sizes, causes different hangs effects (seems UINT16 works...at least for 30 min) int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop WDT // Configure GPIO P1DIR |= BIT0; P1OUT |= BIT0; g_nBlinkTimer=0; // Disable the GPIO power-on default high-impedance mode to activate // previously configured port settings PM5CTL0 &= ~LOCKLPM5; TA2EX0 = TAIDEX_7; // TAIDEX = /8 TA2CCTL0 = CCIE; // TACCR0 interrupt enabled TA2CCR0 = 50; TA2CTL = TASSEL__SMCLK | ID__8 | MC__UP | TACLR; // SMCLK, continuous mode __bis_SR_register( GIE); // Enter LPM0 w/ interrupt while(1) { unsigned long long nTmrNow = TickGet16(); // Blink on 250 timer ticks if(nTmrNow - g_nBlinkTimer > 250) { P1OUT ^= BIT0; g_nBlinkTimer = nTmrNow; } } } // Timer0_A0 interrupt service routine #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector = TIMER2_A0_VECTOR __interrupt void Timer0_A0_ISR (void) #elif defined(__GNUC__) void __attribute__ ((interrupt(TIMER0_A0_VECTOR))) Timer0_A0_ISR (void) #else #error Compiler not supported! #endif { g_nTVal++; } unsigned long long TickGet16() { // __NOP(); // Adding stuff here seems to fix the problem. // __NOP(); // Adding more stuff makes problem appear again (obviously timer tick syncs with CPU execution, they run on same clocks, this is expected) // CLR_BIT_ATOMIC_W(TA2CCTL0, CCIE); // Without disabling interrupts everything seems to work !!! TA2CCTL0 &= ~CCIE; // TACCR0 interrupt enabled // TA2CCTL0 &= ~CCIE; // Same as above, produces same effects // __NOP(); // Uncomment this and problem goes away for any other arrangements unsigned long long nRet = g_nTVal; // SET_BIT_ATOMIC_W(TA2CCTL0, CCIE); TA2CCTL0 = CCIE; // TACCR0 interrupt enabled return nRet; }
This is the image file
@4400 4F 14 F2 F0 EF 00 1C 02 32 C2 03 43 3F 40 00 10 4F 13 4B 16 00 13 81 00 00 44 B1 13 6E 00 0C 43 B1 13 00 00 1C 43 B1 13 68 00 32 D0 10 00 FD 3F 03 43 D2 E3 02 02 00 13 @ffd2 2A 44 2A 44 2A 44 2A 44 2A 44 2A 44 00 44 2A 44 2A 44 2A 44 2A 44 2A 44 32 44 2A 44 2A 44 2A 44 2A 44 2A 44 2A 44 2A 44 2A 44 2A 44 16 44 B2 40 80 5A 5C 01 D2 D3 04 02 D2 C3 02 02 0D 14 3D 40 2E 82 1D 83 FE 23 0D 16 00 3C 0D 14 3D 40 2E 82 1D 83 FE 23 0D 16 00 3C F2 D0 10 00 06 02 F2 D0 10 00 02 02 F2 D0 10 00 18 02 F2 F0 EF 00 1C 02 F2 D0 10 00 1A 02 B2 40 10 00 42 03 B2 40 50 C3 52 03 B2 40 14 02 40 03 03 43 32 D0 18 00 03 43 03 43 0C 43 10 01 03 43 FF 3F 03 43 1C 43 10 01 q
Hi Gary
We unfortunately have not managed to get this to work in Linux yet, but I have managed to get it working in Windows10 - works fine. Please see firmware running on the MSP430 below to invoke the firmware update - I have left this in context, but only the last two lines of code are applicable.
case(FLASHUPDATE):
if (cmState==ACTIVE){
FlashUpdateResponse[5] = FLASHUP_ACTIVE;
crc = 0x37+Ver+FLASHUP_ACTIVE;
FlashUpdateResponse[10] = crc;
cdcSendDataInBackground(FlashUpdateResponse, 11, CDC0_INTFNUM, 1000);
S1_LED_ON;
S2_LED_ON;
SPRAY1_OFF;
SPRAY2_OFF;
Delay_ms(500);
_disable_interrupt(); // disable interrupts globally
((void (*)())0x1000)();
}
break;
I am not sure I understand your firmware - there is no invocation of the BSL in the code that I can see. Am I missing something?
Kind Regards
Warren
Hi Warren
Sorry attached the wrong code there please try this one
/* --COPYRIGHT--,BSD_EX * Copyright (c) 2012, 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. * ******************************************************************************* * * MSP430 CODE EXAMPLE DISCLAIMER * * MSP430 code examples are self-contained low-level programs that typically * demonstrate a single peripheral function or device feature in a highly * concise manner. For this the code may rely on the device's power-on default * register values and settings such as the clock configuration and care must * be taken when combining code from several examples to avoid potential side * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware * for an API functional library-approach to peripheral configuration. * * --/COPYRIGHT--*/ //****************************************************************************** // MSP430F552x Demo - Timer0_A5, Toggle P1.0, CCR0 Up Mode ISR, DCO SMCLK // // Description: Toggle P1.0 using software and TA_1 ISR. Timer1_A is // configured for up mode, thus the timer overflows when TAR counts // to CCR0. In this example, CCR0 is loaded with 50000. // ACLK = n/a, MCLK = SMCLK = TACLK = default DCO ~1.045MHz // // MSP430F552x // --------------- // /|\| | // | | | // --|RST | // | | // | P1.0|-->LED // // Bhargavi Nisarga // Texas Instruments Inc. // April 2009 // Built with CCSv4 and IAR Embedded Workbench Version: 4.21 //****************************************************************************** #include <msp430.h> int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT // P4DIR |= BIT5; // P1.0 output P1DIR |= BIT0; // P1.0 output P1OUT &= ~BIT0; __delay_cycles(99990); __delay_cycles(99990); P1REN |= BIT4; // Enable P1.4 internal resistance P1OUT |= BIT4; // Set P1.4 as pull-Up resistance P1IES |= BIT4; // P1.4 Hi/Lo edge P1IFG &= ~BIT4; // P1.4 IFG cleared P1IE |= BIT4; // P1.4 interrupt enabled TA0CCTL0 = CCIE; // CCR0 interrupt enabled TA0CCR0 = 50000; TA0CTL = TASSEL_2 + MC_1 + TACLR; // SMCLK, upmode, clear TAR __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts __no_operation(); // For debugger } // Timer0 A0 interrupt service routine #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER0_A0_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(TIMER0_A0_VECTOR))) TIMER0_A0_ISR (void) #else #error Compiler not supported! #endif { P1OUT ^= BIT0; // Toggle P1.0 // P2OUT ^= BIT1; } // Port 1 interrupt service routine #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(PORT1_VECTOR))) Port_1 (void) #else #error Compiler not supported! #endif { P1IFG &= ~BIT4; // P1.4 IFG cleared __disable_interrupt(); // disable interrupts ((void ( * )())0x1000)(); // jump to BSL }
By the way, what's the Linux version do you use?
Gary
**Attention** This is a public forum