2
\$\begingroup\$

I have a STM32F4Discovery board and I try to communicate between a c program(with no OS)on the board and a Java program on ubuntu pc. I have found many tutorials like this about USB but they all try to make a RS232 like serial port which is too slow(like 9600 baud or max 14.4Kbps).

Right now I am lost and I need to find out what how should I make this. Is it possible to make a high speed communication in this case and how fast it could be? USB 2.0 specs says it could be up to 480Mbps. Could you tell me with which library is this possible? And is there any best practice available to follow for making a two way communication over USB?

I really appreciate any hints.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

USB protocol is divided into a number of classes , such as HID,Mass Storage,Audio etc.

1.You should try to look into a class that requires to transfer data at a high bit rate, examples of such classes would be Video or Mass Storage devices. Classes which use bulk or isochronous packets to transfer data over the bus will have high bit rates,because they have a larger packet size and can have a bigger time slots to use the bus.

2.Then you should look at the code samples shipped with your board for the these above mentioned classes.

Could you give a little more insight on what data do you want to transfer between the board and the PC?

\$\endgroup\$
4
  • \$\begingroup\$ Thanks Jay. We need to transfer sensor information from discovery board to the java program running in linux pc which itself is another similir board. And we need to send engine commands from java side to the discovery board. Right now I need to transfer 250Bytes every few mili seconds but this will be increased in future. \$\endgroup\$
    – mehdix
    Commented Oct 27, 2013 at 9:41
  • \$\begingroup\$ @Mehdi Does it have to be very strict timing ? USB is not good at this sort application. USB is great for general data transfer where critical timing is not an issue. I would use SPI if the distance is short. \$\endgroup\$
    – Spoon
    Commented Oct 27, 2013 at 11:00
  • \$\begingroup\$ @Spoon Speed is not critical, a little sooner or later does not matter in our case. Thank you for the hint. \$\endgroup\$
    – mehdix
    Commented Oct 27, 2013 at 11:20
  • \$\begingroup\$ It's not the "speed" that's the concern (you seem to have a very defined need to be faster than normal "serial" and are looking into this. which is good), just the variability in the arrival timing of the "commands" you mentioned. I have seen software broken because USB drivers can mess this up. However your using the other classes which I have not used and I believe take this sort issue into account. I have a project that one day will want this sort of USB connection. Good Luck... I may come asking questions when I finally get there myself... \$\endgroup\$
    – Spoon
    Commented Oct 27, 2013 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.