Using USBDM to burn K60 on a tower board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using USBDM to burn K60 on a tower board

1,986 Views
AlexHarford
Contributor II

As part of design validation, I would like to test burning the K60 MCU on a tower board without the built in JM60. I'm using the board purchased from ebay, recommended by pgo:

USBDM Emulator BDM Kinetis ARM Support K60 HCS12 HC08 DSP Coldfire | eBay

I'm running CentOS Linux so I've done some tweaking to get it to build.

I've built a cable that I am reasonably sure is working. I'm connecting from the port labelled JTAG (I believe this is the 'DSC' Connector for USBDM). I can provide the pinouts for the two connectors if people are interested. I believe I've successfully read the IDCODE using the TCL interface:

% openbdm

% settarget JTAG

% jtag-idcode

Number of devices => 1

initialiseJTAGChain(): Total length of JTAG IRs => 4 bits

initialiseJTAGChain(): JTAG IR chain => '0001 '

Device # 1: JTAG IDCODE = 4BA00477

But now I'm wondering which utility to use to actually burn an image. The ARM_FlashProgrammer isn't able to detect the chip, so I'm left wondering if that's the right one to be using. Is there a proper way to do this via the command line?

PS. Has anyone tried using the USBDM with OpenOCD? I've successfully burned the K60 using the onboard JM60 with OpenOCD, but the two USB interfaces seem to be quite different between USBDM and OSBDM/JTAG.

Tags (3)
0 Kudos
3 Replies

625 Views
pgo
Senior Contributor V

Hi Alex,

I'm not sure what is going on in these forums!  I posted my reply here but it seems to have become mixed up with an unrelated reply in a different thread. - Oh well It seems more sensible to continue the discussion here.  I hope you find this posting Smiley Happy.

I have quoted your reply here for context.  Please see my response further down:

Alex Harford replied  2 global.days ago

Thanks for the quick response!

When click the 'Detect Chip' button, it returns with a message: "Failed to read any chip IDs from target".

However I should note that the Device Database is failing to load, I'm not sure if that has any affect.

I'd like help with openocd if possible. I've used libusb a few times, and I have experience with porting the ft2232 board to a different layout. This is a bit bang interface, so yes, it is slow, but I'm not too concerned about speed.

The OSBDM interface I was looking at is here:

http://openocd.git.sourceforge.net/git/gitweb.cgi?p=openocd/openocd;a=blob;f=src/jtag/drivers/osbdm....

It seems like there are just two commands: Set/clear srst, and send a TMS+TDI bitstream then read TDO. I looked at the USBDM code and didn't see any equivalents, as it looks like TMS is automatically controlled by the JM60. Is that a correct assumption?

The routines I found in the DLL seem like they don't really map to what OpenOCD wants to do with its queue of commands:

USBDM_JTAG_Reset()

USBDM_JTAG_SelectShift()

USBDM_JTAG_Write()

USBDM_JTAG_Read()

USBDM_JTAG_ReadWrite()


You won't get a useful response from the programmer unless it can load the device database as this describes how to identify the target amongst other things.


You can more thoroughly  check the BDM out (without the programmer) using the TCL code:

openbdm

settarget ARM

reset s h

connect

regs

wpc 100

wreg 0 100

regs


If the above works then the low-level stuff appears OK.


The USBDM API as it stands does not suit the low-level interface used by the section of OpenOCD that you have referenced.  There simply is no equivalent communication.  The BDM firmware works at the register level for the most part i.e. it knows how to connect to the target, read/write registers and memory etc.  This is much more efficient that working at the JTAG bit-stream level since it removes the latency involved in the USB communication. (Yes I know that the JTAG streams end up being buffered but Is still much more efficient).   It also allows handling non-JTAG protocols such as that used by the HCS08 and Coldfire or indeed the later Cortex devices (SWD).  OpenOCD does also handle these but I presume this is done on a different level of the OpenOCD code. 


I'm also not sure what advantage there is in implementing an OpenOCD JTAG interface.  The main advantage of USBDM is that it provides a Codewarrior interface (of limited use to Linux I know!) and convenient programming utilities for the Freescale devices.  Adding in OpenOCD would just be competing with much more widely supported JTAG dongles and not really adding any useful advantage. I prefer to improve the flexibility of USBDM by implementing features that make it more useful.  I see the GUI programmers and the GDB server as being useful in this regard.


Having said that I would be happy check if I can add the required interface but this may not be possible as there is not much flash left in the JS16 versions.  JS60 would be possible.


bye

0 Kudos

625 Views
AlexHarford
Contributor II

Ok, thank you very much. Hopefully you'll find this post.

I've been able to burn the JM60 on the tower via the BDM port and use the low level commands to access the K60 via the ARM 20p port so it looks like the wiring is correct.

The ARM_FlashProgrammer still fails to detect the chip. When I click on Detect Chip it seems to go through some attempts to read from the chip. In the 'Filter by Chip ID' line it says '01CA' and (No matching device) in the drop down list.

Is there anything I can do to troubleshoot this? I'll try to attach a screenshot if you want... still working on figuring out this forum. :smileygrin:

0 Kudos

625 Views
pgo
Senior Contributor V

Hi Alex,

I have a TWR-K60N512 and the Kinetis devices is a PK60N512VDM100 which identifies as 014A when auto-detected.  You can update the arm_devices.xml file and just add/modify the SDID entry with your number if you wish.  Make sure you find the most appropriate entry as there are some quite similar ones.  Also the number should be anded with 0xFFFF0FF0 since some bits are ignored.

In any case I think you should be able to manually select the device in the programmer as most of the entries are 0 which means I don't know the correct magic number.  The programmer won't offer these when auto-selected but will not complain if manually selected.

Finally - If you have some success let me know what the exact number of the device being used is and I will update the file for future versions.

bye

0 Kudos