General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
-
rjburke377
- Posts: 7
- Joined: Tue Oct 06, 2009 7:01 am
Post
by rjburke377 » Tue Oct 06, 2009 7:23 am
I'm trying to get hid-data example to work on tiny2313. I only had a 16M crystal and have been fighting for a few days trying to get this to work. No joy yet.
Found a couple of very minor bugs ... I think:
Code: Select all
int main(void)
{
uchar i;
wdt_enable(WDTO_1S);
DBG1(0x00, 0, 0); /* debug output: main starts */
odDebugInit();
...
}
DBG1() statement used before odDebugInit().
Looking at odDebugInit()
Code: Select all
static inline void odDebugInit(void)
{
ODDBG_UCR |= (1<<ODDBG_TXEN);
ODDBG_UBRR = F_CPU / (19200 * 16L) - 1;
}
DDR for Tx is not set as output. Tiny2313 is a few hundreds bytes short of memory to compile /w debug anyways. Would be nice to support double clock rate too.
Mailman just dropped by and left me a bunch of Tiny45's. Will try this part instead. 12Mhz crystals should arrive in the next day or so. This is a lot harder than expected.
/RJ
-
rjburke377
- Posts: 7
- Joined: Tue Oct 06, 2009 7:01 am
Post
by rjburke377 » Wed Oct 07, 2009 1:05 am
Wow. Got the Tiny45 to enumerate right away using internal PLL oscillator at 16.5MHz. What a pleasant experience compared to the Tiny2313 at 16MHz. I'll program the other 10 Tiny45 chips to see if they respond in the same way. Fingers crossed.
I got an AVRISP mkII to calibrate the Tiny45 internal oscillator should it be needed. I've seen questions about the process. It is described in avr053: calibration of the internal rc oscillator.
Will try the Tiny2313 again when the 12MHz crystals arrive. The 16MHz crystals didn't work at all but to be fair they've been in my electronics bin for 10 years. Still, they appeared to function correctly. Looking forward to having things work with the new 12MHz crystals. Fingers and toes crossed for extra luck. I hope this expression translates otherwise it will sound silly.
/RJ
-
christian
- Objective Development
- Posts: 1443
- Joined: Thu Nov 09, 2006 11:46 am
Post
by christian » Sat Oct 24, 2009 10:51 pm
rjburke377 wrote:DBG1() statement used before odDebugInit().
Thanks for this hint! It's indeed a bug!
Regarding the 16 MHz version: Have you checked with a simple non-USB program which blinks an LED that the clock rate is OK?
-
rjburke377
- Posts: 7
- Joined: Tue Oct 06, 2009 7:01 am
Post
by rjburke377 » Wed Oct 28, 2009 4:55 am
Yes, that exactly what I did to test the crystals.
Now that I have some experience with V-USB I also have more confidence using your software. It was probably a setup issue. I suspect I had the 1.5K on D+.
The 2313 is useless for me anyways because of the limited available memory.
Thank you for response Christian.
/RJ