Page 1 of 1

using different pins

Posted: Mon May 30, 2011 4:21 pm
by Guest
Hello

I know this has been discussed before, but the corresponding thread (http://forums.obdev.at/viewtopic.php?f=8&t=1067&start=15) is more than 3 years old and some things/terms have changed since, so I'm starting a new one.

I am using an ATTINY85 and wish to use PINB3 and PINB4 for USB in order free up PINB 0-2 fpr SPI communication.

Circuit and software are based one the easylogger example and work fine as long as PINB0 and 2 are used for USB. As a first step, I connected D- to PINB4 and D+ toPINB3 and put a wire between PINB0 and PINB4. In usbconfig.h, I changed USB_CFG_DMINUS_BIT to 4 and USB_CFG_DPLUS_BIT to 3. However, this setup already fails, attached to a PC, the device is not recognised. When I solder back D+ and D- to PINB2 and PINB0 and undo the config changes, it appears as a keyboard again. I also tried with PINB0 connected to D-, as suggested in config.h (allthough it should work with D-, too) but no luck.

Is there anything else to take care of? According to the documentation, just changing the USB_CFG_DMINUS / -PLUS setting should work as long as long as one of the wires is connected to INT0. But it doesn't. I measured the connections, double-checked the whole circuit, soldered back the wires to PINB0 / PINB2 a few times - I think the circuit is OK. I also initialised DDRB and PORTB to 0 in main().

Thank you in advance.

Re: using different pins

Posted: Mon May 30, 2011 4:46 pm
by Guest
Maybe I should add that I removed the a/d initialisation and polling function from the code.

Getting SPI going with v-usb on the tiny85

Posted: Thu Sep 08, 2011 9:58 pm
by Tim_BandTech.Com
I'm interested in doing this too, but I haven't tried it yet.
I've only just gotten the EasyLogger going.
I'm not sure that there will be room in the timing to run the SPI port while performing the USB functionality.
Still, maybe with some error correcting software it is possible.
To me, this could become an stdio type of buffered interface for debugging for another avr chip.
Just enough pins to do the job...
This is also the configuration for a programmer, so I would research programmers for the tinyx5 chips also.

Sorry to see so few responses here. I think the problem is that the applications are so divergent that there may be good people who could respond, but your problem is not up their alley. If this SPI / v-usb integrated system works, then it will be the minimal parts/pin count system for that functionality. So maybe we can cajole someone into consideration of this configuration. Then again, maybe we are overlooking something really obvious...

- Tim

Re: using different pins

Posted: Sat Sep 10, 2011 10:12 am
by Guest
Hi,
Guest wrote:I am using an ATTINY85 and wish to use PINB3 and PINB4 for USB in order free up PINB 0-2 fpr SPI communication.

Pls. note that Pin B2 is also the Int0 input pin. V-USB seems to use this interrupt. So if you connect the USB D+ data line to another pin, you have to figure out which interrupt can be used by v-usb. In your case you connect D+ to B3 and therefore you must enable PCINT3 and provide v-usb with the corresponding irpt vector number. But this is clearly described in usbconfig.h -- pls. read the comments!

Here are the relevant entries for usbconfig.h:

Code: Select all

#define USB_CFG_IOPORTNAME      B
#define USB_CFG_DMINUS_BIT      4
#define USB_CFG_DPLUS_BIT       3

#define USB_INTR_CFG            PCMSK         
#define USB_INTR_CFG_SET        (1 << PCINT3)     
#define USB_INTR_CFG_CLR        0
#define USB_INTR_ENABLE         GIMSK       
#define USB_INTR_ENABLE_BIT     PCIE
#define USB_INTR_PENDING        GIFR
#define USB_INTR_PENDING_BIT    PCIF         
#define USB_INTR_VECTOR         PCINT0_vect 


Note that you should avoid using interrupts of a higher priority than PCINT0.


Cheerieo,
Volker.