read and write to isoch endpoints simultaneously

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear Experts,

Hi

I have a board based on atxmega128a1u uC.

I write a program for it which uses 2 isoch endpoints. 1 is IN and 1 is OUT. 

I would like to read and write data simultaneously in both endpoints.

 

 

Code in written for uC by using LUFA. 

 

and I try to use libusbk for windows driver development. 

I use xfer-iso-read sample of libusbk and it works perfect for reading data from IN isoch endpoint.

 

Now, I am looking for a sample which uses both endpoints in the same time. 

 

I have not found anything yet.

 

I have tried a lot of different ways but always face with reading or writing problem.

 

If you have any sample code or document which shows me how to handle both endpoints in the same time please share it.

 

Even linux drivers may also help.

 

Cheers

Mehrdad,

 

 

 

 

This topic has a solution.
Last Edited: Sun. Nov 4, 2018 - 07:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mehrdad_58 wrote:
I would like to read and write data simultaneously in both endpoints.

simultaneously????  Serially, yes, but read(in) and write(out) at the same time?  To two endpoints, at the same time?

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
stack gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would like to read and write to both endpoints in a thread. Serially is also accepted. Please give me some source code. 

I get data from in endpoint without problem. but I do not know how to add out endpoint support to it. 

When I add, after a while some errors occur.

I need a robust reading and writing data to and from endpoints

libusb-w32 code or libusbk code sample is appreciated.

Thanks

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

https://sourceforge.net/p/libusb...

 

based on above source, it seems that I have to setup two threads for reading and writing simultaneously from USB endpoints.

But I would rather use one thread for synchronization problems. 

If I have to, I use 2 threads. But please somebody approve it. 

 

I attached the xfer-sio-read.c code from ibusbk and the way I changed it to support both read and write operations but after a while it goes to wall and does not work and give me errors. 

 

Attachment(s): 

Last Edited: Sat. Oct 6, 2018 - 04:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I also started to write a comment about the word "simultaneous", but I declined because it was too obvious.

It is simply not possible to read and write from a half duplex bus at the same time.

I do not know if you're a navie English speaker, but put in some effort to use the right terminology.

It helps to understand each other.

 

My understanding of USB is pretty limited.

From what I know, USB is some magic that communicates between endpoints.

The whole endpoint complexity has been added to ensure that you do not have to worry about what happens in between.

 

The read and write functions' data should be kept separated by using different endpoints from my (very limited) knowledge of USB.

If you are having problems with multi-threaded applications and synchronisation, it seems more likely that the problem is elsewhere.

For example an endpoint buffer has data from 2 different packets when you attempt to read it as a single data packet.

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok let me clarify.

 

By simultaneous I mean concurrent. I mean reading and writing to In and Out endpoints in a windows or Linux program. 

 

You know I am not a native English speaker. 

 

But Thanks for your great help and please give me some code samples.  

 

I exactly know that it is possible to read and write to isoch endpoints concurrently (not simultaneously).

 

But I am looking for sample codes. 

 

A simple code that works is what I am looking for...

 

Give me a sample code and I promise to use concurrent instead of simultaneous for the rest of my life. laugh

 

 

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Finally using 2 separate threads, one for reading and one for writing resolves the problem.