S
S
Slavka2015-11-25 11:27:20
Microcontrollers
Slavka, 2015-11-25 11:27:20

How to organize the transfer algorithm over USB?

In general, usb will be used to read data from the controller to the PC and write from the PC to the controller, all transfer functions have already been described, the C language on the micro and C ++ on the PC, the lpc controller, while there are ideas to do this:
Buffer[0] = command read/write
Buffer[1] = number of bytes,
rest data. Or are there better options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2015-11-25
@jcmvbkbc

Slavka read what types of data exchange are via USB, for example here: wiki.osdev.org/Universal_Serial_Bus

M
monah_tuk, 2015-11-26
@monah_tuk

do you plan to transfer or use EP0 through a separate EP? If the latter, then the size of the package is part of the setup package. The command can also be pushed into the value or index fields of the setup request. I would do this: if index == 1, then this is the first package - we start collecting data, read how much we gave, and so on, until the entire package is subtracted. Transfer the size of the entire package, for example, to value - just one setup request may not be able to transfer all the data.
The sign of the beginning of the sending can be useful to interrupt the accumulation of data, if, for example, there was some kind of failure on the remote side (the computer rebooted and started working again).
In general, www.beyondlogic.org/usbnutshell/usb1.shtml and microsin.ru/content/view/1107/44 to help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question