Author Topic: USB Setup packet  (Read 11507 times)

gi

  • Member
  • ***
  • Posts: 27
USB Setup packet
« on: May 22, 2011, 10:39:50 pm »
Hi,
I'm wondering if setup packet will automatically be saved in FIFO by SIE once it arrived from host to device w/o an explicit write in the code?
BTW, I'm using f34x uC.

Is my understanding right?

thanks
gi

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB Setup packet
« Reply #1 on: May 23, 2011, 08:37:04 am »
I'm not familiar with that chip so don't have a specific answer. Do you have example code to follow? What problem are you trying to solve? The chip's data sheet is generally the best source of information for this type of question.

Jan

Tsuneo

  • Frequent Contributor
  • ****
  • Posts: 145
Re: USB Setup packet
« Reply #2 on: May 23, 2011, 04:25:32 pm »
Yes, for SiLabs C8051F34x and F32x.
This SIE doesn't have any specific buffer for SETUP data.
Also, EP0 IN and OUT shares common FIFO (buffer).
SETUP data overwrites this common FIFO at its arrival.

Tsuneo

gi

  • Member
  • ***
  • Posts: 27
Re: USB Setup packet
« Reply #3 on: May 23, 2011, 08:56:47 pm »
Thanks Tsuneo. It's clear to me now. Thanks for your help. I'm guessing it will be the same with there new uC the C8051f38x.

@Jan, the datasheet specify this :
From C8051f34x.pdf -
Section 16.10.1.Endpoint0 SETUP Transactions
An Endpoint0 interrupt is generated when the data from a SETUP packet is loaded into the Endpoint0 FIFO.

From USB Complete 3rd ed:
The Endpoint stores the data that follows the OUT or SETUP packet & the hardware typically triggers an interrupt. - p.39

And in the example code, I only see this FIFO_READ(FIFO_EP0, 8, (unsigned char *)&SETUP); which draws my confusion as to where in the code it was first written before it was read.

Thanks for your help guys.

regards
gi


Tsuneo

  • Frequent Contributor
  • ****
  • Posts: 145
Re: USB Setup packet
« Reply #4 on: May 24, 2011, 01:54:54 am »
SiLabs had distributed an appnote AN139, "USB Firmware Programmer's Guide".
This document explains well on the behavior of SiLabs SIE.
(Though I don't like the firmware code attached :-)
Unfortunately, SiLabs dropped this appnote from their web site.
But copies are still floating over the net.
Search "Silicon Laboratories" AN139

As of the SETUP transaction handling, the appnote describes it as follows.

Setup Transactions AN139.pdf p5
Setup packets are similar to OUT packets: hard- ware sets the OPRDY bit to '1' (to indicate a data packet ready in the FIFO), and generates an inter- rupt. There is no flag in hardware to indicate that received data in the FIFO is from a Setup packet (versus an OUT packet); firmware must keep state information that indicates what type of packet should be received next.


Quote
I'm guessing it will be the same with there new uC the C8051f38x.

Maybe. SiLabs don't open its full datasheet yet.

Tsuneo
« Last Edit: May 24, 2011, 02:07:23 am by Tsuneo »

gi

  • Member
  • ***
  • Posts: 27
Re: USB Setup packet
« Reply #5 on: May 24, 2011, 09:30:00 pm »
 ;) Thanks Tsuneo.
It takes me a minute to find and at first link provided, the pdf file will not be saved or viewed so I have to Quick View it and save it in google docs from there I can download the file. Pretty smart google!
Here is the shortened url: http://goo.gl/gYWO7 for anyone looking.

Devices mentioned are F320 and F321 only but I suspect the information is applicable also to its f34x and f38x.

Now, I can continue with my USB programming!

Thanks again Tsuneo, what a wonderful help.

regards
gi