Saturday, October 13, 2012

Flashing an ARM7 Board with USB-to-Serial Converter

A simple flashing method for UNO32 (data dump via UART0)

This document will show you how to use the UART0 of the UNO32 to perform some simple flashing.
As the UART0 is used for ISP download at NXP chip, UART0 will reserved for those application that don't need two UART and don't need all GPIO.


At UNO32 development, your development PC will connect to UNO32 via the on-board USB to Serial adapter at most time, to download your code to UNO32. So, the idea is we use this already connected channel to dump some information to help us to debug our program. Below is the block diagram.
The USB connection will form a virtual Serial port at the PC, the actual UART signal is connected to the MCU's ISP port. To perform ISP, there are four signals used.
1) TXD (PC to MCU, for data transfer)
2) RXD (MCU to PC, for data transfer)
3) DTR (PC to MCU, to reset MCU)
4) RTS (PC to MCU, connected to ISP pin)
When programming MCU, the FlashMagic will control the DTR and RTS to make the MCU enter ISP mode. Then use TXD/RXD to transfer data.
If we want to use this Serial port, we need to make the correct state on DTR and RTS. Otherwise, the MCU cannot enter your code correctly.
Basically, any PC serial terminal program that has a function for you to control DTR/RTS can do the job. For myself, I use Termite to do it. So, I just show you how to config Termite here.
At the port config, select the port of the Virtual Serial port created by UNO32. The rest is show above (115200 N81). Then, at the Plug-ins, enable the Status LEDs. This will make Termite display all line status as a LEDs, and you can control RTS/DTR by click their LED.
Click [OK] to leave the port setting, you will connected to UNO32 and see those LEDs. To make the UNO32 not enter ISP, you need to turn off RTS all the time. For DTR, turn it on will reset the MCU. So, I will turn the DTR on, then off once to reset UNO32 to enter my code. When I need to download a new code, click the top-left button to release the Serial port. After download, click it again to get the port.
Here is the procedures
1) Use FlashMagic to download you code.
2) Use Termite get the serial port. Then reset the UNO32 via the DTR LED and test my code.
3) Modify my code and genertate a new HEX.
4) Release port at Termite.
5) Repeat step 1 until my code work.


No comments:

Post a Comment