Bug fixed in MSP430 BSL Code
authorBorja Martinez <borja.martinez@gmail.com>
Fri, 30 Sep 2016 07:31:52 +0000 (09:31 +0200)
committerBorja Martinez <borja.martinez@gmail.com>
Fri, 30 Sep 2016 07:31:52 +0000 (09:31 +0200)
Basic-Test-Package/BSL/MSP430/Boot_MSP430_Chain/main.c
Basic-Test-Package/BSL/MSP430/Boot_MSP430_Dual/main.c

index c7e5407fc13c7b656a6c2f2d06ac810e51b97ae8..f378fdf54059254867377fbeb4b7c8bc445126a3 100644 (file)
@@ -144,21 +144,25 @@ __interrupt void port1_isr (void) {
 
                // BOOT_IN2 interrupt clear and disable
                P1IFG &=~ (BOOT_IN1);
-               P1IE &=~ (BOOT_IN1);
 
-               flag=1;
+               // RESET_IN1 should be low
+               if ((P1IN & RESET_IN1) == 0) {
 
-               /* Disable CC2650 BSL */
-               P1IFG &=~(RESET_IN2|BOOT_IN2);
-               P1IE  &=~(RESET_IN2|BOOT_IN2);
+                       // BOOT_IN2 interrupt disable
+                       P1IE &=~ (BOOT_IN1);
+
+                       flag=1;
+
+                       /* Disable CC2650 BSL */
+                       P1IFG &=~(RESET_IN2|BOOT_IN2);
+                       P1IE  &=~(RESET_IN2|BOOT_IN2);
+
+                       /* Enable Reset High to Low */
+                       P1IES |= (RESET_IN1);
+                       P1IFG &=~ (RESET_IN1);
+                       P1IE |= (RESET_IN1);
 
-               /* Enable Reset High to Low */
-               P1IES |= (RESET_IN1);
-               P1IFG &=~ (RESET_IN1);
-               P1IE |= (RESET_IN1);
 
-               // RESET_IN1 should be low
-               if ((P1IN & RESET_IN1) == 0) {
                        bootloader_active = true;
                }
        }
@@ -228,21 +232,24 @@ __interrupt void port1_isr (void) {
 
                // BOOT_IN2 interrupt clear and disable
                P1IFG &=~ (BOOT_IN2);
-               P1IE &=~ (BOOT_IN2);
 
-               flag=1;
+               // RESET_IN2 should be low
+               if ((P1IN & RESET_IN2) == 0) {
 
-               /* Disable MCP432 Boot */
-               P1IFG &=~(RESET_IN1|BOOT_IN1);
-               P1IE  &=~(RESET_IN1|BOOT_IN1);
+                       P1IE &=~ (BOOT_IN2);
+
+                       flag=1;
+
+                       /* Disable MCP432 Boot */
+                       P1IFG &=~(RESET_IN1|BOOT_IN1);
+                       P1IE  &=~(RESET_IN1|BOOT_IN1);
+
+                       /* Enable Reset High to Low */
+                       P1IES |= (RESET_IN2);
+                       P1IFG &=~ (RESET_IN2);
+                       P1IE |= (RESET_IN2);
 
-               /* Enable Reset High to Low */
-               P1IES |= (RESET_IN2);
-               P1IFG &=~ (RESET_IN2);
-               P1IE |= (RESET_IN2);
 
-               // RESET_IN2 should be low
-               if ((P1IN & RESET_IN2) == 0) {
                        bootloader_active = true;
                }
     }
@@ -307,6 +314,8 @@ __interrupt void port1_isr (void) {
   /* Unknown Sequence: Disable PIOs, Wait Timout */
   if(flag==0){
          P1IE  &=~ (RESET_IN1|RESET_IN2|BOOT_IN1|BOOT_IN2);
+      bootloader_active = true; // Ensure LMP3 (Timer active)
+
          P1IFG = 0;
   }
 
index fe0983ef003ac3e5ead53e2975f3b7afec383b3a..fa968da9369f41c90b15f3ba4645deeb64ae5364 100644 (file)
@@ -142,23 +142,26 @@ __interrupt void port1_isr (void) {
          ((P1IN  & BOOT_IN1) == 0) &&
          ((P1IES & BOOT_IN1) == BOOT_IN1)) {
 
-               // BOOT_IN2 interrupt clear and disable
+               // BOOT_IN2 interrupt clear
                P1IFG &=~ (BOOT_IN1);
-               P1IE &=~ (BOOT_IN1);
 
-               flag=1;
+               // RESET_IN1 should be low
+               if ((P1IN & RESET_IN1) == 0) {
 
-               /* Disable CC2650 BSL */
-               P1IFG &=~(RESET_IN2|BOOT_IN2);
-               P1IE  &=~(RESET_IN2|BOOT_IN2);
+                       // BOOT_IN2 interrupt disable
+                       P1IE &=~ (BOOT_IN1);
 
-               /* Enable Reset High to Low */
-               P1IES |= (RESET_IN1);
-               P1IFG &=~ (RESET_IN1);
-               P1IE |= (RESET_IN1);
+                       flag=1;
+
+                       /* Disable CC2650 BSL */
+                       P1IFG &=~(RESET_IN2|BOOT_IN2);
+                       P1IE  &=~(RESET_IN2|BOOT_IN2);
+
+                       /* Enable Reset High to Low */
+                       P1IES |= (RESET_IN1);
+                       P1IFG &=~ (RESET_IN1);
+                       P1IE |= (RESET_IN1);
 
-               // RESET_IN1 should be low
-               if ((P1IN & RESET_IN1) == 0) {
                        bootloader_active = true;
                }
        }
@@ -226,23 +229,27 @@ __interrupt void port1_isr (void) {
         ((P1IN  & BOOT_IN2) == 0) &&
         ((P1IES & BOOT_IN2) == BOOT_IN2)) {
 
-               // BOOT_IN2 interrupt clear and disable
+               // BOOT_IN2 interrupt clear
                P1IFG &=~ (BOOT_IN2);
-               P1IE &=~ (BOOT_IN2);
 
-               flag=1;
+               // RESET_IN2 should be low
+               if ((P1IN & RESET_IN2) == 0) {
 
-               /* Disable MCP432 Boot */
-               P1IFG &=~(RESET_IN1|BOOT_IN1);
-               P1IE  &=~(RESET_IN1|BOOT_IN1);
+                       // BOOT_IN2 interrupt disable
+                       P1IE &=~ (BOOT_IN2);
+
+                       flag=1;
+
+                       /* Disable MCP432 Boot */
+                       P1IFG &=~(RESET_IN1|BOOT_IN1);
+                       P1IE  &=~(RESET_IN1|BOOT_IN1);
+
+                       /* Enable Reset High to Low */
+                       P1IES |= (RESET_IN2);
+                       P1IFG &=~ (RESET_IN2);
+                       P1IE |= (RESET_IN2);
 
-               /* Enable Reset High to Low */
-               P1IES |= (RESET_IN2);
-               P1IFG &=~ (RESET_IN2);
-               P1IE |= (RESET_IN2);
 
-               // RESET_IN2 should be low
-               if ((P1IN & RESET_IN2) == 0) {
                        bootloader_active = true;
                }
     }
@@ -307,6 +314,7 @@ __interrupt void port1_isr (void) {
   /* Unknown Sequence: Disable PIOs, Wait Timout */
   if(flag==0){
          P1IE  &=~ (RESET_IN1|RESET_IN2|BOOT_IN1|BOOT_IN2);
+         bootloader_active = true;
          P1IFG = 0;
   }