|
The TinyBDM is a MC9S12DG256 based BDM POD for debugging the HCS12 family,
especially the 9S12C32 and 9S12C128, using D-Bug12 command set. It also can be
used for programming HCS12 internal flash memory on a target board. Its
compact size is ideal for field service technicians and engineers. If you are going
to work on the HCS12 family for a long time, you may need a BDM POD sooner or later.
Either to debug your code or program the flash memory on a target board, the TinyBDM is a good choice for its affordability and
compact size.
Features:
The Tiny
BDM is installed with the D-bug12 V4.00b32 and running in POD mode. It
works with any ASCII text based terminal programs, like AsmIDE, MiniIDE and
HyperTerm, but it does not
work with Code Warrior. The
D-Bug12 firmware acts as a host to access all target MCU resources on your
target board, such as a C32 module, via the BDM port in a non-intrusive manner. It will have all the features that a
D-Bug12 monitor has in debugging the
target MCU. Also, it gains all the
features a programmer has for programming the flash memory of the MCU on a
target board.
Notes
on hardware :
- The two-pin header J2 is used to supply 5V to the target board being programmed. Usually the jumper is installed so the
TinyBDM can supply 5V to the target board. If you install a jumper on
the J2, make sure that the target board
is not powered by another power supply.
- When PC receives data the LED turns Red.
When PC transmits data the LED turns Green.
-
If you press the reset button (S1, located just below the USB jack) on the TinyBDM, it will send a message
to
PC, so the LED should flash once in Red.
-
If you press the reset button when the target board is disconnected, the LED may flash many times as the TinyBDM tries to
connect to the target.
Install and verify USB driver:
-
Before connecting the
TinyBDM to your PC's USB port for the first time, make
sure that you do not attach your target board to the TinyBDM.
-
Go to the FT232RL driver
installation and verification page for operating procedures:
http://www.evbplus.com/TinyUSB_9s12/ft232rl.html.
-
Once you have verified that the USB
driver is properly installed, you may
now connect the TinyBDM to your target board. Invoke the AsmIDE.
-
Generally speaking, you should have worked with a
HCS12 / 9S12 based development board before
buying a BDM POD, so probably a
terminal emulation program has already been installed on
your PC. If not, you have to install one of the following programs before
using the TinyBDM:
AsmIDE, MiniIDE, HyperTerm, TeraTerm or any other terminal programs you
prefer.
-
If the
AsmIDE does not communicate with your target board then you need to check if
the COM port number that is assigned by the AsmIDE matches the
USB-to-Serial COM port number that is
assigned by Windows' Device Manager. The Device Manager assigns the
USB-to-Serial COM port number randomly and it does not know which COM port
number that AsmIDE is going to use.
In order to find the USB-to-Serial COM port number
that is assigned by Device Manager, you can click through
"Control Panel -> Systems -> Hardware -> Device Manager -> Ports".
The
USB-to-Serial COM port number will appear (In Windows Vista, you left click
on Start, right click on Computer, left click on propriety, then Device
Manager and then Continue).
For setting the COM port of the AsmIDE to match that USB-to-Serial COM port
number, you can click through "View-> Option->Terminal Window Options" menu,
then select the correct COM port from COM1 to COM8.
Note:
In order to establish a reliable USB
communication, always connect the TinyBDM to your PC's USB port first
before invoking the AsmIDE, otherwise the AsmIDE will not be able to
find a COM port. When the programming is done, always close the
AsmIDE first before unplugging the USB cable from the TinyBDM, otherwise
the AsmIDE may hang up and you need to re-establish USB communication again.
As long as you keep the TinyBDM
connected to your PC's USB port, disconnecting the TinyBDM from
your target board will not lose USB communication.
In case the AsmIDE hangs up,
you need to close the AsmIDE first, then unplug the USB cable from
your TinyBDM, wait a few seconds before re-plugging the USB cable,
then wait a few more seconds and allow the USB connection to be
re-established. After cycling the USB connection you can invoke the AsmIDE again and it may
restore the USB communication. If this does not work, you need to restart
your PC, but in order to avoid this, always close the AsmIDE before
unplugging the USB cable.
If
restarting the PC does not solve the problem, you may need to re-install
the USB driver.
The
steps to operate the TinyBDM are as follows:
-
Connect the 6-pin BDM cable to the
"BDM-in" header on your
target board. The target board can
be any HCS12 board. The target board does not have to be powered by
other power supply since the TinyBDM can provide a
5V to the target through the BDM
cable.
Be careful about cable orientation. The cable is wired pin for pin
and the pin 1of the BDM headers on both boards are clearly labeled. If the
cable is plugged onto a target board reversed (180 degree off) it won't hurt
anything, but it won't work either.
-
Connect the TinyBDM to
any USB port on your PC. The power LED indicator on your target board should
be on.
-
Invoke the terminal
program.
-
Press the reset button on the
TinyBDM, the bi-color LED should
blink once in red color. The TinyBDM hardware should be functioning and the PC screen should display the D-bug12 monitor sign-on message and the
menu.
The newer D-Bug12
monitor automatically detects the crystal frequency on a target board and
establish the communication with the target board. You should see the
following prompt on the screen:
D-Bug12 4.0.0b32
Copyright 1996 - 2005 Freescale Semiconductor
For Commands type "Help"
S>
You
will notice that the debug prompt is “S>” in POD mode, not just a
“>” in EVB mode. The S> tells that this is the POD mode of the D-Bug12
monitor and the MC9S12DG256 on target board is Stopped. Sometimes the prompt could be a
“R>” that means the target MCU is Running.
If you see the “R>”, just type RESET on your keyboard and then <Enter> to reset the target and it will come back
with the “S>” prompt.
R>RESET
<Enter>
S>
At
this point in the POD mode indicated by the prompt "S>", you can
debug the target board using all D-Bug12 monitor commands, like DM, MM, LOAD and
GO commands as if you were using them in EVB mode. The difference is that all
commands are run on the target board, not on the BDM POD. The BDM POD functions
as a command interpreter which receives a clear text (ASCII) command from a PC via a
USB port and converts it to an one-byte command with optional
parameters (Binary protocol) and then sends it down to the target board via the
" BDM-in" port, or vice
versa.
How to use the
TinyBDM to program flash memory on a target board?
(Change D-Bug12 monitor to serial monitor, or
vice versa)
In
2004, Dr, Frank Wornle, a professor at the University of Adelaide in Australia wrote a great tutorial article for using Freescale serial
monitor on our original Dragon12 board. On the first part of the article he clearly
explained the procedures of using one Dragon12 board as a BDM POD to program the
flash memory on another Dragon12 board. It's very helpful for any one who
would like to change the monitor from one type to another on a HCS12 / 9S12
development or trainer board.
You
can download his article from the web site of the University of Adelaide:
http://www.mecheng.adelaide.edu.au/robotics_novell/WWW_Devs/Dragon12/Examples/HCS12SerialMonitor_Dragon12.pdf
If
you have read his article, you can easily understand the programming procedures
so we do not need to repeat here, The Dragon12 board has been upgraded to the
Dragon12 Plus board since 2007. The new Dragon12 Plus added many I/O
peripherals, but has not affected the programming procedures. However, there are
a
few things should be brought to your attention:
-
The
crystal frequency on the new Dragon12 plus is 8 MHz and it was changed from
4 MHz on the old Dragon12 board.
-
The
left switch of the 2-position DIP switch SW7 on the new Dragon12 Plus is
used for selecting RUN or LOAD mode.
-
The
MCU is the MC9S12DG256 on the new Dragon12 Plus board, but it was the
MC9S12DP256 on the old Dragon12 board.
-
Our
serial monitor files are S2 type files and can be directly programmed into
flash memory. So you have to use the FLOAD command, not the FLOAD ;b
command. ( Always use FBULK command to erase flash memory before the
FLOAD commad)
-
The
filename of our serial monitor is different than the filename in his
article. For example, the file name of our serial monitor including a
factory test program for the Dragon12-Plus board is SM_and_Test_DR12P_8MHz.s29.
Anyone who would like to change the D-Bug12 monitor on his or her
Dragon12-Plus board to the serial monitor in order to use Code Warrior
should download this file.
If you double click on the SM_and_Test_DR12P_8MHz.s29.
it will display the file contents on the PC screen as follows:
S2240FE00006E2A9B32AA91D9FA096A98E3486397EB1779570DE6A89648E5EE9000000000004
S2240FE0200000005996548E4FCF4B55471A431D3F583BCA386F354432472F750000000000A3
S2240FE0400000002CCB2A4727E825AA238D218E1FAC1DE51C391AA2192317BA00000000001C
S2240FE0600000001665152413F512D511C710C70FD60EF30E1C0D510C920BDD000000000046
Click on "File" then "Save as" to save it as a text file in your PC, but remember in which
folder it is saved because you need to download it into flash memory using
the FLOAD command later.
-
In order to program the flash memory, you have
to erase it by using the FBULK command.
S>fbulk <Enter>
When the prompt “S>” returns, the FBULK command
has already erased all of the flash memory contents of the target
MC9S12DG256. If it returns with a message “Flash or EEPROM Failed To Erase”
the MC9S12DG256 is defective.
-
Now you type “FLOAD” <Enter> at the prompt "S>",
at this moment do not enter any key on keyboard, just click the Build
button, select the Download option, and select the file named SM_and_Test_DR12P_8MHz.s29
that was just saved. The procedure is like when you download your code
into RAM during a debugging session. You should see the following on the
terminal window when programming is done (when the prompt “S>” appears):
S>fload <Enter>
*****************************************************************************
*******************************
S>
-
Now if you press the reset button the PB
LED indicators will light up from right to left. That indicates that the
serial monitor is successfully programmed in the flash memory on the target
board.
-
If
you ever want to change the serial monitor back to the D-Bug12 monitor, the
programming procedures are the same, but only the file to be downloaded is different. Although the time takes to program the serial monitor at
9600 baud is relatively short, but the time of programming the D-Bug12 will
take more than 3 minutes and the display will look more like the following
with many
lines of stars, and you must be patient:
S>FLOAD
<Enter>
***************************************************************************
***************************************************************************
***************************************************************************
***************************************************************************
***************************************************************************
***************************************************************************
***************************************************************************
***************************************************************************
***************************************************************************
*************************************************************
-
All of our serial monitor files can be downloadable from our
web site at:
http://www.evbplus.com/download_hcs12/download_hcs12.html
|