problem on atmega8 with USB_CFG_IOPORTNAME set to D

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
mov01
Posts: 2
Joined: Fri Dec 23, 2011 4:34 pm

problem on atmega8 with USB_CFG_IOPORTNAME set to D

Post by mov01 » Fri Dec 23, 2011 4:55 pm

Hi,

i am having a problem setting USB_CFG_IOPORTNAME to D getting vusb to work. If i use B instead and connect INT0 additionally to D+ everything works fine, only if i use D as USB_CFG_IOPORTNAME and connect D+ directly to INT0 i cant get it to work. I seems to me, that there is a link between using PD2 as IOPORTNAME and as external interrupt at the same time.

this works:

#define USB_CFG_IOPORTNAME B
#define USB_CFG_DMINUS_BIT 0
#define USB_CFG_DPLUS_BIT 1

and connecting a additional wire between B1 and INT0.

this doesnt work:

#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 4
#define USB_CFG_DPLUS_BIT 2

Does anyone expirienced simillar issues or has any idea why this could happen?

Greetz, mov01

By the way, i recognized that variables inside PROGMEM now needs to be declared as const(wich is in all available vusb-downloads not the case) getting a vusb firmware compiled with a modern avr-gcc.

Peter Chaffe
Rank 1
Rank 1
Posts: 20
Joined: Fri Dec 02, 2011 12:25 pm

Re: problem on atmega8 with USB_CFG_IOPORTNAME set to D

Post by Peter Chaffe » Tue Dec 27, 2011 9:28 am

What code are you using?
Upload it and I'll try it on a atmega328 which i believe is pin compatible with the atmega8...

mov01
Posts: 2
Joined: Fri Dec 23, 2011 4:34 pm

Re: problem on atmega8 with USB_CFG_IOPORTNAME set to D

Post by mov01 » Wed Dec 28, 2011 5:01 pm

Hi,

thanks for your reply.
I have uploaded a modified version of the simple powerswitch reference example. I modified the PROGMEM(const) parts of the code, so that i am able to compile it using my version of gcc:
http://ingo.orgizm.net/vusb/powerswitch_portd.tar.gz
I also modified the parts of code (inside main.c), that modifies PORTD so it wont interfere with the pins on PORTD used for usb-communication.
The config as it is in the upload doesnt work for me. The device wont enumerate properly.

But if you modify the config like

Code: Select all

#define USB_CFG_IOPORTNAME B
#define USB_CFG_DMINUS_BIT 0
#define USB_CFG_DPLUS_BIT 1

everything works just fine.
The code relies on 12Mhz clock-rate.
It would be great if you could check this on your hardware and report me the results.

Thanks in advance,

mov01

Peter Chaffe
Rank 1
Rank 1
Posts: 20
Joined: Fri Dec 02, 2011 12:25 pm

Re: problem on atmega8 with USB_CFG_IOPORTNAME set to D

Post by Peter Chaffe » Fri Dec 30, 2011 12:13 am

Thought I'd give you all of my results so far

PowerSwitch code (default, as downloaded from site):
ie only using pre-compiled hex file.

Code: Select all

used Attiny2313
Flashed with AVRDragon
External 12 mc/s crystal
Fuses:
Ex 0xFF
high 0xDF
low 0xFF

Tested and works fine on:
xp pro 32 bit sp3
W7 home 64bit
W7 enterprise 64bit


PowerSwitch code (as downloaded):
This time compiled in AVRStudio4
Build succeeded with 0 Warnings...

Code: Select all

used Attiny2313
Flashed with AVRDragon
External 12 mc/s crystal
Fuses:
Ex 0xFF
high 0xDF
low 0xFF

Tested and works fine on:
xp pro 32 bit sp3
W7 home 64bit
W7 enterprise 64bit


PowerSwitch code (changed to latest usbdrv dir~ver 20100715):
again compiled in AVRStudio4
Build succeeded with 0 Warnings...

Code: Select all

used Attiny2313
Flashed with AVRDragon
External 12 mc/s crystal
Fuses:
Ex 0xFF
high 0xDF
low 0xFF

Tested and works fine on:
xp pro 32 bit sp3
W7 home 64bit
W7 enterprise 64bit


PowerSwitch code (Your version as uploaded, using portB):
again compiled in AVRStudio4
Build succeeded with 0 Warnings...

Code: Select all

used AtMega328p
Flashed with AVRDragon
External 12 mc/s crystal
Fuses:
Ex 0xFF
high 0xDF
low 0xFF

Tested no good, not even being detected although incuring enumeration:
haven't delved into what might be causing this...
xp pro 32 bit sp3
W7 home 64bit
W7 enterprise 64bit


PowerSwitch code (the standard version, (using portB + jump wire to INT0)):
again compiled in AVRStudio4
Build succeeded with 0 Warnings...

Code: Select all

used AtMega328p
Flashed with AVRDragon
External 12 mc/s crystal
Fuses:
Ex 0xFF
high 0xDF
low 0xFF

working ok, even though i'm getting intermittent drop out (Two tone sounds) it still works reliably
haven't delved into what might be causing this. It could be just the breadboard connections playing up, not sure...
xp pro 32 bit sp3
W7 home 64bit
W7 enterprise 64bit


PowerSwitch code (the standard version, (using portD pins you were using , no jump lead)):
again compiled in AVRStudio4
Build succeeded with 0 Warnings...

Code: Select all

used AtMega328p
Flashed with AVRDragon
External 12 mc/s crystal
Fuses:
Ex 0xFF
high 0xDF
low 0xFF

working ok, even though output channels are in a mess compared to original (main.c not changed)
xp pro 32 bit sp3
W7 home 64bit
W7 enterprise 64bit


Hope this helps a bit!
Not technically based, but a hunch is that bit #0 might need to be used on some chips, ie if neither usb data pins are connected to bit #0 then there could/might be problems.
If this is right then a cure might be using bit #0 and a jump wire to INTO pin, same port (haven't tried it because everything has decided to work atm)...

I'm trying to get the powerSwitch to run on an attiny45 now

Post Reply