MSP430 Debugger
Jaden Baptista & Anthony Rubio
Jaden Baptista & Anthony Rubio
Our project is a device that can read the flash memory of an MSP430G2553 microcontroller. Specifically, we intended to show assembly instructions that have been loaded into the MCU as a learning and debugging tool. This is accomplished through the use of an ESP32S2SOLO which drives JTAG pins on the MSP430. The hex data shown on the right consists of 16-bit instructions which blink an LED on pin 11 of an MSP430, the translation of which can be found in sections 3.3 and 3.4 of the MSP430 User Guide.
To power our project we had to step 5V from the USB to 3.3V using a regulator and a fuse for good measure. The USB data line gives us a serial monitor on a connected computer to debug software problems as the ESP32 is our main compute unit. Finally, we replaced the MSP430G2553 with a socket connector to be able to easily swap MCUs. The connections from the socket to the ESP32 correspond to JTAG pins on the MSP430G2553. We chose an LCD screen that had enough characters to display the longest assembly instruction (20 chars). Finally, due to layout considerations, we moved around GPIO connections.
Back of PCB
The layout itself is fairly straightforward, with net crossing reduced as much as possible while maintaining a useable overall design. Our 3.3V power net is the only one on the back of the PCB and is routed to nearly all components. We also attempted freehand silkscreen art with our HOPE goat on the bottom left.
The footprint for our MSP430 connector was elusive, so we followed the datasheet to design our own and checked it with the help of HOPE staff.
Despite being a common component, we had trouble finding a footprint for the potentiometer and used the datasheet to create our own.
In order to read data from both flash and non-flash (RAM/peripherals), the JTAG interface can be used. This interface is designed to debug the MSP430G2553, including features to verify pin connections and—in our case—read and write to flash memory. We read the MSP430 JTAG programming guide (more like memorized) and implemented our own bit-banged driver via GPIO pins on the ESP32.
As far as we can tell, JTAG implementations are usually fairly sophisticated and primarily hardware. Due to the limitations of our GPIO implementation we have to make do with a seriously low JTAG clock speed. This means that we can't write to flash memory, however we can read it which is enough for this.
Without getting into too many specifics, we use the JTAG pins to control the test action port (TAP) finite state machine. From there we can load data to two registers: the JTAG instruction register (IR) and data register (DR). On the left you can see that the IR is loaded with an 8-bit JTAG instruction (Table 2-5) such as IR_DATA_16BIT which allows for control of the memory address bus. The DR is then loaded with corresponding data, and through sequences of JTAG 'assembly' instructions we can execute higher level functions (Section 2.3.2.2). One of which is able to read data from flash memory.
Unfortunately, due to time constraints, we weren't able to translate the hex data we receive from JTAG into human readable assembly instructions. We can still verify the program is loaded into flash memory, though!
Through this project we learned a ton about the process of going from idea to hardware device: designing a schematic, writing a BOM, creating a layout, and scouring technical manuals. Having both taken EECS16A last semester and EECS16B this semester, it was interesting for us to see the differences between EE theory and practical hardware design. We began by using a voltage divider hooked up to a unity gain buffer as our step down from 5V to 3.3V, but quickly learned that in the real world regulators are the way to go. A lesson we learned is that it is hard to estimate the time requirement of a project when you have little experience in the technical parts of it. While we assumed that the JTAG implementation would take a significant portion of the time we allocated to the project, we didn't estimate it properly and ended up unable to finish the translations. If we were to start this project from scratch, we would spend more time looking for JTAG implementations that other people have made, such as Texas Instruments, and used that as a starting off point. While this was a misstep, through it we learned the specifics of how JTAG interfaces work. Overall this project has been fun and rewarding, and we plan on finishing it over the summer!