Trainer4Edu.com

 
 

USBDM, designed by PGO

An open source BDM for Freescale
S12(X), 9S08 and Coldfire V1 controllers.

Provides 5V or 3.3V to the target
 with voltage level indicators.

 

 


 

 
  USBDM-1-JS16 features:
  • A single BDM for programming and debugging HCS12(X), 9S08 and Coldfire V1 microcontrollers
     
  • Includes a 3.3V (500mA) regulator and can supply 5V or 3.3V to the target board (jumper selectable).
    This is useful when debugging or programming a target board without power supply.
     

  • Includes a voltage level monitoring circuit with a red LED indicating 5V and a yellow LED indicating 3.3V.
    This unique feature is only available with our USBDM.
     

  • Includes a resettable fuse to protect the USB port of your PC.
     

USBDM    Price:  $25

Win 8.1 Installation instructions: 
( For reference only, software version may be upgraded by the author from time to time)

PGO has provided complete documentation on each of his USBDMs. http://usbdm.sourceforge.net/

Our USBDM-1 is pre-programmed with PGO's firmware version 4.10 for the HCS12.

The installation is done total automatically. You don't even have to connect the USBDM.

The installation steps are as follows ( Do not plug in the USBDM-1 until the step 3 ):

1.  You need to install the CodeWarrior version 5.1 in order to use the USBDM-1 for the HCS12. If you have not installed the CodeWarrior you need to download and install the Code Warrior 5.1. Freescale recently removed the MC9S12DG256 used in many 3rd party boards from the new version 5.2, but kept the MC9S12DG128 used in their own Tower Systems. If you have trouble to find the version 5.1, just email us and we will get it for you.

The size of the file is very large. It will take a few hours to download, so you should first save it on your hard drive in case you need to install it in another PC in the future.

2.  Click http://sourceforge.net/projects/usbdm/, then click Browse All Files, click the version 4.10.6, then download the  USBDM_4_10_6_250a_Win.msi.  It may be better to use this version for the HCS12. The newer version works for CW, but does not work for pgo's flash_programming utility.  Pgo's flash_programming utility is very handy. You can use it to check if your new hardware can communicate with the USBDM.  If it can, your mcirocontroller circuit is working.

3.  After download, click the installer, USBDM_4_10_6_250a_Win.msi, in the folder named Downloads, the installation will be done automatically.

4.  In the Device Manager, check the Universal Serial Bus devices, it should show WinUsb Device. It won't be shown as a virtual com port because it's not a USB to RS232 adapter.  See the picture below:

 

 

To verify the installation of the USBDM without CodeWarrior:

  1. 1. Go to the folder C:\program Files (x86)  and find the folder named "pgo".

    2. In the folder "pgo", click the folder "USBDM 4.10.6.250" then click on a program utility for your microcontroller, For the HCS12, click on the HCS12_Flash HCS12_FlashProgrammer.exe   You should see the firmware and DLL versions on the picture below:

 

Operating instructions:

  • Connect your USBDM-1 to a PC USB port. After one second, the green LED on the BDM should come on and stay on. It indicates that the BDM firmware is installed in the MC9S08JS16.
     
  • Set the target voltage selecting shunt plug on J2 for the correct target voltage, 5V or 3.3V. Be careful not to set at 5V for a 3.3V target board.  Most HCS08 and V1 controllers rated at 5V still work with 3.3V so it can  be defaulted at 3.3V. Our USBDM-1 includes a voltage monitoring circuit. If the target voltage is 5V, a red LED will be on, if the target voltage is 3.3V, a yellow LED will be on and if the target voltage is 4V both LEDs will be on.
     
  • Connect the 2x3 0.1 pitch BDM cable from the BDM OUT (P2) to your target board.
     
  • If you are new to CodeWarrior and never used CodeWarrior, you need to know that you have to open a project file (its file extension is .mcp) in CodeWarrior before invoking the CodeWarrior debugger.
    Otherwise invoke CodeWarrior, open a new project for your target, make sure the MCU type and connection are correct.  For more info. on the CodeWarrior set up and tutorials please visit http://www.evbplus.com/Code_Warrior_hcs12.html
     
  • Click the debugger button.  Read the section of "Using USBDM" on the PGO's web site carefully.  PGO provided USBDM configuration of each MCU family for CW debugger in details. When starting the debugger you will be presented with a small dialogue window and you need to follow PGO's guide to set all options.
     
  • Most the time a new blank CF V1 MCU is locked and the BKGD pin is held low by the USBDM-1. You can cycle the power to unlock it. If the USBDM-1 still does not communicate with a blank V1 chip after cycling the power, then you can use PGO's programming utility, CFV1_FlashProgrammer.exe, in the folder named C:\Program Files (x86)\pgo\USBDM 4.10..6.250 to unlock the blank V1 chip.
     
  • Warning for HCS12 users: Our USBDM-1 uses a built-in resettable fuse to protect the USB port of your PC.  It will cause a small voltage drop when it's connected to a target board. If you use the USBDM-1 for debugging a HCS12 board that has a built-in low voltage detector, such as the MC34064, the LV detector may reset your target board if the board draws large amounts of current (>200mA) that will cause the VCC drop to the level below the threshold voltage of the LV detector (4.75V).  When the LV detector kicks in, the reset line of the HCS12 will be held at low and the USBDM-1 won't be able to communicate with the HCS12. If this happens you should remove the shunt plug on the 3-pin target voltage select header (J2 on the USBDM-1) and use the external 5V from your target board for the USBDM-1.
     

 

