|
Проблема с enumeration при подключенииЕсть RTL-код USB функции, зашиваемый в FPGA, при подключении к хосту начинается процесс енумерации. USB-функции |
|
|
|
Nov 21 2007, 11:17
|
Группа: Новичок
Сообщений: 8
Регистрация: 5-06-07
Пользователь №: 28 186

|
Есть RTL-код USB функции, зашиваемый в FPGA, при подключении к хосту начинается процесс енумерации. Выполняется следующая последовательность: 1. setup-data0(get_descriptor)-ack 2. in-data1-ack 3. out-data1(null packet)-ack 4. reset line 5. setup-data0(set_address)-ack 6. in-data1(null packet)-ack 7. setup(по присвоенному адресу 0x3)-data0(get_descriptor)-ack
На следующем шаге начинаются проблемы 8. in(address-0x3)-data1 - ... Хост не отвечает подтверждением на отправленный ему дескриптор. Смотрел на осциллографе - пакет правильный, PID на месте, CRC сходится, межпакетный интервал - тоже. При этом, если вместо дескриптора отправить ему нулевой пакет данных, то подтверждение появится и перейдем к шагу 9.
9. out-data1(null packet)-ack
Из этого возникают следующие вопросы: 1. точно ли в п.8 нужно отправлять дескриптор 2. зачем хост отвечает подтверждением на нулевой пакет и продолжает процесс енумерации, если требовал дескриптор 3. зачем вообще нужно два раза отправлять дескриптор?
Ответьте, пожалуйста, если кто-нибудь сталкивался с чем-нибудь подобным или знает в чем тут дело.
|
|
|
|
|
 |
Ответов
|
Nov 21 2007, 21:12
|
Местный
  
Группа: Свой
Сообщений: 244
Регистрация: 21-02-05
Из: Урал
Пользователь №: 2 806

|
По моему нужно сделать FAQ по USB и занести туда первым описание порядка энумерации. Цитата из "USB in a Nutshell" www.beyondlogic.org :
Enumeration is the process of determining what device has just been connected to the bus and what parameters it requires such as power consumption, number and type of endpoint(s), class of product etc. The host will then assign the device an address and enable a configuration allowing the device to transfer data on the bus. A fairly generic enumeration process is detailed in section 9.1.2 of the USB specification. However when writing USB firmware for the first time, it is handy to know exactly how the host responds during enumeration, rather than the general enumeration process detailed in the specification.
A common Windows enumeration involves the following steps,
1. The host or hub detects the connection of a new device via the device's pull up resistors on the data pair. The host waits for at least 100ms allowing for the plug to be inserted fully and for power to stabilise on the device.
2. Host issues a reset placing the device is the default state. The device may now respond to the default address zero.
3. The MS Windows host asks for the first 64 bytes of the Device Descriptor.
4. After receiving the first 8 bytes of the Device Descriptor, it immediately issues another bus reset.
5. The host now issues a Set Address command, placing the device in the addressed state.
6. The host asks for the entire 18 bytes of the Device Descriptor.
7. It then asks for 9 bytes of the Configuration Descriptor to determine the overall size.
8. The host asks for 255 bytes of the Configuration Descriptor.
9. Host asks for any String Descriptors if they were specified.
At the end of Step 9, Windows will ask for a driver for your device. It is then common to see it request all the descriptors again before it issues a Set Configuration request.
The above enumeration process is common to Windows 2000, Windows XP and Windows 98 SE. Step 4 often confuses people writing firmware for the first time. The Host asks for the first 64 bytes of the device descriptor, so when the host resets your device after it receives the first 8 bytes, it is only natural to think there is something wrong with your device descriptor or how your firmware handles the request. However as many will tell you, if you keep persisting by implementing the Set Address Command it will pay off by asking for a full 18 bytes of device descriptor next.
|
|
|
|
|
Nov 22 2007, 08:47
|
Группа: Новичок
Сообщений: 8
Регистрация: 5-06-07
Пользователь №: 28 186

|
Всем спасибо за помощь - натолкнули на решенеие.
Теперь сам могу ответить на поставленные мною вопросы.
1. точно ли в п.8 нужно отправлять дескриптор ----- Да. 2. зачем хост отвечает подтверждением на нулевой пакет и продолжает процесс енумерации, если требовал дескриптор ----- он считает, что получил дескриптор, просто тот нулевой. 3. зачем вообще нужно два раза отправлять дескриптор? ----- первый раз дескриптор отправляется для того, чтобы хост выделил область памяти в соответствии с тем размером, который я ему задаю в 8-ом байте дескриптора. У меня изначально было 0x08, поменял на 0x40 и при подключении к компьютеру вижу свой дескриптор в usbview.
"4. After receiving the first 8 bytes of the Device Descriptor, it immediately issues another bus reset." На самом деле, не совсем так. Reset приходит не сразу, а по окончании транзакции - проверено на осциллографе и логами от vmp.
|
|
|
|
Сообщений в этой теме
kornukhin Проблема с enumeration при подключенииЕсть RTL-код USB функции, зашиваемый в FPGA, при подключении к хосту начинается процесс енумерации. USB-функции Nov 21 2007, 11:17 vmp Есть логи энумерации флешки, снятые аппаратным ана... Nov 21 2007, 11:33 kornukhin Спасибо за логи, но вопрос заключается не в том, к... Nov 21 2007, 16:12  Седой Цитата"4. After receiving the first 8 bytes o... Nov 23 2007, 20:46 s868 спасибо большое vmp (Дата Nov 21 2007, 14:33) за л... Mar 18 2008, 08:40 galjoen Цитата(s868 @ Mar 18 2008, 11:40) =======... Mar 18 2008, 10:28  s868 galjoen, благодарю за ответ.
еще вопросик появился... Mar 21 2008, 08:33   galjoen Цитата(s868 @ Mar 21 2008, 11:33) Reciver... Mar 21 2008, 11:12    s868 Цитата(galjoen @ Mar 21 2008, 15:12) ....... Mar 21 2008, 12:09     galjoen Цитата(s868 @ Mar 21 2008, 15:09) это сде... Mar 21 2008, 14:27
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0
|
|
|