Pinto-TH USB data to PC?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
uxi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Pinto-TH USB data to PC?

uxi
Hi,

How would I send data from a C program to the USB-OTG port on the pinto-TH to a program on windows or linux on the pc? Is there a way to do this? I have no clue where to look at.

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

allsey87
The simplest way to do this would be to use g_serial to create a serial console port - according to the wiki, it should be enabled by default.

see: https://github.com/gumstix/yocto-manifest/wiki#using-usb-otg-port-as-a-serial-console-port

Once you have this up and working (test with minicom, picocom or kermit), you have to use the linux API to configure the serial port to send data back and forth.

I have a C++ wrapper class that does this:

https://github.com/allsey87/bebot-remote-control/blob/master/uart_socket.cc
https://github.com/allsey87/bebot-remote-control/blob/master/uart_socket.h

Good luck.



On 19 March 2016 at 02:13, uxi <[hidden email]> wrote:
Hi,

How would I send data from a C program to the USB-OTG port on the pinto-TH
to a program on windows or linux on the pc? Is there a way to do this? I
have no clue where to look at.

Thanks in advance.



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
uxi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

uxi
Thanks for the reply.

Will using the serial console port be able to send data at atleast 1Mbyte/sec?

I'm sending over small spi data to a pc at a continuous rate.
uxi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

uxi
In reply to this post by allsey87
allsey87 wrote
The simplest way to do this would be to use g_serial to create a serial
console port - according to the wiki, it should be enabled by default.

see:
https://github.com/gumstix/yocto-manifest/wiki#using-usb-otg-port-as-a-serial-console-port
I'm using yocto 1.8 on the gumstix overo ironstorm com.
When the pinto-th board is plug into my ubuntu os nothing shows up.
What is g_serial and how do I enable and use it?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

Tomislav Čleković
I've had similar problems... after a lot of reading old mailing lists I
came to this:

- create file /etc/modules-load.d/g_serial.conf with "g_serial" as
content (without qoutes) and reboot. It should load g_serial on bootup.

- or just type "modprobe g_serial" in console to currently load g_serial

Tomislav


On Uto, 2016-04-05 at 06:21 -0700, uxi wrote:

> allsey87 wrote
> > The simplest way to do this would be to use g_serial to create a serial
> > console port - according to the wiki, it should be enabled by default.
> >
> > see:
> > https://github.com/gumstix/yocto-manifest/wiki#using-usb-otg-port-as-a-serial-console-port
>
> I'm using yocto 1.8 on the gumstix overo ironstorm com.
> When the pinto-th board is plug into my ubuntu os nothing shows up.
> What is g_serial and how do I enable and use it?
>
>
>
> --
> View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970751.html
> Sent from the Gumstix mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> gumstix-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gumstix-users

------------------------------------------------------------------------------
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

allsey87
In reply to this post by uxi
Did you read the wikipage? More information about g_serial can be found here: http://lmgtfy.com/?q=g_serial

On 5 April 2016 at 15:21, uxi <[hidden email]> wrote:
allsey87 wrote
> The simplest way to do this would be to use g_serial to create a serial
> console port - according to the wiki, it should be enabled by default.
>
> see:
> https://github.com/gumstix/yocto-manifest/wiki#using-usb-otg-port-as-a-serial-console-port

I'm using yocto 1.8 on the gumstix overo ironstorm com.
When the pinto-th board is plug into my ubuntu os nothing shows up.
What is g_serial and how do I enable and use it?



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970751.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users


------------------------------------------------------------------------------

_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

allsey87
In reply to this post by uxi
Regarding the throughput, using a baud rate of 115200 (the highest commonly used setting) would give perhaps 100kbytes/s.

"I'm sending over small spi data to a pc at a continuous rate." - I'm not entirely sure what you are trying to do here. Perhaps you could give a more complete overview of your set up, data source/sink, goals?

On 19 March 2016 at 20:19, uxi <[hidden email]> wrote:
Thanks for the reply.

Will using the serial console port be able to send data at atleast
1Mbyte/sec?

I'm sending over small spi data to a pc at a continuous rate.



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970730.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users


------------------------------------------------------------------------------

_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
uxi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

uxi
I have a thermal camera sending data at approximately at 9 frames per second. A single frame is 80x60 of raw pixel data each being 2 bytes each. The data is stored inside a 2-D array and I want to send data to a custom program I create on windows or ubuntu to process the data and display a continuous stream on a display while being able to send some commands back to the camera.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

allsey87
what is the interface of the thermal camera?

On 5 April 2016 at 17:00, uxi <[hidden email]> wrote:
I have a thermal camera sending data at approximately at 9 frames per second.
A single frame is 80x60 of raw pixel data each being 2 bytes each. The data
is stored inside a 2-D array and I want to send data to a custom program I
create on windows or ubuntu to process the data and display a continuous
stream on a display while being able to send some commands back to the
camera.



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970755.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users


