Search found 102 matches

by blargg
Fri Aug 15, 2014 10:48 pm
Forum: V-USB
Topic: USBASP / ISP Programmer as V-USB
Replies: 8
Views: 5835

Re: USBASP / ISP Programmer as V-USB

Yes, it can be used for V-USB (and in fact the USBasp firmware itself uses V-USB). You can easily reprogram the second one with the first. It would be great for a four-button keyboard, as it has at least four I/O pins on the end connector: PB2, PB3, PB4, and PB5: ------ MOSI PB3 | 1 2 | +5V N/C | 3 ...
by blargg
Fri Aug 15, 2014 10:45 pm
Forum: V-USB
Topic: How to add 14.7456MHz to F_CPU supported?
Replies: 1
Views: 2074

Re: How to add 14.7456MHz to F_CPU supported?

To add a new crystal frequency, you need to write a new usbdrvasm147456.s file, which for someone experienced with vusb might take a few weeks. In other words, it's not at all practical. :)
by blargg
Tue Aug 12, 2014 10:58 am
Forum: V-USB
Topic: usbFunctionWrite incorrect length, need help
Replies: 5
Views: 3234

Re: usbFunctionWrite incorrect length, need help

Here's the seller I got mine from for $2.46 individually shipped (mine was ePacket too for USA delivery, so faster and with tracking). m BTW, the original Arduino 328p board used a resonator, so this Baite one is actually improving quality over the official board. I've gotten at least a dozen inexpe...
by blargg
Tue Aug 12, 2014 4:39 am
Forum: V-USB
Topic: usbFunctionWrite incorrect length, need help
Replies: 5
Views: 3234

Re: usbFunctionWrite incorrect length, need help

That's too bad to hear. I got a bunch of those Deek-Robot atmega328p Arduino clones for $2 USD each recently and was hoping I could use some for V-USB reliably. I happened to also get a Baite version of this 328p board for only a little more and it seems to have a crystal oscillator (ceramic ones ar...
by blargg
Mon Aug 11, 2014 9:31 am
Forum: V-USB
Topic: usbFunctionWrite incorrect length, need help
Replies: 5
Views: 3234

Re: usbFunctionWrite incorrect length, need help

Does the 328p board use a crystal oscillator or ceramic oscillator? I've got several 328p boards and they use ceramic resonators, which have lower accuracy and might cause occasional errors. Also, you could enable CRC checking on the V-USB side, and have it at least ignore packets with incorrect CRC...
by blargg
Sat Aug 09, 2014 8:04 am
Forum: V-USB
Topic: is usb connected (the software method)
Replies: 9
Views: 4856

Re: is usb connected (the software method)

If I were in your position, I'd start a fresh test program, without usbdrv, and get the USB detection working on INT1 connected to a switch. Once that worked, I'd get it working with USB D-. And then finally integrate that back into the main code. From what I've learned, on the AVR you generally wan...
by blargg
Fri Aug 08, 2014 9:57 pm
Forum: V-USB
Topic: is usb connected (the software method)
Replies: 9
Views: 4856

Re: is usb connected (the software method)

Have your main code sit in a loop waiting for usbConnected to become true, then light an LED or give some feedback. Does it trigger when you plug USB in (and your project is externally-powered)? Then it's set up right. :)
by blargg
Sat Jul 26, 2014 1:14 am
Forum: V-USB
Topic: ATTINY441
Replies: 2
Views: 2327

Re: ATTINY441

You can use a pin change interrupt for V-USB.

Pullups shouldn't matter since I'm pretty sure that V-USB doesn't ever need them. That is, it either runs the USB pins as outputs or non-pulled-up inputs.
by blargg
Wed Jul 23, 2014 8:49 am
Forum: V-USB
Topic: Where do the requirements for CPU clock accuracy come from?
Replies: 8
Views: 7152

Re: Where do the requirements for CPU clock accuracy come fr

Yeah, the VUSB code checked CRC of every packet, and I had the host send 1000 config packets and verify the one-byte reply they gave. As far as I could tell, I implemented single-cycle synchronization, but it only improved the margin by 0.01MHz in either direction. I put the project aside until I co...
by blargg
Tue Jul 22, 2014 9:39 pm
Forum: V-USB
Topic: Where do the requirements for CPU clock accuracy come from?
Replies: 8
Views: 7152

Re: Where do the requirements for CPU clock accuracy come fr

So, my conclusion is that the allowed clock deviation is 0.35% or 0.43% at 16.5 Mhz for receiving data, and 1.5% for sending. I recently did some experiments with a high-precision clock generator (AD9850) to see how much deviation was tolerated. I tested the 16MHz version of V-USB, and it worked re...
by blargg
Sat Jul 19, 2014 1:27 am
Forum: V-USB
Topic: PowerSwitch using ATMega168
Replies: 2
Views: 2115

Re: PowerSwitch using ATMega168

What pin is D+ on? Which interrupt is being used? INT0 looks to be on PD2, and INT1 on PD3, and only PCINT on PD4. By default it uses INT0 (PD2).
by blargg
Thu Jul 03, 2014 12:10 am
Forum: V-USB
Topic: What is needed for usb stability.
Replies: 7
Views: 3701

Re: What is needed for usb stability.

In a thread a while back someone replied to you that it was 50ms. What's your code doing for 8ms between calls? usbPoll() is generally quick as it has nothing to do.
by blargg
Tue Jul 01, 2014 9:48 pm
Forum: V-USB
Topic: What is needed for usb stability.
Replies: 7
Views: 3701

Re: What is needed for usb stability.

Those provide additional features. Watchdog can reset device if it hangs (though I think these are a bad idea during development as they can hide bugs if you don't notice the reset). Timers provide a timebase for other things you're doing. Sometimes people put a USB reset on the bus in the beginning...
by blargg
Tue Jul 01, 2014 8:23 am
Forum: V-USB
Topic: What is needed for usb stability.
Replies: 7
Views: 3701

Re: What is needed for usb stability.

This is about the most minimal I come up with for an USBasp board (atmega8). #include <avr/interrupt.h> #include "usbdrv/usbdrv.h" int main( void ) { usbInit(); sei(); for ( ;; ) { usbPoll(); } } uchar usbFunctionSetup( uchar data [] ) { (void) data; return 0; }
by blargg
Wed Jun 11, 2014 9:04 am
Forum: V-USB
Topic: Detect Suspend Mode
Replies: 1
Views: 1855

Re: Detect Suspend Mode

I've done this in my keyboard converter by putting the CPU to sleep regularly and having it woken by the USB interrupt or a timeout interrupt that fires when the host is suspended and thus doing no USB activity. Something like static volatile bool usb_inactive; ISR(TIMER1_OVF_vect) { usb_inactive = ...