EmbDev.net

Forum: ARM programming with GCC/GNU tools USB Mass storage port from GCC to the Crossworks IDE


Author: Martin Mostek (tyca)
Posted on:

Rate this post
0 useful
not useful
Hello Everyone,
I'm working on the USB Mass Storage device for the AT91SAM7XC256. I use
the CrossWorks compiler and wanted to see if anyone else here has
already converted GCC aplication (and/or similar) for CrossWorks or if
someone has their own and will share it?
I lost one month of my life on it and it still isn'tworkning :-( .
Now I'm using the source file from Michael Wolf [1]. This example
implements an USB mass storage based on Atmels USB MSD framework (with
interr. and AIC)
I modified the source to CrossWork IDE and changed AT91SAM7S128 to
SAM7XC256 mcu [2], but it isn't working yet. Program always stops with
the messages :

STD_RequestHandler: Unknown GetDescriptor = 0x05

 or

STD_RequestHandler: Unsupported request: 0xBD,

and device "Jelu HB yPod MP3 Player USB Device" is installed but not
connected.
What I'm doing wrong ?

Thanks,
Martin.

Ps: I have found the FreeRTOS CDC demo applicatin too, but it's only CDC
app. and I need Mass Storage.


[1] Original source can be found here :
http://www.mictronics.de/?page=arm_examples
[2] My port source file :
http://rapidshare.com/files/190135673/USB_PORT.ZIP

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 useful
not useful
Martin Mostek wrote:
> Hello Everyone,
> I'm working on the USB Mass Storage device for the AT91SAM7XC256. I use
> the CrossWorks compiler and wanted to see if anyone else here has
> already converted GCC aplication (and/or similar) for CrossWorks or if
> someone has their own and will share it?

The GNU tools (GCC et al) are the work-horses behind Crossworks so no
changes in the source-code should be needed.

> I lost one month of my life on it and it still isn'tworkning :-( .
> Now I'm using the source file from Michael Wolf [1]. This example
> implements an USB mass storage based on Atmels USB MSD framework (with
> interr. and AIC)
> I modified the source to CrossWork IDE and changed AT91SAM7S128 to
> SAM7XC256 mcu [2], but it isn't working yet. Program always stops with
> the messages :

Did you verify that the Linker-Settings in the IDE and the
compiler/assembler option match the used hardware? The startup of the
SAMXC might be a little different from the one for the SAM7S (I have
only used SAM7S and SAM7SE so far).

>
> STD_RequestHandler: Unknown GetDescriptor = 0x05
>
>  or
>
> STD_RequestHandler: Unsupported request: 0xBD,
>
> and device "Jelu HB yPod MP3 Player USB Device" is installed but not
> connected.
> What I'm doing wrong ?

Since I don't know the sources I can not really help but did you try the
"usb-mass-storage-project" from in the AT91 software-packages available
at atmel.com?

http://www.atmel.com/dyn/resources/prod_documents/...

There is USB mass-storage code for GCC included. You might test from the
command-line using make first to verfiy that it works. Once you know how
the projects has to be built (the options for compiler, assembler and
linker are in the makefile, a linker-script is included too) you can
adapt the options into the Crossworks IDE.

Author: Michael Wolf (mictronics)
Posted on:

Rate this post
0 useful
not useful
Hi Martin,

why didn't you contact me directly by mail if you have problems using my
sourcecode?

I can not help you with Crossworks since I work with GCC but about the
USB protocol errors:

The 0x05 descriptor is the Endpoint descriptor and handling the request
is not implemented so far since it's not mandadory.

The request type 0xBD doesn't exist in the USB 2.0 specification,
requests ranging from 0x00 to 0x0C.

To what kind of USB host is your device connected when the errors
occure?

I tested the USB MSC code on WinXP and Linux Mandriva distribution it
worked without problems.

Author: Michael Wolf (mictronics)
Posted on:

Rate this post
0 useful
not useful
A quick test on Vista revealed the code works well too.

Statement from USB 2.0 spec:

"An endpoint descriptor is always returned as part of the configuration
information returned by a GetDescriptor(Configuration) request. An
endpoint descriptor cannot be directly accessed with a GetDescriptor()
or SetDescriptor()
request."

So if the USB host requests the 0x05 descriptor directly, and it does if
you get this error "STD_RequestHandler: Unknown GetDescriptor = 0x05"
then it's not conform to the specification.

Author: Martin Mostek (tyca)
Posted on:

Rate this post
0 useful
not useful
Hi Martin,

Martin Thomas wrote:
> The GNU tools (GCC et al) are the work-horses behind Crossworks so no
> changes in the source-code should be needed.
>

Yes, that's true, but the main reason why I'm doing this work is, that
there is not fully optimalized USB mass storage source, for the Rowley
Crossworks IDE. (With ctl_api function, AIC etc. included).

>
> Did you verify that the Linker-Settings in the IDE and the
> compiler/assembler option match the used hardware? The startup of the
> SAMXC might be a little different from the one for the SAM7S (I have
> only used SAM7S and SAM7SE so far).
>

I used the CrossWorks startup file. I guess that vectors and RAM mapping
was(is) done good, but maybe that's the malfunction reason. => Can
someone take a look at it ?

My port source file :
http://rapidshare.com/files/190135673/USB_PORT.ZIP

>
> Since I don't know the sources I can not really help but did you try the
> "usb-mass-storage-project" from in the AT91 software-packages available
> at atmel.com?
>
> http://www.atmel.com/dyn/resources/prod_documents/...

The Atmel usb mass storage framework is hard to understand for me, so
last month ago I started working on the Michael Wolf project, which is
more readable for me.

