Anyone used the MAX3421 USB Host?

moxhamj

New Member
I just got a brochure from maxim about theMax3421 usb host. This chip only costs $2.65 and has a SPI interface and can be configured as a host or as a peripheral. Has anyone used this?

If so, hypothetically, how would one handle data coming in at high speed from a USB peripheral device - does it go to the microcontroller at high speed via SPI then the micro has to do something with the data, and if there was a lot of data could a picaxe handle it - eg by streaming out out again at high speed via SPI to a ram chip?

Or am I misunderstanding all this? Advice from our resident experts would be much appreciated!
 

Dippy

Moderator
Hi DrAc, I've been looking at this too. I received the same mailshot a while back and it caught my eye.
And my interest has been revitalised with the Palm<>Data-Logger debate.

On the face of it, it looks quite easy to implement.... (famous last words eh?).
 

krypton_john

Senior Member
I thought some of the bluetooth modules with embedded serial profile stack looked even easier to work with. Yet more FLW.
 

hippy

Ex-Staff (retired)
The Max3420/Max3421 handles a lot of the USB interfacing and is on a par with replacing bit-banged serial with an off-chip UART, but that still leaves a lot to do.

Ignoring enumeration and looking at only what's seen on the micro side of the interface chip, USB is fairly straight forward consisting of point-to-point commands from the master like "here's some data", "gimme data" and sending back acknowledgements and data should be just as simple, but there are I believe timing requirements to be met. USB drivers do / should buffer data and only deal with one command packet at a time, but whether even one packet could be detected, processed and replied to quickly enough by a PICAXE I'm not sure.

I think this would come under 'advanced project' at least; a very handy chip for people who know what they are doing.
 

GetDeviceInfo

New Member
The Max3420/Max3421 handles a lot of the USB interfacing and is on a par with replacing bit-banged serial with an off-chip UART, but that still leaves a lot to do.
Couldn't be farther off. The max3421 is a full on host controller. The USB protocol provides for various methods of transport. I implement the device as a host controller using the PTP protocol for controlling digital cameras.

This protocol uses the bulk transfer method of transport (as does the mass storage protocol). Transmission is packetized. To bulk out to the device, you load the appropriate buffers, then send the packet(s). When reading a device you request a packet (buffered within the controller), use the data at will, then when ready, request the next packet(s) of data.

The control endpoint typically used for enumeration is similar but your packet size is restricted (smaller).

You can utilize isochronous transfers, which is akin to data streaming, however it should be reserved for data streams where some losses are acceptable, such as audio data stream.
 

moxhamj

New Member
Sounds very interesting. Could you please post some more details of what you are doing, eg code to talk to a camera?
 

hippy

Ex-Staff (retired)
The max3421 is a full on host controller.
Thanks for putting me straight. Maxim haven't put the datasheet on their site so I only had their brief overview to go on. This sounds far more useful than their overview indicated to me, more like the ENC28J60 used for Ethernet interfacing, with more on-chip than I'd given it credit for.

As you've done this; how complicated is the software side of things ? Is it feasible with a PICAXE or for hobbyists ?
 

hippy

Ex-Staff (retired)
Thanks for the datasheet link - I don't know why Maxim make it "on request" only - Never thought of looking elsewhere for it :)

It does seem far more capable than I gave it credit for, so Maxim shot itself in the foot a bit there.
 

GetDeviceInfo

New Member
I actually use an Atmel 8051 core device, but do all of my programming in C+, so should compile to the pics.

USB is very usable for the hobbyist. Go straight to Maxim's site for datasheet and programming suggestions. http://www.maxim-ic.com/appnotes.cfm/appnote_number/3785

When used in a multiport(hub) system, management of the ports via stacks, can be very involved and complicated. When communicating with single device, you can jump over this and get right to the task at hand.

When configured appropriately, the host will notify via interrupt if a device is connected or disconnected (or through polling). Once a device is connected, you determine it's speed, configure the host apporpriately, then proceed to enumeration.

By issuing standard USB commands over the device's control endpoint, you can learn it's identity and capablilities. This is simply done by loading the max3421 buffers with data, then initiating the transfer. Follow this with a data in request and the device returns a response, buffered within the max3421.

Only two activities need to be undertaken, set the device address, select a device configuration. If asked, the device will tell you what configurations it is capable of.

Once enumerated, you then jump over to the specific protocol the device supports. For Canon digital cameras, it is the PTP protocol. All communications now take the form specified by this protocol, over the bulk endpoints (1&2).

A third endpoint exsists for interrupt messaging.

Understanding the USB format is neccessary, as is understanding the particular protocol you wish to persue.
 

circatek

New Member
Hi,

We are currently working on a library for the MAX3421 device which will comply to the Picture Transfer Protocol(PTP). I will post another message once it is available.

Best Regards,
Nigel Evans
Circatek Design Solutions
http://www.circatek.co.uk
 

Dippy

Moderator
... spinnaker unfurled and sailing close to advertising....
no, no, I know you're just informing people.
 
Top