SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By enrico_c
#17085
Hi to all,



Some month ago i made a very small USB interface used to make a memory programmer and a small datalogger...

This interface is based on a C8051F320 from SiliconLabs.

Now i'm thinking to interface it to OpenOCD just making some modification to FT2232 protocol.

I'm a begginer with ARM and i know a bit more NEC controllers so if this the new interface is simple to made i can try to add NEC N-Wire( JTAG) format to OpenOCD .....

:?:

What is the simpler way to add a new interface ?

Thanks

Enrico
By mlu
#17091
Hi Enrico

This depends on the capabilities of your interface. I have tried to understand and debug the ft2232 interface ( with some sucess and lots of work ) so here are my thoughts about your idea.

The OpenOCD FT2232 interface writes and reads back blocks of JTAG intstructions.
So if your interface can accept a block of TDI/TMS instructions, clock them out to the attached device and return a block with the corresponding TDO data then
FT2232 code can definitly be adapted to drive your interface.

A large part of the FT2232/FT2XX code just does translations to and from "pure" JTAG high level command structures to the MPSSE (bitbang) instruction format of the FT2232 chip.

in ftd2xx.c the function ft2xx_execute_queue is the main interfce to
parse jtag command structures and builds blocks of simple jtag state commands using
BUFFER_ADD

This is where I would start.

If your interface chip only handles a single TDI/TMS -> TDO transaction for read/write maybe it is better to start with the parallell port driver and the bitbang_execute_queue() function.

I you simply want a good USB/JTAG soultion I would suggest building or buing one using the ft2232 chip. But that is cheating ! :)

Regards
Magnus
By enrico_c
#17128
hello Magnus,

thanks for your startup ideas ...

For the previuos applications i used the INT mode of USB; 64byte per buffer
and a variable polling time... from 1msec to 20msec ....

Using the SiliconLabs standard driver is simple enough to make small interfaces....

Now i look at JTAG instruction to see if they are easy to be implemented on a small controller like 8051 .... i think so .... then i can try to rebuild the OpenOCD project ....

Currently i do not only want a good USB-JTAG solution (i'm testing parallel wiggler adapter) but a multi-JTAG good also for new NEC-V850 series (with a JTAG interface) and maybe a MSP430.

So i will provide 3 or 4 flat connectors, one for each interface.

Currently i get a parallel cable for MSP430, an other parallel for ARM, an other for Altera, an other for Atmel (using PonyProg).

My notebook come with parallel port but new notebook not .... so i think it could be a good idea to design a small all-in-one-usb-programmer-jtag interface.

good luck !

Enrico
By mlu
#17131
Hello Enrico

Yes you can definitly implement a jtag interface on the C8051F320.
The part you must decide is the relation beween the data on the USB bus and the
JTAG (TAP) datastream.

The FT2232 does not really understand jtag so
it is sent a stream of data to be clocked out (and sometimes read back)
This almost like doing USB to SPI , no big problems.

The USB protocol on FT2232 uses a bulk OUT and a bulk IN pipe and consists of
a command byte, optional length byte, and databytes
The command pipe is used for setup and control.
This protocol can be implmented on your prcessor.
http://www.ftdichip.com/Documents/AppNo ... E_Cmnd.pdf

A more interesting poject is to put more understanding of TAP states and JTAG commands on your processor and send higher level command to it.

There are jtag command languages like JEM/STAPL that are used in the PLD world.
http://www.ida.ing.tu-bs.de/academics/l ... jesd71.pdf

Dominic also has some ideas about an advanced jtag interface.
http://openocd.berlios.de/web/?page_id=22


Regards
Magnus
By enrico_c
#17435
Hi Magnus,

The idea of making a high-level JTAG interface is great but i'm not sure so easy for me to be implemented .... (i do not know so much as JTAG works)

I think ... i will start to "clone" some of FT2232 commands and then .... may be it will be simpler to translate blocks of simple commands into one complex command (just using spare command codes...)

The controller come with only 16Kbytes of program flash memory ... the USB support eates about 3-4Kbytes so i'm not sure we can have enough space for complex function ..... let me try.....

Now i'm drawing the new board and in september i will get the first two samples (using prototiping board service).

I just can try to do some experiment rebuilding from source .... and testing with an other sample board ...

I talked to Lanconelli about his PonyProg and the needs to find a new usb interface ..... may be openocd could become a server also for a programmer interface like PonyProg......

Regards

Enrico
By kawk
#17940
Hi,

I've recently written 8051 C code that somewhat emulates a FT245BM as it is used in Altera's USB-Blaster (just another USB-JTAG interface). The FT245 is less complex compared to the FT2232 and has no MPSSE; Altera uses an additional CPLD to accelerate JTAG transfers. Just today I evaluate if it's reasonable to add support for the USB-Blaster to OpenOCD, and maybe I'll publish some code for OpenOCD within the next few days.

http://www.ixo.de/info/usb_jtag/

The code is for Cypress FX2 USB Controller, but Antti Lukats wrote me it should be possible to port it to the SiLabs C8051F326. I don't know if he succeeded yet, though... Furthermore, the emulation is not complete, but is complete enough so that the FTDI DLL and libftdi don't crash and it can be used with Altera tools in Windows and Linux.

Maybe you can base your SiLabs code on my FX2 code?

Regards,
Kolja Waschk
By enrico_c
#17970
Hello Kolja,

Now i try to download your code .... may be it will be useful .....

since also NEC mini-programmer uses a FTDI 232 or 245 ... i don't remember.

I see VID-PID changes from products .... i can provide a dip-switch to select what kind of pid return at enum-time...

I used C8051F320 because i get some sample and more i like to test vtarget (the F326 comes with no ADC).

Last days i prepared a pair of pcb design to be prototyped soon:

The first comes with 5 jtag / programming connectors (i just need to add a boost converter to generate PIC vpp).

The second comes with only 1 connector and is a an ARM-JTAG-20pin-standard connector (the board is 28x22mm, the idea is to plug it directly into the target connector).

I made the second board because last days i tested a wiggler jtag adapter onto a new ATSAM7 board and i found some connection problems.

That problems were only due to connection and long cables..... now i need to connect the wiggler directly to the parallel port ...

So the first interface i need is a small (directly pluggable) ARM-JTAG board.


Thanks

Enrico