Page 1 of 1

BootloadHID, atmega88, TWO IO pins.

Posted: Thu Sep 17, 2009 4:56 am
by Buriedcode
Hi,

I have successfully used the bootloadHID (and avrusbboot) for the atmega88. I have recently built a development board for this chip, with all manner of 'goodies', but it only leaves two IO's for the USB - one of which is the mandatory INT0 (PD2 on the '88). However the only other available pin for USB is PB0.

Now, I realise that some V-USB projects use the attiny45, only using two IO's for the USB, but they are on the same port. When I checked the usbconfig.h file, it requires the port for the USB connections, the plus and the minus to beon the same port, as well as a connection to INT0.

Is there a way to have D+ on INT0 (PD2), but have D- on a different port? (PB0) Or is the interupt purely used as an interrupt and not for reading the USB line? *meaning we still need two lines for reading the D+/-).

If its possible, it would be great, because I've managed to make almost every peripheral available on that board, without dual fucntion pins, meaning that, tecnhically, all interfaces could be used at the same time....and if this works, that includes USB. Meaning one could have a USB to I2C/SPI/UART/PWM/ADC dongle at teh same time - very handy for an engineer for debugging.

Regards,

Scott.

Re: BootloadHID, atmega88, TWO IO pins.

Posted: Thu Sep 17, 2009 6:17 am
by Grendel
The D+ bit can be sampled from the INT0 input. Currently V-USB requires D- and D+ to be on the same port tho, you'll have to move D- to port D or sacrifice another I/O bit on port B for a copy of D+.

Re: BootloadHID, atmega88, TWO IO pins.

Posted: Thu Sep 17, 2009 2:09 pm
by maxi
Buriedcode wrote:Now, I realise that some V-USB projects use the attiny45, only using two IO's for the USB, but they are on the same port. When I checked the usbconfig.h file, it requires the port for the USB connections, the plus and the minus to beon the same port, as well as a connection to INT0.


D+/- must be on the same port, that's true but you can use another interrupt for D+ provided you make sure higher level interrupts are never enabled.
See http://vusb.wikidot.com/examples for more info.

Interestingly, I missed the bit about not using higher level interrupts than D+ at first and have been blissfully using INT0 for my own ends. Sor far I have not experienced any problems with so doing but would certainly not recommend it :?

Re: BootloadHID, atmega88, TWO IO pins.

Posted: Thu Sep 17, 2009 7:09 pm
by Buriedcode
Hi guys,

Thanks for the replies. That is what I feared, since I have already etched and populated the board :) That'll teach me for not fully prototyping before commiting to a PCB.

But its always good to know the restrictions, my fault for not getting fully familiar with the code. I have a solution which I can implement in the second version of the board (swaping PB0 and PD7, since PD7 on the 88 is for a comparator, which I will never use). Perhaps even using the PB pin as a button, for general purpose as well as the bootload condition.

Thanks again, very quick and accurate replies, which is a joy for engineering - its customers who are the vague ones eh.

Scott.