------------------------------------------------------------------------------

_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

allsey87
Also based on the above numbers, isn't the required throughput only 84,375kbytes/s? In which case you should be able to push this through a serial interface at the standard rate of 115200 (baud)

On 6 April 2016 at 11:22, Michael Allwright <[hidden email]> wrote:
what is the interface of the thermal camera?

On 5 April 2016 at 17:00, uxi <[hidden email]> wrote:
I have a thermal camera sending data at approximately at 9 frames per second.
A single frame is 80x60 of raw pixel data each being 2 bytes each. The data
is stored inside a 2-D array and I want to send data to a custom program I
create on windows or ubuntu to process the data and display a continuous
stream on a display while being able to send some commands back to the
camera.



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970755.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users



------------------------------------------------------------------------------

_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

allsey87
wait... I think I made a mistake with my previous calculations. 115200 baud will probably be only capable of transmitting at around 11kbytes/sec.

I'm doing (115200 / 10) / 1024 = 11.25. The 10 is 8 data bits, + some over head, and the 1024 is bytes to kbytes...

On 6 April 2016 at 11:25, Michael Allwright <[hidden email]> wrote:
Also based on the above numbers, isn't the required throughput only 84,375kbytes/s? In which case you should be able to push this through a serial interface at the standard rate of 115200 (baud)

On 6 April 2016 at 11:22, Michael Allwright <[hidden email]> wrote:
what is the interface of the thermal camera?

On 5 April 2016 at 17:00, uxi <[hidden email]> wrote:
I have a thermal camera sending data at approximately at 9 frames per second.
A single frame is 80x60 of raw pixel data each being 2 bytes each. The data
is stored inside a 2-D array and I want to send data to a custom program I
create on windows or ubuntu to process the data and display a continuous
stream on a display while being able to send some commands back to the
camera.



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970755.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users




------------------------------------------------------------------------------

_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

Ron Greer
In reply to this post by uxi
For something faster, you can use GadgetFS (gadgetfs.ko kernel module) and use libusb in windows and in linux to copy data back and forth.
This should be significantly faster than serial.

Ron

On Sat, Mar 19, 2016 at 2:37 PM uxi <[hidden email]> wrote:
Thanks for the reply.

Will using the serial console port be able to send data at atleast
1Mbyte/sec?

I'm sending over small spi data to a pc at a continuous rate.



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970730.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users

------------------------------------------------------------------------------

_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
uxi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

uxi
I successfully connected the usb using gadgetfs for reference i used this:

https://github.com/ueno/libusb-gadget

Now my question is how do I actually read and write data?
I see in libusb-gadget.c
usb_gadget_endpoint_write (struct usb_gadget_endpoint *ep, const void *buf, size_t len, int timeout)

but I have no clue what buf and len means. What do I put in those field?
Is this the right path? I just want to send something like: uint8_t data[9840]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

allsey87
Hi Uxi,

