Page 1 of 1

V-USB for 25 MHz

Posted: Mon Aug 15, 2011 11:22 pm
by bla
Hi,

would V-USB work with an ATMega overclocked to 25 MHz? What changes would be necessary?

Re: V-USB for 25 MHz

Posted: Thu Aug 25, 2011 12:15 am
by bla
uhm, over 200 views and no answer?

Re: V-USB for 25 MHz

Posted: Thu Aug 25, 2011 12:18 pm
by Micha
Maybe it's because only the developer can give a definite answer. But generally it should be possible. A very naiv approach would be to clock it with 24MHz instead of 25MHz and insert an assembler nop after each communication relevant low level instruction (inside usbdrvasm12.inc). It won't be possible to achieve higher USB transfer speeds. You can only get more processing time when implementing this.

Re: V-USB for 25 MHz

Posted: Thu Aug 25, 2011 12:40 pm
by bla
Hi, thanks. I don't plan on achieving higher transfer speeds. I just want to make sure USB works as it does with 20 MHz and I want to be able to make use of the extra speed %s in the rest of the project. The poor µC has to do a lot of stuff.
I figure that it would also be possible to disable interrupts for a couple of cycles more than with 20 MHz.
I looked into the different usbdrvasm files for different speeds and tried to compare the code, but it does not make sense to me. There are big differences (not just "extra" cycles) where the speed difference is only marginal. So, yes, I hope for an answer from the developer and an official solution. I think that it would be a benefit to many other users as well.

Re: V-USB for 25 MHz

Posted: Thu Aug 25, 2011 8:46 pm
by Micha
bla wrote:I looked into the different usbdrvasm files for different speeds and tried to compare the code, but it does not make sense to me. There are big differences (not just "extra" cycles) where the speed difference is only marginal.

This I didn't mean. I meant you could take the file which runs at exactly half of the desired speed and add one nop to a single cycle instruction, two nops to a two cycle instruction and so on. By doing this you would slow down communication by a factor of two, which means that it would run at the same speed as it did before. It's a quite naive approach, but it could work.

bla wrote:I think that it would be a benefit to many other users as well.

I'm not sure. As an electronics developer I don't like things like that, as they may run/work in one configuration, while they won't in another config or at other temperatures or they may fail sporadically without any environmental changes.
Because of this the only hardware configuration for AVR/V-USB I'd recommend is the one with a 3.3V low drop regulator and a 20MHz AVR running at 12MHz. This is the only config in which all voltage levels are 100% according to standards and the AVR is not running outside its specs as its allowed to be clocked with 13.3MHz at 3.3V.
(OK, maybe there's another possibility when using bidirectional levelshifters, but they may be hard to obtain if they exist at all.)

Re: V-USB for 25 MHz

Posted: Fri Aug 26, 2011 1:28 pm
by bla
Hi, I know what you meant. It might work, but I don't want to just bloat the code. I'm unsure all the interrupt stuff I do would still be compatible. I'm looking for a clean solution.
The other thing... people of course wouldn't be forced to use it if they don't want to...