ElTangas / jtag2updi

UPDI programmer software for Arduino (targets Tiny AVR-0/1/2, Mega AVR-0 and AVR-DA/DB MCUs)
MIT License
329 stars 90 forks source link

Add more supported baudrates #55

Closed MCUdude closed 2 years ago

MCUdude commented 2 years ago

Highly related to https://github.com/avrdudes/avrdude/pull/789

One of the limitations with jtag2updi is its upload speed. Since Avrdude supports a maximum of 115200 baud, uploading is rather slow. However, I've submitted a PR where jtag2updi is added to the official Avrdude repo, where I've also added more supported baud rates. 230400, 250000, 460800, 500000, 921800, and 1000000 baud in particular.

If the Avrdude PR gets merged, it would probably make sense to merge this as well?

(It is so nice that the Avrdude has been moved over to Github! I'll have to admit, Savannah+SVN is the reason why I've never touched Avrdude's source code before. Now that it's git/Github, it couldn't be easier!)

ElTangas commented 2 years ago

I was going to do something similar, glad you beat me to it and saved me the effort. Now, extending the jtagice Mk2 protocol is a serious step and we should think hard about it.

So actually, I was thinking about adding a larger variety of speeds (from the work I was doing on avrdude):

static struct { long baud; unsigned char val; } baudtab[] = { { 2400L, PAR_BAUD_2400 }, { 4800L, PAR_BAUD_4800 }, { 9600L, PAR_BAUD_9600 }, { 19200L, PAR_BAUD_19200 }, { 38400L, PAR_BAUD_38400 }, { 57600L, PAR_BAUD_57600 }, { 115200L, PAR_BAUD_115200 }, { 14400L, PAR_BAUD_14400 }, / Extension to jtagmkII protocol: extra baud rates, standard series. / { 153600L, PAR_BAUD_153600 }, { 230400L, PAR_BAUD_230400 }, { 460800L, PAR_BAUD_460800 }, { 921600L, PAR_BAUD_921600 }, / Extension to jtagmkII protocol: extra baud rates, binary series. / { 128000L, PAR_BAUD_128000 }, { 256000L, PAR_BAUD_256000 }, { 512000L, PAR_BAUD_512000 }, { 1024000L, PAR_BAUD_1024000 }, / Extension to jtagmkII protocol: extra baud rates, decimal series. / { 150000L, PAR_BAUD_150000 }, { 200000L, PAR_BAUD_200000 }, { 250000L, PAR_BAUD_250000 }, { 300000L, PAR_BAUD_300000 }, { 400000L, PAR_BAUD_400000 }, { 500000L, PAR_BAUD_500000 }, { 600000L, PAR_BAUD_600000 }, { 666666L, PAR_BAUD_666666 }, { 1000000L, PAR_BAUD_1000000 }, { 1500000L, PAR_BAUD_1500000 }, { 2000000L, PAR_BAUD_2000000 }, { 3000000L, PAR_BAUD_3000000 }, };

Do you think you could add these speeds (even though the fastest ones will most likely not work well) ? I think all the speeds you propose are included, and some extras to give more choice/room for experimentation to users.

MCUdude commented 2 years ago

Do you think you could add these speeds (even though the fastest ones will most likely not work well) ?

Good idea! I discussed this with Jörg Wunch, and he agreed that it was a good idea. I've pushed these changes to Avrdude, so all I have to do now is to rebase this PR and add all baud rates

MCUdude commented 2 years ago

This PR is now rebased and updated!

MCUdude commented 2 years ago

Thanks for merging! The README should probably be updated too, but there's no need until Avrdude 7.0 is released I think.

ElTangas commented 2 years ago

Please resubmit with changes.