MCF52211 USB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCF52211 USB

3,098 Views
seanmac
Contributor I

I am currently doing a design using the Coldfire MCF52211CAE66 CPU implementing USB.

 

Should one use an external crystal / oscillator for this, or is the on-chip relaxation oscillator accurate / stable enough for use with USB?

 

Are there any application notes around for implementing the CMX USB stack from a new project? There are a number of example projects around for other Coldfire micros, but I am wanting to know how to include / add the CMX stack to a 'new' project. A CDC virtual serial port would be fine for starters.

 

Thanks.

Labels (1)
0 Kudos
7 Replies

886 Views
paulsky
Contributor II

Hi seanmac,

 

I have just recently started looking at the CMX stack too. I agree with you. The code examples are good and demonstrate that it works, but that's about where you're left at. I would also like to know about how to create a new project and then incorporate their code. I have tried a few times only to get hundreds of errors. It would be nice if the stack was made available as an independent piece of code (in one directory) with a simple API. Instead pieces of it are scattered among several folders (in several layers) & it's intermingled with code specific to the particular example - hence making it difficult to separate.

 

If you have had any success please provide some pointers.

 

paulsky.

 

0 Kudos

886 Views
mjbcswitzerland
Specialist V

Hi Guys

 

Check out http://www.utasker.com/docs/uTasker/USB_User_Guide.PDF 

 

This is not for MQX but may be an alternative and it would be interesting to know whether the doc support lives up to the expectations of professional programmers.

 

Regards

 

Mark

 

PS. The demo is also documented at http://www.utasker.com/docs/uTasker/uTaskerV1.3_USB_Demo.PDF with images for M52211, M52221, M52223 and M52259 at http://www.utasker.com/SW_Demos.html including firmware upload via USB

 

www.uTasker.com
- OS, TCP/IP stack, USB, device drivers and simulator for M521X, M521XX, M5221X, M5222X, M5223X, M5225X. One package does them all - "Embedding it better..."

 

0 Kudos

886 Views
paulsky
Contributor II

Hi Mark,

 

Thanks for your input. It looks like you are marketing a very nice product, however I did notice you only provide support for USB device functionality. Have you any plans for USB hosting? My specific application involves using an MCF51JM128 for reading / writing files to a USB flash drive.

 

 

paulsky.

 

0 Kudos

886 Views
RichTestardi
Senior Contributor II

> My specific application involves using an MCF51JM128 for reading / writing files to a USB flash drive.

 

I just added USB Host Mode to StickOS which allows you to log "print" statements to a USB Flash Drive -- I also just updated the skeleton project so you can rebuild StickOS from Library form to make changes (and even rip out its guts :smileyhappy:.  It currently runs on the 51JM, 5222x, and 5225x, but not the 5221x, though I expect the port would be trivial.

 

Writing reliably to a large number of flash drives is no small feat, since they all "assume" specific initialization sequences basically matching Windows -- CMX only worked with a small percentage of the ones we tested.  Anyway, if you want to see all the USB driver source, etc., it is at:

 

  http://www.cpustick.com/downloads/skeleton.zip

 

Unfortunately, I included the FAT filesystem and block cache manager in library form, not source, since someone else wrote them.  If you e-mail me at rich@testardi.com, I am happy to mail them to you and they plug right into the project (and the source versions can override the library).

 

-- Rich

 

 

0 Kudos

886 Views
paulsky
Contributor II

Rich,

 

Thanks, I'll have a look at it. Most likely I will email you for the source code.

 

paulsky

 

0 Kudos

886 Views
mjbcswitzerland
Specialist V

Hi Paulsky

 

You are correct that we have presently device support only - host and OTG support will be added in the second half of 2009, with integrated FAT, SD-card and USB mass-storage.

 

The V1 is not included in the supported devices although may be added, based on the fact that the MCF51CN128 adds Ethernet connectivity to the family - however this hasn't been decided yet.

 

The uTaskerV1.4 will be released shortly adding graphical LCD support (see on-line demo at http://demo.uTasker.com and browse to the TFT demo web page) as well as various additional features like a full-featured MODBUS serial/TCP module - http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF. The uTasker simulator allows all this to be completely simulated on the targeted devices and can reduce development times dramatically over traditional techniques (see screen shots of the new graphical LCD support here: http://www.utasker.com/Demos/Simulations.html).

 

So I can't help with your host requirement on your V1 today.You may however like to check back towards the end of the year for future project requirements  :smileywink:

 

Regards

 

Mark

 

0 Kudos

886 Views
RichTestardi
Senior Contributor II

Hi,

 

Here's a thread on the subject on the 52221:

 

http://forums.freescale.com/freescale/board/message?board.id=CFCOMM&message.id=4912&query.id=92463#M...

 

Since then I have made my boards such that they can have a crystal or not.  I've still never had a problem with the relaxation oscillator, but it can clearly be out of spec for USB -- USB demands 2500 ppm accuracy; whereas, the relaxation oscillator gives you more like 20,000 ppm.  Once you get into full temperature range operation and production quantities, it seems a gamble to use the relaxation oscillator.

 

BTW, it is easy to make the sw select either mode on boot, depending on the state of the clkmod0 pin.  I do:

 

    // if we don't have a crystal...    if (MCF_CLOCK_SYNSR & MCF_CLOCK_SYNSR_OCOSC) {        // we use the 8MHz internal oscillator divided by 1        MCF_CLOCK_CCHR = 0;        // and multiply by 6 to get 48MHz        MCF_CLOCK_SYNCR = MCF_CLOCK_SYNCR_MFD(1)|MCF_CLOCK_SYNCR_CLKSRC|MCF_CLOCK_SYNCR_PLLMODE|MCF_CLOCK_SYNCR_PLLEN;                // USB uses fsys        cpu_frequency = 48000000;        bus_frequency = cpu_frequency/2;        oscillator_frequency = 8000000;    } else {        // we use the 48MHz crystal divided by 6        MCF_CLOCK_CCHR = 5;        // and multiply by 8 to get 64MHz        MCF_CLOCK_SYNCR = MCF_CLOCK_SYNCR_MFD(2)|MCF_CLOCK_SYNCR_CLKSRC|MCF_CLOCK_SYNCR_PLLMODE|MCF_CLOCK_SYNCR_PLLEN;                // USB uses oscillator        cpu_frequency = 64000000;        bus_frequency = cpu_frequency/2;        oscillator_frequency = 48000000;    }

 

Obviously you can clock the CPU faster than 48MHz if you have a crystal; otherwise, you cannot.

 

As you find yourself going thru the CMX stack, if you need a "second opinion" on how the USB works, I have a separate host/device mode stack available here: http://www.cpustick.com/downloads/skeleton.zip

 

(I find it is always helpful to have more source code examples when trying to get something working! Smiley Happy

 

-- Rich

0 Kudos