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 Pattern,
You should properly be entering BSL mode if you are jumping to address 0x1000. What does your code look like to do this?
The hardware sequence works
When you say the hardware sequence works, do you mean that after using Hardware invocation you are able to correctly program via BSL and UART?
Are you following the correct format for UART BSL commands?
Best Regards,
Brandon Fisher
This is the code I've run unsuccessfully:
#include <msp430.h> void main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode // to activate previously configured port settings P1DIR |= 0x01 << 0; // Set P1.0 to output direction (RED LED) P9DIR |= 0x01 << 7; // Set P9.7 to output direction (GREEN LED) P1OUT |= 0x01 << 0; // Start P1.0 as output HIGH P9OUT |= 0x01 << 7; // Start P1.0 as output HIGH P1OUT |= 0x01 << 1; // Button needs a pull-up resistor P1REN |= 0x01 << 1; volatile unsigned int pressCount = 0; // volatile to prevent optimization for(;;) { volatile unsigned int i; // volatile to prevent optimization if (! (P1IN & (0x01 << 1)) ){ // Is the Button pushed? P1OUT ^= 0x01 << 0; // Toggle RED using exclusive-OR pressCount++; if (pressCount >= 10){ P9OUT ^= (0x01 << 7); // Toggle GREEN using exclusive-OR //Jump to BSL here __disable_interrupt(); // disable interrupts ((void (*)())0x01000)(); // jump to BSL } i = 20000; // SW Delay do i--; while(i != 0); } } }
By modifying the code as follows (line 30) and running the Mass Erase BSL Command, the issue has resolved.
#include <msp430.h> void main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode // to activate previously configured port settings P1DIR |= 0x01 << 0; // Set P1.0 to output direction (RED LED) P9DIR |= 0x01 << 7; // Set P9.7 to output direction (GREEN LED) P1OUT |= 0x01 << 0; // Start P1.0 as output HIGH P9OUT |= 0x01 << 7; // Start P1.0 as output HIGH P1OUT |= 0x01 << 1; // Button needs a pull-up resistor P1REN |= 0x01 << 1; volatile unsigned int pressCount = 0; // volatile to prevent optimization for(;;) { volatile unsigned int i; // volatile to prevent optimization if (! (P1IN & (0x01 << 1)) ){ // Is the Button pushed? P1OUT ^= 0x01 << 0; // Toggle RED using exclusive-OR pressCount++; if (pressCount >= 10){ P9OUT ^= (0x01 << 7); // Toggle GREEN using exclusive-OR MPUCTL0 = MPUPW; //Disabling the MPU //Jump to BSL here __disable_interrupt(); // disable interrupts ((void (*)())0x01000)(); // jump to BSL } i = 20000; // SW Delay do i--; while(i != 0); } } }
Hi Pattern,
Glad to hear you figured it out. I'll mark this thread as closed for now. Feel free to make another post if you have any other issues down the line.
Best Regards,
Brandon Fisher
Hi Brandon,
Before closing the thread, kindly shed me some light on whether the BSL code exists entirely in a protected area of memory or whether the region of 0x1000 to 0x100F is unprotected as stated in the documentation. Currently, I'm having to disable memory protection for the chip for the BSL to be accessible. Is there an alternative way to render the BSL code accessible?
Regards,
Pattern
Hi Pattern,
Your original BSL invoke should work.
What binary are you trying to program? If this is trying to access a protected region of memory then the MPU may be triggering an NMI.
Best Regards,
Brandon Fisher
Hi Pattern,
Your original BSL invoke should work. Jumping to BSL should not require this.
What binary are you trying to program? If this is trying to access a protected region of memory then the MPU may be triggering an NMI.
Best Regards,
Brandon Fisher
**Attention** This is a public forum