реклама на сайте
подробности

 
 
> Работа с ObDev AVR-USB, с чего начать?
anonymous
сообщение Jun 23 2006, 07:00
Сообщение #1


Участник
*

Группа: Новичок
Сообщений: 19
Регистрация: 25-05-06
Пользователь №: 17 447



Здраствуйте.

Необходимо собрать схемку, в которой будет использоваться usb.
Решил делать программно...

И для начала решил собрать простой usb-rs232 преобразователь...

Так вот собственно в чем проблема... не могу въехать с какой стороны к этому всему подходить...

Где брать и куда писать данные, которые надо передать по USB?

может подкините минимальный скелет исходников для начала. (т.е. не законченную прошивку, а только то, что нужно для работы usb. например main.с без всего лишено...)

PowerSwitch смотрел... как понял менять под себя надо функцию usbFunctionSetup(uchar data[8]).
Это верно?

Заранее благодарен
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
proba
сообщение Jun 26 2006, 12:36
Сообщение #2


Местный
***

Группа: Участник
Сообщений: 358
Регистрация: 29-05-05
Пользователь №: 5 526



http://www.recursion.jp/avrcdc/index.html
Go to the top of the page
 
+Quote Post
anonymous
сообщение Jun 27 2006, 01:30
Сообщение #3


Участник
*

Группа: Новичок
Сообщений: 19
Регистрация: 25-05-06
Пользователь №: 17 447



так кто-нибудь может подсказать, где и что надо написать, что-бы сделать самое простое с использованием avr-usb?

т.е. меня интересует как узнать что пришли данные, где они лежат, как отправить данные...
Go to the top of the page
 
+Quote Post
prottoss
сообщение Jun 27 2006, 05:19
Сообщение #4


Гуру
******

Группа: Свой
Сообщений: 2 720
Регистрация: 24-03-05
Пользователь №: 3 659



Цитата(anonymous @ Jun 27 2006, 09:30) *
так кто-нибудь может подсказать, где и что надо написать, что-бы сделать самое простое с использованием avr-usb?
т.е. меня интересует как узнать что пришли данные, где они лежат, как отправить данные...


Вроде по англицки читаешь, а в простом разобраться не можешь) В общем то в usbdrv.h этот вопрос раскрыт:

....usbFunctionSetup(uchar data[8]);
/* This function is called when the driver receives a SETUP transaction from
* the host which is not answered by the driver itself (in practice: class and
* vendor requests). All control transfers start with a SETUP transaction where
* the host communicates the parameters of the following (optional) data
* transfer. The SETUP data is available in the 'data' parameter which can
* (and should) be casted to 'usbRequest_t *' for a more user-friendly access
* to parameters.
*
* If the SETUP indicates a control-in transfer, you should provide the
* requested data to the driver. There are two ways to transfer this data:
* (1) Set the global pointer 'usbMsgPtr' to the base of the static RAM data
* block and return the length of the data in 'usbFunctionSetup()'. The driver
* will handle the rest. Or (2) return 0xff in 'usbFunctionSetup()'. The driver
* will then call 'usbFunctionRead()' when data is needed. See the
* documentation for usbFunctionRead() for details.
*
* If the SETUP indicates a control-out transfer, the only way to receive the
* data from the host is through the 'usbFunctionWrite()' call. If you
* implement this function, you must return 0xff in 'usbFunctionSetup()' to
* indicate that 'usbFunctionWrite()' should be used. See the documentation of
* this function for more information. If you just want to ignore the data sent
* by the host, return 0 in 'usbFunctionSetup()'.
*
* Note that calls to the functions usbFunctionRead() and usbFunctionWrite()
* are only done if enabled by the configuration in usbconfig.h.
*/



... usbFunctionWrite(uchar *data, uchar len);
/* This function is called by the driver to provide a control transfer's
* payload data (control-out). It is called in chunks of up to 8 bytes. The
* total count provided in the current control transfer can be obtained from
* the 'length' property in the setup data. If an error occurred during
* processing, return 0xff (== -1). The driver will answer the entire transfer
* with a STALL token in this case. If you have received the entire payload
* successfully, return 1. If you expect more data, return 0. If you don't
* know whether the host will send more data (you should know, the total is
* provided in the usbFunctionSetup() call!), return 1.
* NOTE: If you return 0xff for STALL, 'usbFunctionWrite()' may still be called
* for the remaining data. You must continue to return 0xff for STALL in these
* calls.
* In order to get usbFunctionWrite() called, define USB_CFG_IMPLEMENT_FN_WRITE
* to 1 in usbconfig.h and return 0xff in usbFunctionSetup()..
*/



....usbFunctionRead(uchar *data, uchar len);
/* This function is called by the driver to ask the application for a control
* transfer's payload data (control-in). It is called in chunks of up to 8
* bytes each. You should copy the data to the location given by 'data' and
* return the actual number of bytes copied. If you return less than requested,
* the control-in transfer is terminated. If you return 0xff, the driver aborts
* the transfer with a STALL token.
* In order to get usbFunctionRead() called, define USB_CFG_IMPLEMENT_FN_READ
* to 1 in usbconfig.h and return 0xff in usbFunctionSetup()..
*/



Со стороны хоста (РС) пока добился связи с устройством через usb_control_msg(....) из libusb


--------------------
Go to the top of the page
 
+Quote Post

Сообщений в этой теме
- anonymous   Работа с ObDev AVR-USB   Jun 23 2006, 07:00
- - otrog   Может и не совсем в тему, но посмотрите в сторону ...   Jun 23 2006, 08:43
|- - prottoss   Цитата(otrog @ Jun 23 2006, 16:43) Может ...   Jun 23 2006, 08:57
|- - anonymous   Цитата(otrog @ Jun 23 2006, 16:43) Может ...   Jun 23 2006, 10:23
|- - prottoss   Цитата(anonymous @ Jun 23 2006, 18:23) на...   Jun 23 2006, 10:55
|- - anonymous   Цитата(prottoss @ Jun 23 2006, 18:55) Цит...   Jun 23 2006, 11:14
- - prottoss   2anonymous извините, что в Вашей ветке задаю вопро...   Jun 24 2006, 06:12
|- - anonymous   Цитата(prottoss @ Jun 24 2006, 14:12) 2an...   Jun 24 2006, 07:09
- - aleksey_g   prottoss, посмотрите эту ветку: http://electronix....   Jun 26 2006, 12:10
- - prottoss   Работа с драйвером от obdev доволно проста и встро...   Jun 27 2006, 17:42
|- - anonymous   2 prottoss вот спасибо... как то просмотрел я это...   Jun 28 2006, 14:44
- - prottoss   В продолжении темы...А как то можно избавится от д...   Jun 28 2006, 17:51
|- - anonymous   Цитата(prottoss @ Jun 29 2006, 01:51) В п...   Jun 30 2006, 01:10
|- - osnwt   Цитата(prottoss @ Jun 28 2006, 20:51) В п...   Jul 12 2006, 17:54
- - prottoss   Спасибо! Я уже сам во всем разобрался, не смот...   Jul 12 2006, 18:08


Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 20th August 2025 - 21:59
Рейтинг@Mail.ru


Страница сгенерированна за 0.01388 секунд с 7
ELECTRONIX ©2004-2016