The layout of this function is standard (https://en.wikipedia.org/wiki/Write_%28system_call%29), the arguments are nearly always:

1. Write to here (a buffer, file descriptor, end point)
2. The data to be written (buffer)
3. Amount of data to be moved, typically the number of bytes

"buf" is short for buffer, the data want you to send, i.e. a pointer to the first element in your array. "len" is the number of bytes you want to send.

Also I would strongly recommend changing your approach. If I were you, I would instead use the OTG port with the ethernet gadget adapter, i.e. using g_ether. Once you have established a connection between the Overo and the PC, i.e. the two being able ping each other, you can follow one of the many tutorials (in C, python, java, lua, +others) on how to set up a server/client TCP connection and send data. It will several magnitudes faster than you need, as well as a couple magnitudes easier.

Although your current approach would be faster than using the ethernet gadget driver (due to some overhead), it is quite complicated [1] and NOT a trivial exercise for beginners.

On 26 April 2016 at 14:49, uxi <[hidden email]> wrote:
I successfully connected the usb using gadgetfs for reference i used this:

https://github.com/ueno/libusb-gadget
<https://github.com/ueno/libusb-gadget>

Now my question is how do I actually read and write data?
I see in libusb-gadget.c
usb_gadget_endpoint_write (struct usb_gadget_endpoint *ep, const void *buf,
size_t len, int timeout)

but I have no clue what buf and len means. What do I put in those field?
Is this the right path? I just want to send something like: uint8_t
data[9840]



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970774.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

allsey87
Also, NOT that I am recommending that you take the libusb approach, but the version you referred to in your last post is very old (7+ years since the last commit) and could have all kinds of problems and bugs. The new and official documentation etc is here http://libusb.org/static/api-1.0/

On 26 April 2016 at 16:29, Michael Allwright <[hidden email]> wrote:
Hi Uxi,

The layout of this function is standard (https://en.wikipedia.org/wiki/Write_%28system_call%29), the arguments are nearly always:

1. Write to here (a buffer, file descriptor, end point)
2. The data to be written (buffer)
3. Amount of data to be moved, typically the number of bytes

"buf" is short for buffer, the data want you to send, i.e. a pointer to the first element in your array. "len" is the number of bytes you want to send.

Also I would strongly recommend changing your approach. If I were you, I would instead use the OTG port with the ethernet gadget adapter, i.e. using g_ether. Once you have established a connection between the Overo and the PC, i.e. the two being able ping each other, you can follow one of the many tutorials (in C, python, java, lua, +others) on how to set up a server/client TCP connection and send data. It will several magnitudes faster than you need, as well as a couple magnitudes easier.

Although your current approach would be faster than using the ethernet gadget driver (due to some overhead), it is quite complicated [1] and NOT a trivial exercise for beginners.

On 26 April 2016 at 14:49, uxi <[hidden email]> wrote:
I successfully connected the usb using gadgetfs for reference i used this:

https://github.com/ueno/libusb-gadget
<https://github.com/ueno/libusb-gadget>

Now my question is how do I actually read and write data?
I see in libusb-gadget.c
usb_gadget_endpoint_write (struct usb_gadget_endpoint *ep, const void *buf,
size_t len, int timeout)

but I have no clue what buf and len means. What do I put in those field?
Is this the right path? I just want to send something like: uint8_t
data[9840]



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970774.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users



------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
uxi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

uxi
This post was updated on .
In reply to this post by allsey87
Thanks using g_ether might actually work for my project.

A couple of more questions:
I use this website (https://developer.ridgerun.com/wiki/index.php/How_to_use_USB_device_networking) to set up the connection. Because I am testing and rebooting the gumstix I have to manually type all this into the terminal all over again.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

allsey87
Hi,

The instructions on that site seem reasonable, but not of it is relevant to your application (i.e. the content about nameservers, default gateways, nfs shares). Also please completely read through the Yocto Manifest Wiki. In particular, this section: https://github.com/gumstix/yocto-manifest/wiki#using-usb-otg-port-as-ethernet

I don't know what is wrong on the host side (i.e. what random string of letters and numbers you are looking at), about sometimes to get usb0 to appear, I need to type "ifconfig usb0 up".

All the commands for automating the configuration of the usb0 network device need to be placed is a couple different configuration files. I don't know the exact ones, but Google is your friend here! try searching "bring usb0 up on boot",  "assign usb0 ip address on boot" or "automatically load g_ether on boot"

Michael



On 26 April 2016 at 22:06, uxi <[hidden email]> wrote:
Thanks using g_ether might actually work for my project.

A couple of more questions:
I use this website (
https://developer.ridgerun.com/wiki/index.php/How_to_use_USB_device_networking
<https://developer.ridgerun.com/wiki/index.php/How_to_use_USB_device_networking>
) to set up the connection. Because I am testing and rebooting the gumstix I
have to manually type all this into the terminal all over again.

On the linux host side the usb0 gets renamed to a random string of letters
and numbers. How to prevent this? I tried google but my little linux
knowledge prevent me from understanding.



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970778.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pinto-TH USB data to PC?

allsey87

On 27 April 2016 at 10:16, Michael Allwright <[hidden email]> wrote:
Hi,

The instructions on that site seem reasonable, but not of it is relevant to your application (i.e. the content about nameservers, default gateways, nfs shares). Also please completely read through the Yocto Manifest Wiki. In particular, this section: https://github.com/gumstix/yocto-manifest/wiki#using-usb-otg-port-as-ethernet

I don't know what is wrong on the host side (i.e. what random string of letters and numbers you are looking at), about sometimes to get usb0 to appear, I need to type "ifconfig usb0 up".

All the commands for automating the configuration of the usb0 network device need to be placed is a couple different configuration files. I don't know the exact ones, but Google is your friend here! try searching "bring usb0 up on boot",  "assign usb0 ip address on boot" or "automatically load g_ether on boot"

Michael



On 26 April 2016 at 22:06, uxi <[hidden email]> wrote:
Thanks using g_ether might actually work for my project.

A couple of more questions:
I use this website (
https://developer.ridgerun.com/wiki/index.php/How_to_use_USB_device_networking
<https://developer.ridgerun.com/wiki/index.php/How_to_use_USB_device_networking>
) to set up the connection. Because I am testing and rebooting the gumstix I
have to manually type all this into the terminal all over again.

On the linux host side the usb0 gets renamed to a random string of letters
and numbers. How to prevent this? I tried google but my little linux
knowledge prevent me from understanding.



--
View this message in context: http://gumstix.8.x6.nabble.com/Pinto-TH-USB-data-to-PC-tp4970728p4970778.html
Sent from the Gumstix mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users



------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Loading...