Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
mikeboro
PostPosted: Jul 18, 2007 - 06:39 PM
Newbie


Joined: Jun 26, 2007
Posts: 16


How to implement both a Mass Storage Interface and a CDC interface on one device. The tutorial is in pdf form. Please feel free to comment with suggestions, typos etc.

Abstract
It is convenient to be able to have a mass storage device functioning, and also have two way communication to and from the same device over the same physical connection. As the mass storage device takes 2 endpoints (in addition to the required control endpoint 0) and it is possible to have uart over usb through the cdc interface (which requires 3 endpoints). We use a standard development kit and existing code examples to show the feasibility of creating such a device. The following tutorial describes the integration of the Atmel Mass Storage and CDC examples as well as the driver modification which must take place in order to have a device which successfully functions as a composite device simultaneously allowing a mass storage device and com communication.
 
 View user's profile Send private message  
Reply with quote Back to top
Onyeks
PostPosted: Apr 23, 2008 - 08:18 AM
Newbie


Joined: Apr 22, 2008
Posts: 8


Hi Mikeboro, I had a question for you. I am trying to keep the virtual port I get from the cdc code so that I could communicate with the At90USBkey using Labview via the virtual port while I test some other code on the microcontroller. Do you know how I can do this? Everytime I download new code to the board using Flip, the virtual port disappears because I have erased it. How can I keep it and still download new code for testing with Labview? Any help will be highly appreciated. Thanks
 
 View user's profile Send private message  
Reply with quote Back to top
Capa_Pinbacker
PostPosted: May 04, 2009 - 09:58 PM
Newbie


Joined: Apr 20, 2009
Posts: 4


