Jump to content
jp430bb

Blast from the past: MSP430F1232 BSL flashing

Recommended Posts

[Edit: after posting this, I found out I needed to use the rom-bsl driver for mspdebug.  That works!]

[Edit 2: after a reboot, I no longer have to do anything to toggle the RTS line.]

 

I have a tube of old MSP430F1232 bare chips in the SOIC-28 package, and I thought I'd make an attempt to flash one using a USB CP2102 serial adapter.  However, I haven't been able to flash the chip yet.   :huh:

 

The TEST and /RST pins are connected to RTS and DTR, respectively.  Comparing my scope trace with the timing diagram in SLAU319L Figure 2, the sequence looks right.  

 

post-326-0-76879000-1478376902_thumb.png

 

However, mspdebug reports that the mass erase failed.  

$ mspdebug -d /dev/ttyUSB0 --bsl-entry-sequence="Dr,R,r,R,r,d,R:Dr,dr," --long-password flash-bsl
MSPDebug version 0.24 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2016 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Chip info database from MSP430.dll v3.3.1.4 Copyright (C) 2013 TI, Inc.

flash_bsl: unknown unknown error
flash_bsl_erase: failed to send erase command
flash_bsl_unlock: warning: erase failed
flash_bsl: unknown unknown error
flash_bsl_unlock: send password failed

I also tried the python msp430-bsl.py utility, after making a few changes to run in my python environment, but it also failed.  It at least seemed to sync successfully.  I see more traffic on the BSL transmit and receive lines before they stop pulsing.  

 

In both cases, the BSL transmit pulses seem to stop when the TEST pin goes high.  Could it be that the flasher tools need to hold the TEST pin low until all BSL activity is completed?  

 

post-326-0-04278100-1478377797_thumb.png

 
$ ./msp430-bsl.py --port=/dev/ttyUSB0 --invert-reset -eEvvvV fet120_wdt_01.c.hex
Debug is False
Verbosity level set to 4
Python version: 2.7.12 (default, Jun 28 2016, 08:31:05)
[GCC 6.1.1 20160602]
pySerial version: 3.1.1
action list:
   mass_erase()
   erase_check_by_file()
   verify_by_file()
   reset()
2016-11-05 15:22:55,546 Opening serial port '/dev/ttyUSB0'
2016-11-05 15:22:55,568 ROM-BSL start pulse pattern
Erase check by file...
Erase check segment at 0xe000 68 bytes
Erase check segment at 0xffe4 4 bytes
Erase check segment at 0xffea 12 bytes
Erase check segment at 0xfffc 4 bytes
Erase check by file: OK
Verify by file...
Verify segment at 0xe000 68 bytes

An error occurred:
verify failed at 0xe000
Cleaning up after error...
2016-11-05 15:22:56,821 closing serial port

[Edit: here's what a successful run looks like.]

$ mspdebug -d /dev/ttyUSB0 --long-password rom-bsl
MSPDebug version 0.24 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2016 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Chip info database from MSP430.dll v3.3.1.4 Copyright (C) 2013 TI, Inc.

BSL version is 60.01
Performing mass erase...
Sending password...
Chip ID data:
  ver_id:         3212
  ver_sub_id:     0000
  revision:       10
  fab:            40
  self:           0000
  config:         00
Device: MSP430F12x2/F11x2

Available commands:
    !               fill            power           setwatch_r
    =               gdb             prog            setwatch_w
    alias           help            read            simio
    blow_jtag_fuse  hexout          regs            step
    break           isearch         reset           sym
    cgraph          load            run             verify
    delbreak        load_raw        save_raw        verify_raw
    dis             md              set
    erase           mw              setbreak
    exit            opt             setwatch

Available options:
    color                       gdb_default_port
    enable_bsl_access           gdb_loop
    enable_fuse_blow            gdbc_xfer_size
    enable_locked_flash_access  iradix
    fet_block_size              quiet

Type "help <topic>" for more information.
Use the "opt" command ("help opt") to set options.
Press Ctrl+D to quit.

(mspdebug) prog fet120_wdt_01.c.hex
Erasing...
Programming...
Writing   68 bytes at e000...
Writing    4 bytes at ffe4...
Writing   12 bytes at ffea...
Writing    4 bytes at fffc...
Done, 88 bytes total
(mspdebug) 

Now, the only issue I'm running into is that my MSP430F1232 firmware won't run until I change the DTR status.  I use the following python program to get my firmware to run, but it halts again once the 10s sleep is done.  Is there any way to tell Linux to leave this pin in the proper state?  [Edit 2: after a reboot, I no longer have to do this.  Curious why.]  

#!/usr/bin/env python
import serial
import time

s = serial.Serial('/dev/ttyUSB0')
s.setDTR(False)

time.sleep(10)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×