[SOLVED] MAX3421E in peripheral mode (aka MAX3420E)

Hi,

long things short: trying two days to get a USB 2.0 Host-Shield Arduino Mini 3.3V working on a Arduino Nano 5V.

Though it’s not in term of electrics, but rather the USB-Communication itself.
After approx 6h I found out that peripheral mode + PC-USB does not work well with 3.3V - VBus, I used the 5V - VBus-modification described at Circuits@Home and came to a much better result…

So, what is my problem exactly…?!

→ SPI is working great, at least up to DIV8; anything slower will let the chip (MAX) stop working. Consider this as OK.
→ Prior finding out the VBus-problem, it was that the USB-Reset was recognized by the MAX, BUT a USB Done Reset was NEVER recognized.
→ The bmVBGATE-option was out of question: the mini-board has the VBCOMP-pin floating. My soldering iron is just too coarse to catch that tiny pin, to connect it properly according to the specs
→ I cut the trace to VBus and connected it directly to VRAW which is powered by the “motherboards” 5V; so the whole board is powered by VRAW, instead of 3.3V
→ Now USB-Done Reset was recognized by the MAX
→ Side-Effect: no signal recognition in USB hubs anymore…

Ok, according to the USB specification after USB Done Reset has been set a SETUP request (SUDAVIRQ on the MAX) shall be sent by the host (PC)…

Well, that’s where I hang… I read up and down several specs, bit banged USB implementations, MAXIMs “Bringing up the MAX3421E” and so on…

I just don’t get it to work… I even hacked down the sample code from MAXIM itself without success…

Though, “no success” would be a lie… just out of random (I DON’T know why) I got 5 SUDAVIRQ this morning… Windows complaining “USB Device can’t be recognized”
Happily I saved away the code and began to rewrite everything nice and tidy… 6h later I tried again and NOTHING… Tried the backup code → NOTHING

So, as all the projects for this shield out there are in HOST mode: has anyone done a peripheral setup on this shield directly connected to the PC-USB?

I’m gonna attach the hacked together code (as this is quite the same functionality in the tidy version, but totally ugly).

By the way I have no oscilloscope at home; will buy one within the next two months…

If anyone would be nice enough to help or to verify the code on his/her hardware… that’d be awesome 8)

I wan’t to exclude electrical problems/phenomenons in the first place… If someone replies that it’s working without modification… then I really have an electrical problem; but then we need to figure out where[…]

Thanks in advance!

Kind regards,

P.S. it’s not working with Linux either; Linux issues up to 10 BUS-Resets but doesn’t send a SUDAV in the end as well…


DEBUG output

Connect within 5 seconds!
**************************
* setup                  *
**************************
**************************
* connecting             *
**************************
Revision: 0x13
**************************
* ENTER                  *
**************************
rEPIEN: 0x0
rEPIRQ: 0x19
rUSBIEN: 0x80
rUSBIRQ: 0x88
IN3BAVIRQ!
URESIRQ
**************************
* EXIT                   *
**************************
rEPIEN: 0x0
rEPIRQ: 0x9
rUSBIEN: 0x88
rUSBIRQ: 0x80
**************************
* ENTER                  *
**************************
rEPIEN: 0x0
rEPIRQ: 0x9
rUSBIEN: 0x88
rUSBIRQ: 0x80
URESDNIRQ
**************************
* EXIT                   *
**************************
rEPIEN: 0x30
rEPIRQ: 0x9
rUSBIEN: 0x88
rUSBIRQ: 0x0
**************************
* ENTER                  *
**************************
rEPIEN: 0x0
rEPIRQ: 0x19
rUSBIEN: 0x88
rUSBIRQ: 0x88
IN3BAVIRQ!
URESIRQ
**************************
* EXIT                   *
**************************
rEPIEN: 0x0
rEPIRQ: 0x9
rUSBIEN: 0x88
rUSBIRQ: 0x80
**************************
* ENTER                  *
**************************
rEPIEN: 0x0
rEPIRQ: 0x9
rUSBIEN: 0x88
rUSBIRQ: 0x80
URESDNIRQ
**************************
* EXIT                   *
**************************
rEPIEN: 0x30
rEPIRQ: 0x9
rUSBIEN: 0x88
rUSBIRQ: 0x0

sketch_jul07a.zip (11.8 KB)

Ok, it was an electrical problem after all...

  1. the little remark "RAW is not connected to the MAX" on the Circuits@Home-Page... Which made me wonder WHY I had proper communication with it... :astonished: - In the end I connected the 3.3V again...
  2. I hooked up 5µF Elko between VRAW and VBus (as stated in the MAX-Datasheet; actually 4.7µF - but I just had 10µF at hand so I put two in series to divide their capacity)

-> Getting proper Setup-Requests each time I plug in the cable...

Maybe as a suggestion for a possible Rev 1.2 of this shield

  • provide a separate via for VBUS-5V connection with a 4,5µF Elko in place
  • connect VBCOMP as in the specs (and not left floating (at least it looks like floating; not even connected to ground)); so that alternate CHIP settings can be used...