Very well done, and the tutorial certainly points out the main files that must be updated to get CDC + MS to work concurrently. I wasn't able to get it working, but instead what I did was to start with Atmel CDC's example, then I merged the relevant MS code. Attached is a tar of the original relevant file list (orig), and then the modified files list (new). It compiles and works! However, it is not necessarily very robust (seems that CDC operations might corrupt the FAT16 file structure; e.g. volume sector... I'm still investigating).

My setup is:
- Ubuntu 9.04
- code::blocks IDE (fantastic... supports the AVR90 uP right out of the box)
- you can use the Meld Diff viewer to highlight the diff's in the files if you are using linux (great app!)
- AT90USBKEY hardware

Good luck!

P.S. If you're not using Linux... then WHY NOT??!! Smile
 
 View user's profile Send private message  
Reply with quote Back to top
Capa_Pinbacker
PostPosted: May 04, 2009 - 10:05 PM
Newbie


Joined: Apr 20, 2009
Posts: 4


By the way, I should have mentioned that with Ubuntu 9.04, I didn't have to do anything with drivers like it appears you have to do with Windoze. It just works. If you type "dmesg" at the command prompt with Linux, you'll see both the CDC and MS interfaces load. Here's an example output:

[ 8275.108079] usb 3-1: new full speed USB device using ohci_hcd and address 3
[ 8275.320547] usb 3-1: configuration #1 chosen from 1 choice
[ 8275.323254] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[ 8275.329703] scsi5 : SCSI emulation for USB Mass Storage devices
[ 8275.330037] usb-storage: device found at 3

Also, I use dfu-programmer to program the USBKEY... very nice little utility that can be easily run using a script. Make programming very fast and convenient. There's a tutorial online on how to configure & use it.
 
 View user's profile Send private message  
Reply with quote Back to top
JonnyBeGood
PostPosted: May 11, 2009 - 12:56 PM
Newbie


Joined: Apr 08, 2009
Posts: 13


Hi Capa_Pinbacker

Could you please upload the hex file for your project.
I cant seem to get the MS and CDC to work together.
Im using a program called USBTrace (Shows all info of a USB port)and would like to see the flow of the enumeration.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
strider34
PostPosted: May 11, 2009 - 03:04 PM
Newbie


Joined: May 11, 2009
Posts: 1


Hi All,
I am trying to get this working and I cannot finf the mass storage demo on the atmel site. Can anyone help?
I have tried using the cdc+ms.tar from above but cannot work out what goes where and how to compile it; I am using AVR studio.
Any help gratefilly received.
Thanks
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: May 11, 2009 - 03:21 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62227
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

I cannot finf the mass storage demo on the atmel site

Rather than Atmel software you may find it easier to use "LUFA" - just Google it.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
JonnyBeGood
PostPosted: May 14, 2009 - 08:23 AM
Newbie


Joined: Apr 08, 2009
Posts: 13


Hi Capa_Pinbacker

Did you use the CDC driver (.ini file) ?
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
JonnyBeGood
PostPosted: May 14, 2009 - 10:36 AM
Newbie


Joined: Apr 08, 2009
Posts: 13


I cant seem to recieve anything on endpoint 5 which is bulk [OUT] but im recieving the mass storage on endpoint 2 which is bulk [OUT] but is part of the cdc data class.

Does any one know why this could be ?
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
JonnyBeGood
PostPosted: May 14, 2009 - 01:42 PM
Newbie


Joined: Apr 08, 2009
Posts: 13


Hi Sorry for spamming.
Forget all my previous question.
I got the MS+CDC to run But i got a problem.
How do you create a custom driver for the device ?

The Tutorial says check the cdc example but i cant download it and i cant find any thing on the web.

Please Help
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
Capa_Pinbacker
PostPosted: May 15, 2009 - 03:33 AM
Newbie


Joined: Apr 20, 2009
Posts: 4


Attached is the hex file that I download to the device. If you open a serial program on your PC, you will see the characters echoed back.

I've also included a Linux script file which I execute to do the download.

The mass storage & CDC demos are on the Atmel site... today they're near the bottom of http://www.atmel.com/dyn/products/tools ... ily_id=607

Remember, I'm using Linux, and its USB driver works out of the box with this particular implementation. Sorry I cannot help with specific Windoze driver issues Sad

Creating a custom driver for Windoze or Linux is possible, you would need to learn about creating drivers on those OS's!

Good luck! I hope this works for you.


Last edited by Capa_Pinbacker on May 16, 2009 - 05:53 PM; edited 2 times in total
 
 View user's profile Send private message  
Reply with quote Back to top
JonnyBeGood
PostPosted: May 15, 2009 - 07:23 AM
Newbie


Joined: Apr 08, 2009
Posts: 13


Thanks i will compare it with the one i created.
Shortly after i posted my previous message i got my own compilation to work using Codevision.
Its working beautifully.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
abcminiuser
PostPosted: May 15, 2009 - 02:13 PM
Moderator


Joined: Jan 23, 2004
Posts: 9820
Location: Trondheim, Norway

Quote:

I differ on LUFA -- I found the Atmel s/w much easier to comprehend and modify. This code should compile using AVR studio and GCC compiler (I use Linux tools, but the basic idea, and GCC compiler, is the same).


Ouch, that's the exact opposite to what I was hoping for. Would you mind explaining why you didn't like LUFA, so that I can make it easier to use? Constructive criticism is gratefully received, since I want to make a better product. Perhaps via email would be best, so as not to flood this thread with too much off-topic chatter.

Cheers!
- Dean Twisted Evil

_________________
Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Capa_Pinbacker
PostPosted: May 16, 2009 - 05:45 PM
Newbie


Joined: Apr 20, 2009
Posts: 4


I think a separate LUFA MS+CDC thread is warranted!
 
 View user's profile Send private message  
Reply with quote Back to top
keke8273
PostPosted: Dec 21, 2011 - 11:13 PM
Newbie


Joined: Dec 21, 2011
Posts: 1


Thank you very much for the tutorial. I am using different hardware platform to implement the same function.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits