Previously, the code would limit the clock to 1Mhz. If a higher clock
was specified, it would be set to 1.024Mhz (0x400 khz).
This commit removes this artificial limit, while still preventing
overflowing the two bytes available in the command (effectively limiting
to 65535 kHz).
The original limit seems inappropriate, because the JTAGEICE3 and ATMEL
ICE actually support higher clocks than the old limit. For SPI, the
JTAGICE3 documents supporting up to 1.875Mhz and the ATMEL ICE up to
5Mhz. In practice the JTAGEICE3 (with the newer EDBG version where it
becomes pretty much identical to the ATMEL ICE) also works up to 5Mhz.
When trying to set higher values, the behaviour seems to depend on the
current value. The programmer seems to either keep the previous value
(e.g. from 3Mhz to 10Mhz), or use 8kHz / 125μs (e.g. from 5Mhz to
10Mhz). In any case, the value read back afterwards (and printed with
-v) reflects the actual value.
Also note that the code also applies a lower limit of 1kHz (to ensure
the raw value sent to the device, in kHz, is never zero), but in
practice sending a value of lower than 8kHz ends up setting 8kHz
(125μs). This is also the minimum value in the device documentation.
This commit was tested with:
Programmer Type : JTAG3_ISP
Description : Atmel AVR JTAGICE3 in ISP mode
ICE HW version : 2
ICE FW version : 3.55 (rel. 130)
Update the GPL version 2 text to the current text as published at
https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
The changes are
* the updated mailing address of the FSF
* reference to LGPL with name change ("Library" -> "Lesser")
* whitespace formatting
* "write to" new FSF address to get a copy of the license
instead of "seeing http://www.gnu.org/licenses/"
* Use libusb to switch a PICkit4 or SNAP to AVR mode
* Fix case
* implement -xmode=pic
Thanks Wireshark
* Print PIC switch info messages
* Fix typo
* Rename SNAP and PICkit4 USB PID
* Make it possible to enter avr mode even when the tool is in bootloader/recovery mode
* Add -xmode to docs
* Tweak grammar
* Add -xmode support for pickit4_isp and snap_isp
still need to figure out how to actually trigger the mode switch form stk500v2.c
* Don't print "unable to open port" error on pgm->open softfail
* Add const
* Simplify SNAP/PICkit4 mode switching code
* Formatting
* Add extra argument to jtag3_open_common
This makes it possible to switch SNAP/PK4 modes from stk500v2.c as well, using pickit4_isp and snap_isp
* Improve extended parameter parsing
* Improve error message
* Improve extended parameter parsing
* Immediately exit after a mode switch
* Remove unnecessary line
* Add missing serial_close
* Remove unnecessary else
* Minor code tweaks
* Update docs
* Formatting
* Improve external parameter parsing and error handling
* Remove unused parameter