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.
I am trying to invoke the BSL from my user code on a MSP430F5514 with the following code:
{
typedef void (* __data16 functionpointer)(void);
const functionpointer bsloader = (functionpointer)(0x1000);
USB_disconnect();
USB_disable();
// SYSBSLC &= ~(SYSBSLPE | SYSBSLOFF); //Tried with or without this line
__disable_interrupt();
// enter BSL
bsloader();
}
It does not work, all I get is a hung CPU. Is there anything I'm missing? I also tried to jump to 0x1002 instead, in this case the CPU does restart the user program but not start the BSL. On my Hardware the PUR is pulled low with 1M. I can invoke the BSL by pulling PUR high while doing a reset.
Hi,
Jumping or calling address 0x1000, with disabled interrupts, is 100% correct. Have you examined the assembly to make sure your code is doing that?
The code is doing what it's supposed to, I can set a breakpoint on 0x1000 and it get's there with ints disabled:
---
USB_disconnect();
005FD2 13B0 494C calla #USB_disconnect
USB_disable();
005FD6 13B0 4AA4 calla #USB_disable
__disable_interrupt();
005FDA C232 dint
005FDC 4303 nop
bsloader();
005FDE 0080 1000 bra #0x1000
--
In the disassembly window in IAR at address 0x1000 I can only see 0xFFFF. If I manually change SYSBSLC from 0x0003 to 0x4003 then all I can see in the debugger is 0x3FFF.
If I scoll down I only can see sort of valid code from around address 0x1A00. I did check the "Allow erase/write access to locked flash memory" and "Allow erase/write access to BSL flash memory" checkboxes as suggested in another thread.
Any ideas?
It's worth considering the possibility that this device either does not have BSL, or has had it erased. A pretty fool proof way to check is to have a little BSL reader program which unlocks the BSL, then dumps some memory into a RAM arrray, which you can check out using the debugger. Usually however, when you uncheck those bits using the debugger, you can also read the BSL memory and see the program there.
As mentioned before, the BSL works fine if I invoke it by pulling PUR low during reset, however I need to have a method on invoking it from the user software. I did do a memdump over the USB (I somehow didn't get any conclusive results using the IAR debugger), I attach the text file:
1000:3C34 1002:3C08 1004:3FFF 1006:3FFF 1008:3FFF 100A:3FFF 100C:3FFF 1010:0300 1012:3383 1014:903D 1016:DEAD 1018:2004 101A:903E 101C:BEEF 101E:2001 1020:3C03 1022:430C 1024:430D 1026:0110 1028:413C 102A:413D 102C:0110 102E:430C 1030:D0B2 1032:8003 1034:0182 1036:40B2 1038:9628 103A:0900 103C:D0B2 103E:0100 1040:0904 1042:B2A2 1044:0902 1046:200A 1048:93B2 104A:FFFE 104C:2008 104E:403B 1050:012C 1052:831B 1054:23FE 1056:B2B2 1058:0908 105A:2401 105C:D32C 105E:C0B2 1060:0100 1062:0904 1064:43C2 1066:9628 1068:0110 106A:4031 106C:3400 106E:13B0 1070:177E 1072:930C 1074:2400 1076:13B0 1078:1762 107A:3FFF 107C:0112 107E:0200 1080:0000 1082:0800 1084:2047 1086:0200 1088:0104 108A:0000 108C:0100 108E:0006 1090:09FF 1092:A101 1094:8501 1096:953F 1098:753F 109A:2508 109C:1501 109E:0901 10A0:8101 10A2:8502 10A4:953F 10A6:753F 10A8:2508 10AA:1501 10AC:0901 10AE:9101 10B0:C002 10B2:0209 10B4:0029 10B6:0101 10B8:8000 10BA:0932 10BC:0004 10BE:0200 10C0:0003 10C2:0000 10C4:2109 10C6:0101 10C8:0100 10CA:2422 10CC:0700 10CE:8105 10D0:4003 10D2:0100 10D4:0507 10D6:0301 10D8:0040 10DA:FF01 10DC:D2F2 10DE:0920 10E0:D2F2 10E2:0922 10E4:0110 10E6:425E 10E8:2402 10EA:937E 10EC:2425 10EE:907E 10F0:0009 10F2:2804 10F4:427D 10F6:827E 10F8:435F 10FA:3C0C 10FC:927E 10FE:2C02 1100:4E4D 1102:3C06 1104:427D 1106:93D2 1108:240E 110A:2002 110C:434E 110E:3FF4 1110:437E 1112:434F 1114:4FC2 1116:2410 1118:4EC2 111A:2402 111C:434F 111E:3C07 1120:421E 1122:2406 1124:4EEF 1126:2378 1128:5392 112A:2406 112C:535F 112E:9D4F 1130:2BF7 1132:4DC2 1134:0921 1136:0110 1138:43C2 113A:2410 113C:0110 113E:4C82 1140:2406 1142:425E 1144:2386 1146:9EC2 1148:2402 114A:2804 114C:4EC2 114E:2402 1150:434E 1152:3C01 1154:435E 1156:4EC2 1158:240E 115A:0080 115C:10E6 115E:B0F2 1160:000F 1162:2384 1164:2014 1166:93C2 1168:2384 116A:3403 116C:425E 116E:0920 1170:3C02 1172:425E 1174:0922 1176:F27E 1178:4EC2 117A:2460 117C:425E 117E:2460 1180:1942 1182:104E 1184:4EC2 1186:2460 1188:13B0 118A:132A 118C:3C09 118E:93C2 1190:2384 1192:3403 1194:425E 1196:23C8 1198:3FEE 119A:425E 119C:2388 119E:3FEB 11A0:403C 11A2:2460 11A4:0080 11A6:113E 11A8:43F2 11AA:2402 11AC:43C2 11AE:2410 11B0:43C2 11B2:0921 11B4:0110 11B6:93C2 11B8:2382 11BA:2012 11BC:425E 11BE:2384 11C0:F07E 11C2:000F 11C4:2002 11C6:0080 11C8:11A8 11CA:935E 11CC:200B 11CE:93C2 11D0:2384 11D2:3403 11D4:D2F2 11D6:23C8 11D8:3FF6 11DA:D2F2 11DC:2388 11DE:3FF3 11E0:13B0 11E2:10DC 11E4:0110 11E6:93C2 11E8:2380 11EA:3404 11EC:431F 11EE:D3D2 11F0:093C 11F2:3C03 11F4:430F 11F6:C3D2 11F8:093C 11FA:425E 11FC:2380 11FE:B07E 1200:0060 1202:2090 1204:425D 1206:2381 1208:834D 120A:2481 120C:835D 120E:246B 1210:836D 1212:2467 1214:836D 1216:2445 1218:835D 121A:2409 121C:836D 121E:2452 1220:835D 1222:2446 1224:835D 1226:2433 1228:835D 122A:2454 122C:3C7B 122E:930F 1230:2479 1232:425E 1234:2383 1236:835E 1238:2408 123A:835E 123C:240F 123E:807E 1240:001F 1242:241C 1244:835E 1246:2413 1248:3C6D 124A:43C2 124C:0923 124E:40F2 1250:0012 1252:2402 1254:403C 1256:107C 1258:0080 125A:113E 125C:43C2 125E:0923 1260:40F2 1262:0029 1264:2402 1266:403C 1268:10B2 126A:0080 126C:113E 126E:40F2 1270:0024 1272:2402 1274:403C 1276:108E 1278:0080 127A:113E 127C:1132 127E:0923 1280:40F2 1282:0009 1284:2402 1286:403C 1288:10C4 128A:0080 128C:113E 128E:930F 1290:2449 1292:13B0 1294:132A 1296:43C2 1298:2460 129A:42D2 129C:2401 129E:2461 12A0:3C3B 12A2:13B0 12A4:1334 12A6:42D2 12A8:2382 12AA:093F 12AC:0080 12AE:11A8 12B0:13B0 12B2:1334 12B4:42D2 12B6:2382 12B8:2400 12BA:13B0 12BC:11A8 12BE:43D2 12C0:2412 12C2:0110 12C4:43C2 12C6:0923 12C8:43D2 12CA:2402 12CC:403C 12CE:2400 12D0:0080 12D2:113E 12D4:13B0 12D6:1334 12D8:42D2 12DA:2384 12DC:2401 12DE:0080 12E0:11A8 12E2:0080 12E4:11B6 12E6:425E 12E8:2384 12EA:F07E 12EC:000F 12EE:2002 12F0:0080 12F2:11A8 12F4:935E 12F6:2018 12F8:93C2 12FA:2384 12FC:3404 12FE:F0F2 1300:00D7 1302:23C8 1304:3FF5 1306:F0F2 1308:00D7 130A:2388 130C:3FF1 130E:907E 1310:0080 1312:2003 1314:13B0 1316:132A 1318:3F43 131A:907E 131C:0082 131E:2002 1320:0080 1322:115E 1324:13B0 1326:10DC 1328:0110 132A:43C2 132C:0923 132E:43E2 1330:2402 1332:0110 1334:3ED5 1336:8321 1338:C232 133A:4303 133C:40B2 133E:1C02 1340:245A 1342:40B2 1344:2417 1346:245C 1348:40B2 134A:A503 134C:0120 134E:43C2 1350:0121 1352:D0F2 1354:000C 1356:024A 1358:C0B2 135A:0100 135C:016C 135E:3C05 1360:F0B2 1362:FFF4 1364:016E 1366:C3A2 1368:0102 136A:421E 136C:016E 136E:B07E 1370:0009 1372:23F6 1374:40B2 1376:0020 1378:0166 137A:40B2 137C:0253 137E:0168 1380:40B2 1382:0200 1384:016A 1386:40B2 1388:0220 138A:03C0 138C:40B1 138E:012C 1390:0000 1392:3C0A 1394:40B2 1396:5100 1398:03CE 139A:B392 139C:03CE 139E:2BFD 13A0:D2A2 13A2:03C0 13A4:53B1 13A6:0000 13A8:9381 13AA:0000 13AC:23F3 13AE:C0B2 13B0:4000 13B2:03CE 13B4:90B2 13B6:0896 13B8:03DE 13BA:2803 13BC:403F 13BE:050F 13C0:3C10 13C2:90B2 13C4:04C5 13C6:03DE 13C8:2803 13CA:403F 13CC:030F 13CE:3C09 13D0:90B2 13D2:02DD 13D4:03DE 13D6:2C03 13D8:403F 13DA:0117 13DC:3C02 13DE:403F 13E0:0211 13E2:4F82 13E4:2414 13E6:4382 13E8:0160 13EA:40B2 13EC:10F3 13EE:0164 13F0:40B2 13F2:0030 13F4:0162 13F6:40B2 13F8:0244 13FA:0168 13FC:43C2 13FE:240E 1400:43C2 1402:2411 1404:40B2 1406:9628 1408:0900 140A:40B2 140C:1E40 140E:0908 1410:40B2 1412:0080 1414:0904 1416:13B0 1418:17C4 141A:43C2 141C:2412 141E:B2B2 1420:0908 1422:2806 1424:13B0 1426:1696 1428:13B0 142A:14F4 142C:D3A2 142E:0902 1430:5321 1432:0110 1434:B2E2 1436:093E 1438:2814 143A:40F2 143C:0080 143E:0923 1440:3C03 1442:F0F2 1444:00FA 1446:093E 1448:43C2 144A:2410 144C:43C2 144E:2460 1450:43C2 1452:2461 1454:13B0 1456:11E6 1458:B3D2 145A:093E 145C:2FF2 145E:C2E2 1460:093E 1462:421F 1464:0932 1466:907F 1468:000A 146A:200C 146C:13B0 146E:17C4 1470:13B0 1472:1696 1474:13B0 1476:14F4 1478:F0B2 147A:FFF9 147C:0908 147E:D3A2 1480:0902 1482:0110 1484:907F 1486:000C 1488:2006 148A:13B0 148C:17C4 148E:40B2 1490:A504 1492:0120 1494:0110 1496:907F 1498:0012 149A:200A 149C:43C2 149E:0923 14A0:93D2 14A2:2410 14A4:2002 14A6:0080 14A8:10E6 14AA:D2F2 14AC:0920 14AE:0110 14B0:907F 14B2:0016 14B4:2002 14B6:0080 14B8:14F4 14BA:907F 14BC:0018 14BE:200C 14C0:43D2 14C2:2411 14C4:C0F2 14C6:0040 14C8:093E 14CA:40B2 14CC:0080 14CE:0910 14D0:40F2 14D2:0020 14D4:093D 14D6:0110 14D8:907F 14DA:001A 14DC:200A 14DE:13B0 14E0:1696 14E2:F0F2 14E4:009F 14E6:093E 14E8:40F2 14EA:00C0 14EC:093D 14EE:43C2 14F0:2411 14F2:0110 14F4:40F2 14F6:0010 14F8:093C 14FA:43C2 14FC:2412 14FE:43C2 1500:2411 1502:43C2 1504:2400 1506:43C2 1508:2401 150A:43C2 150C:093C 150E:43F2 1510:2402 1512:43F2 1514:2404 1516:43C2 1518:2410 151A:407E 151C:0080 151E:4EC2 1520:0921 1522:4EC2 1524:0923 1526:40F2 1528:008C 152A:0920 152C:40F2 152E:008C 1530:0922 1532:40F2 1534:0003 1536:092F 1538:40F2 153A:0003 153C:092E 153E:4EC2 1540:23C8 1542:40F2 1544:0010 1546:23C9 1548:4EC2 154A:23CA 154C:4EC2 154E:23CE 1550:40F2 1552:0040 1554:23CF 1556:4EC2 1558:2388 155A:43C2 155C:2389 155E:43C2 1560:238A 1562:40F2 1564:0040 1566:238F 1568:40F2 156A:0040 156C:093C 156E:43C2 1570:093E 1572:40F2 1574:00C0 1576:093D 1578:0110 157A:151B 157C:421F 157E:245A 1580:4F5B 1582:0003 1584:430A 1586:4F5E 1588:0001 158A:4F5C 158C:0002 158E:108C 1590:DE0C 1592:4B0D 1594:4F6E 1596:807E 1598:0011 159A:240C 159C:807E 159E:0006 15A0:2414 15A2:826E 15A4:201B 15A6:522F 15A8:421E 15AA:245E 15AC:822E 15AE:13B0 15B0:15E8 15B2:3C18 15B4:531F 15B6:4F0C 15B8:13B0 15BA:1640 15BC:934C 15BE:2002 15C0:434C 15C2:3C0E 15C4:407C 15C6:0005 15C8:3C0B 15CA:90B2 15CC:A5A5 15CE:2456 15D0:2003 15D2:13B0 15D4:17D0 15D6:3FF4 15D8:426C 15DA:3C02 15DC:407C 15DE:0007 15E0:13B0 15E2:179A 15E4:171A 15E6:0110 15E8:155B 15EA:4E0A 15EC:4F08 15EE:4349 15F0:4C06 15F2:4D07 15F4:3C04 15F6:4269 15F8:5318 15FA:5316 15FC:6307 15FE:4A0B 1600:E33B 1602:5B0B 1604:7B0B 1606:4C0E 1608:4D0F 160A:5A0E 160C:6B0F 160E:9F07 1610:2803 1612:2013 1614:9E06 1616:2C11 1618:486E 161A:90B2 161C:A5A5 161E:2456 1620:23EA 1622:4349 1624:1517 1626:160F 1628:4ECF 162A:0000 162C:1517 162E:160F 1630:4F6B 1632:9B4E 1634:27E1 1636:4359 1638:3FDF 163A:494C 163C:1756 163E:0110 1640:151B 1642:430D 1644:403A 1646:FFE0 1648:430B 164A:4A7E 164C:4C0F 164E:5B0F 1650:4F6F 1652:EF0E 1654:DE0D 1656:531B 1658:903B 165A:0020 165C:2BF6 165E:930D 1660:2005 1662:40B2 1664:A5A5 1666:2456 1668:434C 166A:3C13 166C:4292 166E:2458 1670:0144 1672:421F 1674:2458 1676:503F 1678:0006 167A:4F82 167C:0140 167E:43C2 1680:FFE0 1682:421F 1684:2458 1686:503F 1688:0010 168A:4F82 168C:0144 168E:407C 1690:0005 1692:171A 1694:0110 1696:8221 1698:4381 169A:0002 169C:40B2 169E:9628 16A0:0900 16A2:D392 16A4:0902 16A6:4292 16A8:2414 16AA:0912 16AC:40B2 16AE:1300 16B0:0910 16B2:4382 16B4:0914 16B6:4381 16B8:0000 16BA:3C02 16BC:5391 16BE:0000 16C0:90B1 16C2:0064 16C4:0000 16C6:2BFA 16C8:411F 16CA:0002 16CC:4F0E 16CE:531E 16D0:4E81 16D2:0002 16D4:903F 16D6:03E9 16D8:2C03 16DA:9382 16DC:0914 16DE:23E9 16E0:5221 16E2:0110 16E4:4382 16E6:245E 16E8:43C2 16EA:238A 16EC:13B0 16EE:1434 16F0:93D2 16F2:2412 16F4:200D 16F6:93C2 16F8:2411 16FA:200A 16FC:434F 16FE:93C2 1700:238A 1702:3404 1704:425F 1706:238A 1708:F07F 170A:007F 170C:4F82 170E:245E 1710:9382 1712:245E 1714:27EB 1716:9392 1718:245E 171A:3806 171C:425F 171E:1C01 1720:4F82 1722:245E 1724:435C 1726:0110 1728:434C 172A:0110 172C:120A 172E:407E 1730:003F 1732:93C2 1734:23CA 1736:3411 1738:4EC2 173A:1C80 173C:403D 173E:1C81 1740:434F 1742:4C0A 1744:5F0A 1746:4AED 1748:0000 174A:531D 174C:535F 174E:9E4F 1750:2BF8 1752:40F2 1754:0040 1756:23CA 1758:3C01 175A:434E 175C:4E4C 175E:413A 1760:0110 1762:4382 1764:2456 1766:40B2 1768:A500 176A:2458 176C:13B0 176E:1336 1770:13B0 1772:16E4 1774:B35C 1776:2BFC 1778:13B0 177A:157A 177C:3FF9 177E:40B2 1780:5A80 1782:015C 1784:403F 1786:2400 1788:3C04 178A:40BF 178C:574C 178E:0000 1790:532F 1792:410E 1794:910F 1796:2BF9 1798:0110 179A:421F 179C:245C 179E:40FF 17A0:003B 17A2:0000 17A4:421F 17A6:245C 17A8:4CCF 17AA:0001 17AC:432C 17AE:0080 17B0:17B2 17B2:4CC2 17B4:2416 17B6:403C 17B8:2416 17BA:13B0 17BC:172C 17BE:934C 17C0:27FA 17C2:0110 17C4:4303 17C6:403F 17C8:2EDE 17CA:533F 17CC:2FFE 17CE:0110 17D0:151D 17D2:0110 17D4:FFFF 17D6:FFFF 17D8:FFFF 17DA:FFFF 17DC:FFFF 17DE:FFFF 17E0:FFFF 17E2:FFFF 17E4:FFFF 17E6:FFFF 17E8:FFFF 17EA:FFFF 17EC:FFFF 17EE:FFFF 17F0:FFFF 17F2:102E 17F4:3CA5 17F6:C35A 17F8:FFFF 17FA:1000 17FC:FFFF 17FE:FFFF
Does the code in this memdump make any sense?
Its tough to tell exactly, looking at the output, but it seems correct (I just see a couple familiar words there). Plus, as you say, the BSL works via other invoke methods.
This is tricky, setting the PC to 0x1000 should work exactly like the other invoke. Perhaps it's just not being registered correctly on the host side?
Problem solved... I've got to identical PCB's here, but only one has the JTAG sodered on. I was trying to get it to work on the PCB with the JTAG, but as described before I was not having any luck getting any useful data with the debugger. It seems now that this HW has got a problem with the BSL.
On the other PCB (without the JTAG) I was always only loading the firmware over the USB (by pulling PUR low). This is the HW I also used to generate the memory dump. On my working USB code I was not calling USB_disconnect(); and USB_disable(); before invoking the BSL. Turns out this is needed and now it works (on the one PCB). This is the code I use:
{
typedef void (* __data16 functionpointer)(void);
const functionpointer bsloader = (functionpointer)(0x1000);
USB_disconnect();
USB_disable();
SYSBSLC &= ~(SYSBSLPE);
//disable interrupts
__disable_interrupt();
// enter BSL
bsloader();
}
Thanks for your excellent support!
Hello :
I am beginner with BSL... I try to implement the same thing and I have the same symptom than described in this post. I use a MSP430F5529.
When the JTAG is connected to the MCU I can trigger the BSL code from a software call using USB communication (pid / vid 0x2047, 0x0200) and process normally my firmware update (I use the RAM_BSL.00.05.04.34 file ) . But when the JTAG is not connected I can't trigger the BSL via a software call (the pid/vid is still 0x2047, 0x300). The PUR is pulled low with a 1M resistor...
Any help would be appreciated...
Thank you very much
Cedric
[edit] When the JTAG is connected I use the CCS debugger environment...
My symptoms were slighty different. The one the board with the JTAG soldered on, the SW invokation of the BSL would never work, even when the JTAG is not connected, so I think that I must have stuffed something up on this board (either BSL firware or even the HW). I'm using my other board now (no JTAG connector has ever been soldeder on) and this has been working fine ever since. If you can, it would be worth maybe trying with a new board (or new CPU at least), and try to get it to work withour ever using JTAG (or SpyBi Wire).
Thanks for your suggestion, I think I have found out where my problem was... I continue to investigate and I will post it here for the benefit of TI community.
Thanks and have a great day,
Regards,
Cedric
I have exact the same problem and adding "SYSBSLC &= ~(SYSBSLPE);" won't fix the problem, what else could be wrong? I can do the flashing with SW3, but just can't enter the BSL via software. Without SYSBSLC &= ~(SYSBSLPE);, the code execution jump right back to my application, with "SYSBSLC &= ~(SYSBSLPE);", it just stuck, nothing happens unless I recycle the power.
Thanks!
Cedric,
Were you able to solve this problem and invoke the BSL via software? I would appreciate hearing how you did so as I am trying to do the same thing with the MSP430F5529. Thank you in advance.
Regards,
Cory W. Baker
Hello Cory :
Yes I have been able to solve the problem, it was hardware related... (I have an external hardware watchdog which was resetting my uC when switching BSL) The software was working properly.
Hi Cory,
I think the app note USB Field Firmware Updates on MSP430 MCUs might be helpful for you - it describes various different entry methods for different use cases. In particular section 4 talks about different system update models you might use. Section 4.3 will tell you the steps to switch from normal USB function in your application to invoking the BSL - this includes disconnecting from USB in your software and disabling general interrupts before calling the jump to 0x1000.
Regards,
Katie
Hello,
Thank you all, this blog helped me alot!
But now the FW upgrade is failing with the following log:
Opening HID device HID device (vID=0x2047, pID=0x0200, v=0x0105); Unknown manufacturer; @input.inf,%hid_device%;HID-compliant device, Path: \\?\hid#vid_2047&pid_0200#7&14785a30&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Mass erase...
Download full BSL...
Programming...
Programming: OK
Waiting for BSL...
closing HID device
Closed!...
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\msp430usb\msp430_usb\imports\MSP430USBDevelopersPackage_4_00_02\Host_USB_Software\Python_Firmware_Upgrader\build\pyi.win32\Python_Firmware_UpgraderGUI\out00-PYZ.pyz\Tkinter", line 1410, in __call__
File "<string>", line 275, in selectFile
File "<string>", line 180, in doLoad
File "<string>", line 251, in open_connection
File "C:\msp430usb\msp430_usb\imports\MSP430USBDevelopersPackage_4_00_02\Host_USB_Software\Python_Firmware_Upgrader\build\pyi.win32\Python_Firmware_UpgraderGUI\out00-PYZ.pyz\msp430.bsl5.hid", line 101, in open
ValueError: USB VID:PID 2047:0200 not found (not in BSL mode? or try --device)
Can you please help me in resolving this problem.
Thanks & Regards,
Deep
I had the same problem.
The CPU MSP430F5528 did restart after entering BSL from software.
The problem was in using NMI:
SFRIE1 = OFIE; // Enable osc fault interrupt
Then I disabled NMI Interrupt before entering BSL:
SFRIE1=0;
the problem had been solved.
**Attention** This is a public forum