-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terminal mode improvements #1587
Conversation
and add pgm->get_fosc to stk600
It seems to work well for STK500v2, tested under Linux.
|
Sorry for the slow pace, but this is a quite busy week for me with very little spare time. I'll pick this up again as soon as I have more time. |
I think this PR is ready for review. Tested with a Curiosity Nano (UPDI), an AVR Dragon (ISP, JTAG), and STK600 (ISP, HVPP). |
src/term.c
Outdated
if (endp == argv[1]) { | ||
pmsg_error("(sck) cannot parse period %s\n", argv[1]); | ||
if (*endp != 0) { | ||
int suffixlen = strlen(endp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe parse as above? Consider introducing a function so the same code doesn't need to be there twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced the entire implementation with the one you suggested. Would be great if you could have a look at it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it still work as intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot about this. Will check this evening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appears to work perfectly fine!
$ ./avrdude -cstk600 -patmega2560 -t
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9801 (probably m2560)
avrdude: processing -t interactive terminal
avrdude> sck
SCK period = 3.4 us
SCK freq = 296 kHz
avrdude> sck 100
avrdude> sck
SCK period = 100.0 us
SCK freq = 10 kHz
avrdude> sck 120k
avrdude> sck
SCK period = 8.4 us
SCK freq = 119 kHz
avrdude> sck 1MHz
avrdude> sck
SCK period = 1.0 us
SCK freq = 1000 kHz
avrdude> sck 8us
avrdude> sck
SCK period = 8.0 us
SCK freq = 125 kHz
avrdude> sck 6u
avrdude error: (sck) invalid bit clock unit u
avrdude> sck
SCK period = 8.0 us
SCK freq = 125 kHz
avrdude> sck 32
avrdude> sck
SCK period = 32.0 us
SCK freq = 31 kHz
I should be able to give this PR some simple tests over the weekend when I have access to my HW. |
Looks good to me.
|
Extends #1574
sck
command using a JTAG3 compatible programmer (bug was introduced when we added SIB read supportsck
command to set the clock speed in Hz, kHz, and MHz.sck
without a second argument now prints the clock speed in kHz as well as us.jtag3_get_vtarget
andjtag3_get_sck_period
added to jtag3.cTODO:
Test all JTAG2, stk500v2, and stk600 compatible programmers I have to make sure all of them can read the target voltage in terminal mode using
vtarg
, and clock speed usingsck
. When this is done (and missing programmers added), I'll mark this PR as "ready to review".Resolves issue #1329