> There is USB mass-storage code for GCC included. You might test from the
> command-line using make first to verfiy that it works. Once you know how
> the projects has to be built (the options for compiler, assembler and
> linker are in the makefile, a linker-script is included too) you can
> adapt the options into the Crossworks IDE.


That's very good idea. I will test the original source code before
porting...

Thank You for Your time, and ideas,
best regards, Martin.

Author: Martin Mostek (tyca)
Posted on:

Rate this post
0 useful
not useful
Hi Michael,

> why didn't you contact me directly by mail if you have problems using my
> sourcecode?

:-) I really don't know....

> I can not help you with Crossworks since I work with GCC but about the
> USB protocol errors:
>
> The 0x05 descriptor is the Endpoint descriptor and handling the request
> is not implemented so far since it's not mandadory.
>
> The request type 0xBD doesn't exist in the USB 2.0 specification,
> requests ranging from 0x00 to 0x0C.

I'll check it out, thanks. How did You test a USB communication ? Can
You recommend a good and free USB monitoring utility to me ? I have
found the USBDeview but, this is just a very simple USB viewer.

> To what kind of USB host is your device connected when the errors
> occure?
>
> I tested the USB MSC code on WinXP and Linux Mandriva distribution it
> worked without problems.

I'm a Windows XP user. The error occurre when my ARM device is connected
to the PC USB host. Device "Jelu HB yPod MP3 Player USB Device" is
installed but not
connected, bacause the ARM device is stopped.
Below is the debugging report.
Now, in this moment, I'm testing the original source code in Yagarto +
Ecclipce IDE, and then I'll see if there is an real option to port Your
source to CrossWorks IDE.

Thank You very much for your support and help.
Best regards, Martin.



------------------
Debugging report:
------------------

Powering up...

UDP enabled
Susp   Resm


EoBres   Rst   CfgEpt0   Susp   Resm


EoBres   Rst   CfgEpt0   EP0   Stp   BotReq   gDesc   Dev   Write0(18)
EP0   Wr +8   EP0   Rd   Ack   EoT(8)


EoBres   Rst   CfgEpt0   EP0   Stp   BotReq   sAddr Write0(0)   EP0   Wr
0   EoT(0)   SetAddr(1) EP0   Stp   BotReq   gDesc   Dev   Write0(18)
EP0   Wr +8   EP0   Wr +8   EP0   Wr 2   EoT(18)   EP0   Rd   Ack   EP0
Stp   BotReq   gDesc   Cfg   Write0(9)   EP0   Wr +8   EP0   Wr 1
EoT(9)   EP0   Rd   Ack   EP0   Stp   BotReq   gDesc   Str0   Write0(4)
EP0   Wr 4   EoT(4)   EP0   Rd   Ack   EP0   Stp   BotReq   gDesc   Str3
Write0(26)   EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr 2
EoT(26)   EP0   Rd   Ack   EP0   Stp   BotReq   gDesc   Cfg   Write0(32)
EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr 0
EoT(32)   EP0   Rd   Ack   EP0   Stp   BotReq   gDesc
STD_RequestHandler: Unknown GetDescriptor = 0x06

Stall0   EP0   Sta   EP0   Stp   BotReq   gDesc   Str0   Write0(4)   EP0
Wr 4   EoT(4)   EP0   Rd   Ack   EP0   Stp   BotReq   gDesc   Str2
Write0(58)   EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0
Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr 2   EoT(58)   EP0   Rd
Ack   EP0   Stp   BotReq   gDesc   Str0   Write0(4)   EP0   Wr 4
EoT(4)   EP0   Rd   Ack   EP0   Stp   BotReq   gDesc   Str2   Write0(58)
EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr +8
EP0   Wr +8   EP0   Wr +8   EP0   Wr 2   EoT(58)   EP0   Rd   Ack   EP0
Stp   BotReq   gDesc   Str0   Write0(4)   EP0   Wr 4   EoT(4)   EP0   Rd
Ack   EP0   Stp   BotReq   gDesc   Str2   Write0(58)   EP0   Wr +8   EP0
Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr
+8   EP0   Wr 2   EoT(58)   EP0   Rd   Ack   EP0   Stp   BotReq   gDesc
Str0   Write0(4)   EP0   Wr 4   EoT(4)   EP0   Rd   Ack   EP0   Stp
BotReq   gDesc   Str2   Write0(58)   EP0   Wr +8   EP0   Wr +8   EP0
Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr +8   EP0   Wr
2   EoT(58)   EP0   Rd   Ack   EP0   Stp   BotReq   gDesc   Dev
Write0(18)   EP0   Wr 18   EoT(18)   EP0   Rd   Ack   EP0   Stp   BotReq
STD_RequestHandler: Unsupported request: 0xBD

EP0   Stp   BotReq   gDesc   STD_RequestHandler: Unknown GetDescriptor =
0x05
Susp

Author: Michael Wolf (mictronics)
Posted on:

Rate this post
0 useful
not useful
My code is tested on XP and should work for sure.

"Jelu HB yPod MP3 Player USB Device" if you see this you don't work with
the example code but with the MP3 player firmware.

STD_RequestHandler: Unknown GetDescriptor = 0x06

This can be ignored because the qualifier descriptor is only needed on
high speed devices.

My code offers an option to compile for high speed, but it's not tested
since the ARM type I used supports only full speed mode. So you may try.
Therefore define "USB_HIGHSPEED" somewhere and remove the security check
in usb_drv.h.

STD_RequestHandler: Unsupported request: 0xBD
I have no explanation so far why there is such request. I never saw
before.


The tools I used were Advanced USB Monitor, USBTrace, UBSInfo and
SourceUSB.
They offer some trial periode to use them for free.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.