Programming application 1:

Replacing D-Bug12 monitor with serial monitor using HCS12_FlashProgrammer:

PGO has provided a cool utility program to turn our USBDM-1 into a standalone programmer without invoking the CodeWarrior.
Warning: To use this feature, your USBDM must be installed successfully.  It should be recognized by the Device Manger.

1.  Download and unzip the serial monitor

2.  Connect your USBDM-1 to a PC USB port ( not a USB hub ) via the USB cable and connect it to the Dragon12 via the 6-pin ribbon cable as shown on the following pictures. ( Please note that it's connected to the header labeled with "BDM IN" ). The power LED on the Dragon12 should be lit.

If the Dragon12 board keeps resetting itself ( the speaker keeps beeping and the 8 port B LEDs below the 7-segment LEDs keep cycling through ), you need to use the AC adapter that came with the package for the Dragon12 and remove the jumper from the J2 on the USBDM, so the Dragon12 will provide power to the USBDM.

The reason that the Dragon12 board keeps resetting itself is that the supply voltage provided by the USBDM dropped too much. It mainly is caused by the resettable fuse on the USBDM.  You also need to make sure that the USBDM is connected to a USB port ( rated at 500mA ), not a USB hub ( rated at 100mA ) and your USB cable length is 6 feet maximum, no USB extension cord is allowed)

On our newly manufactured USBDMs the trip current of the resettable fuse is rated higher so this problem should not occur any more.

 

3.   Run the HCS12_FlashProgrammer.exe from the folder C:\Program Files\pgo\USBDM 4.8.0,
then it brings up the following window.  The picture shows the old version, but works for the new version. pgo upgrades software quite often, we cannot always follow his upgrade.

Notice that the USBDM is detected above.  The versions of the USBDM firmware and DLL are also shown. They should be the same.  The picture shows version 4.8, but the latest version is V4.9.
If the firmware version is old than the DLL version you need to upgrade it, otherwise you may get an error message that says "Failed to open BDM".

If the firmware version is 4.x, you can run PGO's bootloader.exe to upgrade it, but if the firmware version is 3.x, then you need to upgrade it in a special bootloader mode ( by shorting two pads in solder side) and run Freescale's bootloader GUI software, or you can use another BDM, such as USBDM or P & E multilink USB BDM, to upgrade it

 

4. Switch to the Target tab, click the "Detect Chip", notice that the HCS12 MCU is detected, make sure to change it to the MC9S12DG256.  Then click the "Load Hex Files", and browse to the s19 file "sm_and_test_dr12p_rgb_8mhz.s19" and click "Open"


Notice that the serial monitor s19 file is loaded above.

 

5.  In order to program the flash memory you need to mass-erase it first. There is an option for the mass-erase in the DLL version V4.9.
Click the Erase Options and scroll down to the last option, "EraseMass"

 

6.  Finally select the "Program Flash", after a short delay you will see:

 

7.  It's done.  Place the left DIP switch of the SW7 in the "UP" position, press the reset button on the Dragon12, the test program should run.

8.  Disconnect the Dragon12 from the USBDM-1 and place the left DIP switch of the SW7 back in the LOW" position.  Your Dragon12 will be ready to talk to CodeWarrior.

Warning:  We added LCD display routines in D-Bug12 monitor firmware, so the LCD will display a message after power up, but the same message will not appear with the serial monitor firmware and you will only see 16 squares on the LCD. The serial monitor does not have enough memory space for LCD routines.  The LCD routines can only be included in our test program or any user programs.

 

