sending data through usb

This is a discussion on sending data through usb within the C Programming forums, part of the General Programming Boards category; Hello everyone, Is there any standard USB protocol which i can follow to send data to my embedded board(and vice ...

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    55

    sending data through usb

    Hello everyone,
    Is there any standard USB protocol which i can follow to send data to my embedded board(and vice versa).
    I have no clue on USB programming using c,is there any example code i could follow,it will help me understand it a little bit better.

    Thanks in advance

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,536
    > Is there any standard USB protocol which i can follow to send data to my embedded board(and vice versa).
    Which OS?
    Which Compiler?
    Which board?
    If you bought the board from some supplier of eval type boards, you usually get drivers of some sort.

    Here's a good source of info -> Jan Axelson's Lakeview Research
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Sep 2012
    Posts
    55
    Quote Originally Posted by Salem View Post
    > Is there any standard USB protocol which i can follow to send data to my embedded board(and vice versa).
    Which OS?
    Which Compiler?
    Which board?
    If you bought the board from some supplier of eval type boards, you usually get drivers of some sort.

    Here's a good source of info -> Jan Axelson's Lakeview Research
    Well the os would be win7 32bit
    Compiler : Keil A51 lib set
    The board: I haven't yet started on the(USB part of) board design.Currently using proteus to test my code(my usb communication protocol)

    My end project would be to test the code on a freescale k60 series controller,but for testing purpose i would first like to test my protocol on a simple 8051 processor(AT83C5134),and then move to the freescale controller.

    The function of the embedded board is quiet simple:
    I press a key on my keyboard and all the data from my embedded board is dumped to a file in my pc.I am able to achieve this using RS232 protocol,But i find that too slow and have lot of errors while dumping data.I would like to do the same using USB.

    Pls help!

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,536
    > Well the os would be win7 32bit
    > Compiler : Keil A51 lib set
    > The board: I haven't yet started on the(USB part of) board design.Currently using proteus to test my code(my usb communication protocol)
    Oh, it's the board itself doing the sending, not the PC end.

    Are you trying to implement a known protocol (say pretending to be a serial port, or perhaps a storage device)?

    If you implement something standard, then when you plug it into windows, you get the "found new hardware, windows is installing, your device is ready to use" deal.

    If you implement something bespoke, then you have to write BOTH ends.

    > I am able to achieve this using RS232 protocol
    What speed are you running at?
    Lengths of serial cables
    A decent 1M null-modem cable should allow you to select baud rates past 100K without too much problem.

    Serial line over USB is even less restricted.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Sep 2012
    Posts
    55
    Quote Originally Posted by Salem View Post
    > Well the os would be win7 32bit
    > Compiler : Keil A51 lib set
    > The board: I haven't yet started on the(USB part of) board design.Currently using proteus to test my code(my usb communication protocol)
    Oh, it's the board itself doing the sending, not the PC end.

    Are you trying to implement a known protocol (say pretending to be a serial port, or perhaps a storage device)?

    If you implement something standard, then when you plug it into windows, you get the "found new hardware, windows is installing, your device is ready to use" deal.

    If you implement something bespoke, then you have to write BOTH ends.

    > I am able to achieve this using RS232 protocol
    What speed are you running at?
    Lengths of serial cables
    A decent 1M null-modem cable should allow you to select baud rates past 100K without too much problem.

    Serial line over USB is even less restricted.
    -Oh, it's the board itself doing the sending, not the PC end.
    Its actually both ways.Majorly it is the boards that sends data to the pc,but in order to initiate the transfer, the code in pc should send the key to the board first.

    -Are you trying to implement a known protocol (say pretending to be a serial port, or perhaps a storage device)?
    Known as in i have seen boards that use USB to communicate/connect to other peripherals.For example: a simple usb programmer.


    -If you implement something bespoke, then you have to write BOTH ends.
    Exactly, for that reason i need a sample code in c that already uses USB to transfer data,so that i can replicate its protocol.Writing drivers for the board in the pc is a secondary problem i need to handle.My main priority as of now is to implement the USB protocol in the embedded board.

    -What speed are you running at?
    Currently it is 9600bps,with 1 stop bit,8 data bits and no parity.
    My pc is not very far form the board, max 1 feet cable length.
    At first i got errors/corruption in data ,but when i changed the cable it worked fine.!

    I want the board to have two ways to transfer data RS232 and USB.

    Thanks for all your help
    Last edited by ak47; 03-14-2013 at 11:08 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sending and receiving data
    By Grell in forum Linux Programming
    Replies: 4
    Last Post: 08-14-2012, 03:58 PM
  2. Sending Data to Excel with C++
    By chopshardiman in forum C++ Programming
    Replies: 9
    Last Post: 05-17-2012, 11:24 AM
  3. Sending data over the network
    By codewriter in forum Tech Board
    Replies: 10
    Last Post: 05-09-2012, 06:44 AM
  4. Sending non-(char*) data
    By Nazca in forum Networking/Device Communication
    Replies: 12
    Last Post: 07-31-2005, 03:39 PM
  5. Sending data packets
    By neandrake in forum Networking/Device Communication
    Replies: 6
    Last Post: 11-26-2003, 12:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21