From: Tomas V. <to...@us...> - 2016-11-02 10:18:17
|
ARM based open source CMSIS-DAP just returns an error in the case of SWJ_Clock 0, Atmel's EDBG and Cypress' KitProg2 in CMSIS-DAP mode do the same. I agree that some clue pointing to adapter_khz would be handy. Discussing CMSIS-DAP clock issue there is one more nonsense: /* max clock speed (kHz) */ #define DAP_MAX_CLOCK 5000 I tested much faster speeds. AFAIK CMSIS-DAP firmware limits maximum safely. The only problem is that user is not informed about actual speed. EDBG actually reaches 10 MHz clock. We should raise the limit to something more permissive (50000 kHz) or remove it at all. Tomas On 01.11.2016 15:06, Andreas Färber wrote: > Hello, > > Testing a new target I noticed that CMSIS-DAP error handling could be a > little user-friendlier. When I connect with just > > source [find interface/cmsis-dap.cfg] > transport select swd > > then I get the following non-telling error message: > > Info : CMSIS-DAP: SWD Supported > Info : CMSIS-DAP: Interface Initialised (SWD) > Info : CMSIS-DAP: FW Version = 1.0 > Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1 > Error: CMSIS-DAP command CMD_DAP_SWJ_CLOCK failed. > > If I add the missing > > adapter_khz 500 > > then I instead get the expected (though not ideal) error message: > > Info : CMSIS-DAP: SWD Supported > Info : CMSIS-DAP: Interface Initialised (SWD) > Info : CMSIS-DAP: FW Version = 1.0 > Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1 > Info : CMSIS-DAP: Interface ready > Info : clock speed 500 kHz > Error: BUG: current_target out of bounds > > I checked the recent cmsis_dap_usb.c history but couldn't quickly > identify any change to that effect. > > jtag_get_speed_khz() is passed to cmsis_dap_cmd_DAP_SWJ_Clock() without > checking for a zero value anywhere. Is it firmware-dependent behavior > whether a zero speed is handled okay or should we always catch this to > emit an error message the user understands? As a compromise maybe check > the argument only in case of error? > > Regards, > Andreas > |