Programming application 2:

Replacing serial monitor with D-Bug12 monitor using HCS12_FlashProgrammer:

D-Bug12 monitor firmware actually consists of two components: Bootloader and D-Bug12 monitor. The D-Bug12 monitor is provided by Freescale in an s29 file.  It cannot be programmed by USBDM, but can be programmed by bootloader.  So this programming application must be accomplished in two steps. At first, you need to use a USBDM to replace the serial monitor with the bootloader, then use the bootloader to install the D-Bug12 monitor.

1.  Download and unzip the Bootloader and the D-Bug12 monitor. (these files are for the Dragon12P-USB board rev. G and rev. H)

2.  Connect your USBDM-1 to a PC USB port ( not a USB hub ) via the USB cable and connect it to the Dragon12 via the 6-pin ribbon cable as shown on the following pictures. ( Please note that it's connected to the header labeled with "BDM IN" ). The power LED on the Dragon12 should be lit.

3.  Following the instructions in the Programming Application 1 to program the bootloader. All instructions apply to this application, only when you click the "Load Hex Files", then browse to the s19 file "Boot_DR12P_8MHz.s19" and click "Open"

4.  When programming is successful disconnect the Dragon12 from the USBDM-1 and place both the DIP switches of the SW7 in the "UP" positions.  Your Dragon12 will be ready to be programmed with D-Bug12 monitor in bootloader mode.

5.  Disconnect the USBDM from the USB cable and put the USBDM aside.  You don't need it anymore.

6.  Connect the USB cable to the USB jack on the Dargon12 board. Make sure that the other end of the USB cable is still connected to a PC USB port.

7.  Before programming D-Bug12 monitor into flash memory you should know what the bootloader is for.

The bootloader allows you to erase/program flash memory and erase EEPROM.  It is mainly used to program the D-Bug12 monitor into flash memory or program user’s fully debugged code into the D-Bug12 portion of flash memory.  The latter allows the Dragon12 board to auto start your code in EVB mode every time the board is turned on or reset.

When you program your code into the D-Bug12 portion of flash memory, it wipes out the D-Bug12 monitor.  You can restore it any time, just as if you were downloading another application program since the bootloader is not erased.  You can erase and program the D-Bug12 monitor portion of the flash memory of the MC9S12DG256 in bootloader mode, but you cannot erase and program bootloader by itself. The bootloader can only be erased by an external BDM via BDM-in port.  See details of 4 operating modes on page 15 of the user's manual.

8. If both the DIP switches of the SW7 in the "UP" positions, press the reset button on the Dragon12 board, the LCD should display the following message:

     “DRAGON12plus EVB”
     “   BOOT  LOADER    ”

9. Invoke AsmIDE, you should see the bootloader menu in the AsmIDE terminal window:

MC9S12DG256 bootloader menu:

 

a)       Erase Flash
b)
       Program Flash
c)
       Set Baud Rate
d)
       Erase EEPROM
?

The option a) will erase the D-Bug12 portion of flash memory, not the bootloader itself.

The option b) will program the D-Bug12 portion of flash memory, not the bootloader itself.

The option c) will set a new baud rate.

The option d) will erase all on-chip EEPROM.

Note:  Some users may accidentally erase the D-Bug12 monitor when entering this mode, so it is important to know how to re-program the D-Bug12 monitor.

To program flash memory with the D-Bug12 monitor:

1).  Enter the option a) to erase D-Bug12 portion of flash memory.  Wait until the bootloader menu re-appears after flash memory is erased.
2).
  Enter the option b), the bootloader will wait for your file.
Do not type any thing on PC keyboard.
3).
  Click the Build button, select the Download option, choose "All Files" for the file type and browse to the file named DBug12v32_DR12P_8MHz .s29 for downloading, then click "open", and you should see the following on the PC screen:

*****************************************************************************
*****************************************************************************
*****************************************************************************
*****************************************************************************
**************************************
a)
       Erase Flash
b)
       Program Flash
c)
       Set Baud Rate
d)
       Erase EEPROM
?

4). It will take 3 minutes to program the D-Bug12 at 9600 baud rate and the bootloader menu will reappear after the D-Bug12 monitor is successfully programmed into flash memory.  Do not touch PC keyboard at this moment because it may erase flash memory again.

10.  Place both the DIP switches of the SW7 in the "LOW" positions. Press the reset button on the Dragon12 board, the LCD should display the following message:

     “DRAGON12plus EVB”
     “
D-Bug12 EVB MODE”