On Wednesday, May 04, 2011 8:08 PM , Øyvind Harboe wrote:
> On Wed, May 4, 2011 at 7:51 PM, Jean-Christophe PLAGNIOL-VILLARD
> <plagn...@jcrosoft.com> wrote:
> > On 04:17 Wed 04 May     , Ųyvind Harboe wrote:
> >> > why do you want to set one the adapter is in auto adaptive mode by 
> >> > default
> >> > no need to set any speed
> >>
> >> OpenOCD doesn't have an auto-adaptive mode, so I guess you need
> >> to explain what you are referring to.
> >
> > on J-Link
> >
> > if you set the speed to 0xffff
> > then the adapter will automaticly adaptive clocking
> 
> Are you talking about RCLK? Sounds like the RCLK support
> in jlink adapter does not report back properly to OpenOCD.
> 
> OpenOCD uses "0" to ->speed() to mean RCLK.
> 
> If jlink has some other magic value, then the jlink driver needs
> to do the translation.


/* Sets speed in kHz. */
static int jlink_speed(int speed)
{
...
        /* check for RTCK setting */
        if (speed == 0)
                speed = -1;

        usb_out_buffer[0] = EMU_CMD_SET_SPEED;
        usb_out_buffer[1] = (speed >> 0) & 0xff;
        usb_out_buffer[2] = (speed >> 8) & 0xff;
...
}
...
static int jlink_khz(int khz, int *jtag_speed)
{
        *jtag_speed = khz;

        return ERROR_OK;
}

So the translation is in place.

The previous behaviour for all adapters when no speed was set in the init 
script resulted in that jtag->speed()  was called with 0 as the parameter.
For jlink (jlink_speed(0)) this resulted in setting the adapter to the RTCK 
mode.
This is not a good default mode because not all target boards supports RTCK.

The at91rm9200-ek.cfg script is fixed by taking the lowest speed setting from 
the reset init procedure. See the patch below.
The same must be done for many of the other board scripts.
If the target board support RTCK then I also suggest that the adapter_khz calls 
is replaced by jtag_rclk. This will benefit adapters with RTCK support.

Best regards
Jonas Hörberg

diff --git a/tcl/board/at91rm9200-ek.cfg b/tcl/board/at91rm9200-ek.cfg
index 07a006b..cf0fb7a 100644
--- a/tcl/board/at91rm9200-ek.cfg
+++ b/tcl/board/at91rm9200-ek.cfg
@@ -18,6 +18,8 @@ $_TARGETNAME configure -event reset-init { at91rm9200_ek_init 
}
 set _FLASHNAME $_CHIPNAME.flash
 flash bank $_FLASHNAME cfi 0x10000000 0x00800000 2 2 $_TARGETNAME
 
+# The chip may run @ 32khz, so set a really low JTAG speed
+adapter_khz 8
 
 proc at91rm9200_ek_init { } {
        # Try to run at 1khz... Yea, that slow!
        # Chip is really running @ 32khz
        adapter_khz 8

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to