* usb serial programming
@ 2014-07-21 3:19 Amadeus W.M.
2014-07-21 18:18 ` Greg KH
2014-07-22 5:12 ` Sudip Mukherjee
0 siblings, 2 replies; 12+ messages in thread
From: Amadeus W.M. @ 2014-07-21 3:19 UTC (permalink / raw)
To: kernelnewbies
Not sure if this is the right venue for this question, please direct me to
the right place if it's not.
I have a C program that opens the serial port /dev/ttyS0 and sends commands
(as strings) back and forth to a pan-tilt-zoom camera. That works very well,
but I want to use the camera with a Raspberry Pi, which of course does not
have a serial port (RS232). One option is to use a RS232 to usb adapter and
rewrite the C code for the usb port. So how do I go about that? Is
usb serial port programming possible and documented anywhere?
Thanks!
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-21 3:19 usb serial programming Amadeus W.M.
@ 2014-07-21 18:18 ` Greg KH
2014-07-21 18:27 ` Bruce Rowen
2014-07-21 18:55 ` Amadeus W.M.
2014-07-22 5:12 ` Sudip Mukherjee
1 sibling, 2 replies; 12+ messages in thread
From: Greg KH @ 2014-07-21 18:18 UTC (permalink / raw)
To: kernelnewbies
On Mon, Jul 21, 2014 at 03:19:00AM +0000, Amadeus W.M. wrote:
> Not sure if this is the right venue for this question, please direct me to
> the right place if it's not.
>
> I have a C program that opens the serial port /dev/ttyS0 and sends commands
> (as strings) back and forth to a pan-tilt-zoom camera. That works very well,
> but I want to use the camera with a Raspberry Pi, which of course does not
> have a serial port (RS232). One option is to use a RS232 to usb adapter and
> rewrite the C code for the usb port. So how do I go about that? Is
> usb serial port programming possible and documented anywhere?
Nothing to "rewrite", just point your code at /dev/ttyUSB0 instead, and
away you go...
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-21 18:18 ` Greg KH
@ 2014-07-21 18:27 ` Bruce Rowen
2014-07-21 19:05 ` Amadeus W.M.
2014-07-21 18:55 ` Amadeus W.M.
1 sibling, 1 reply; 12+ messages in thread
From: Bruce Rowen @ 2014-07-21 18:27 UTC (permalink / raw)
To: kernelnewbies
Assuming your camera is RS232, you can use a simple RS232 daughter card on the Raspberry (about $7 from MCM electronics and others).
I have done this exact thing for communications with an old RS232 device.
Alternative is of course a USB to RS232 adapter and as Greg writes, you just change the target device file (the $7 adapter also creates a /dev/ttyxxx device.
-Bruce
On Jul 21, 2014, at 12:18 PM, Greg KH <greg@kroah.com> wrote:
> On Mon, Jul 21, 2014 at 03:19:00AM +0000, Amadeus W.M. wrote:
>> Not sure if this is the right venue for this question, please direct me to
>> the right place if it's not.
>>
>> I have a C program that opens the serial port /dev/ttyS0 and sends commands
>> (as strings) back and forth to a pan-tilt-zoom camera. That works very well,
>> but I want to use the camera with a Raspberry Pi, which of course does not
>> have a serial port (RS232). One option is to use a RS232 to usb adapter and
>> rewrite the C code for the usb port. So how do I go about that? Is
>> usb serial port programming possible and documented anywhere?
>
> Nothing to "rewrite", just point your code at /dev/ttyUSB0 instead, and
> away you go...
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-21 18:18 ` Greg KH
2014-07-21 18:27 ` Bruce Rowen
@ 2014-07-21 18:55 ` Amadeus W.M.
2014-07-21 19:06 ` Greg KH
1 sibling, 1 reply; 12+ messages in thread
From: Amadeus W.M. @ 2014-07-21 18:55 UTC (permalink / raw)
To: kernelnewbies
On Mon, 21 Jul 2014 11:18:28 -0700, Greg KH wrote:
> On Mon, Jul 21, 2014 at 03:19:00AM +0000, Amadeus W.M. wrote:
>> Not sure if this is the right venue for this question, please direct me to
>> the right place if it's not.
>>
>> I have a C program that opens the serial port /dev/ttyS0 and sends commands
>> (as strings) back and forth to a pan-tilt-zoom camera. That works very well,
>> but I want to use the camera with a Raspberry Pi, which of course does not
>> have a serial port (RS232). One option is to use a RS232 to usb adapter and
>> rewrite the C code for the usb port. So how do I go about that? Is
>> usb serial port programming possible and documented anywhere?
>
> Nothing to "rewrite", just point your code at /dev/ttyUSB0 instead, and
> away you go...
Thanks for the prompt answer!
That's what I was hoping for, and I would have tried that, but I don't
have any /dev/ttyUSBX. I am connecting the camera to a usb to RS232
cable:
http://www.amazon.com/gp/product/B000BI95W0/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1
Does this mean my adapter is not supported by linux? Also, nothing
happens in /var/log/messages when I plug the cable into the usb port.
This is my lsusb:
1) root:~> lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 003: ID 0c45:1050 Microdia CF Card Reader
Bus 005 Device 002: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 008: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 005: ID 04fc:0561 Sunplus Technology Co., Ltd Flexcam 100
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
No trace of the adapter.
Should /dev/ttyUSB0 pop up when I plug the adapter into the usb port,
even before I connect anything to the serial port of the cable?
If the adapter is not supported, can I write a driver for it? I'll be happy to,
with a little guidance to get me started. Any pointers?
Thanks!
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-21 18:27 ` Bruce Rowen
@ 2014-07-21 19:05 ` Amadeus W.M.
2014-07-21 19:42 ` Bruce Rowen
0 siblings, 1 reply; 12+ messages in thread
From: Amadeus W.M. @ 2014-07-21 19:05 UTC (permalink / raw)
To: kernelnewbies
On Mon, 21 Jul 2014 12:27:44 -0600, Bruce Rowen wrote:
> Assuming your camera is RS232, you can use a simple RS232 daughter card on the Raspberry (about $7 from MCM electronics and others).
> I have done this exact thing for communications with an old RS232 device.
>
> Alternative is of course a USB to RS232 adapter and as Greg writes, you just change the target device file (the $7 adapter also creates a /dev/ttyxxx device.
>
> -Bruce
> On Jul 21, 2014, at 12:18 PM, Greg KH <greg@kroah.com> wrote:
>
Thank you, that's useful. This, you mean?
http://www.mcmelectronics.com/product/83-15630
This one is for Arduino. I couldn't find one for Pi on the MSM site, but
knowing what to search for lead me to a plethora of expansion cards for
the RPi:
http://elinux.org/RPi_Expansion_Boards#RS232_to_TTL_converter
Thank you for the pointer.
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-21 18:55 ` Amadeus W.M.
@ 2014-07-21 19:06 ` Greg KH
2014-07-21 19:25 ` Amadeus W.M.
0 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2014-07-21 19:06 UTC (permalink / raw)
To: kernelnewbies
On Mon, Jul 21, 2014 at 06:55:43PM +0000, Amadeus W.M. wrote:
> On Mon, 21 Jul 2014 11:18:28 -0700, Greg KH wrote:
>
> > On Mon, Jul 21, 2014 at 03:19:00AM +0000, Amadeus W.M. wrote:
> >> Not sure if this is the right venue for this question, please direct me to
> >> the right place if it's not.
> >>
> >> I have a C program that opens the serial port /dev/ttyS0 and sends commands
> >> (as strings) back and forth to a pan-tilt-zoom camera. That works very well,
> >> but I want to use the camera with a Raspberry Pi, which of course does not
> >> have a serial port (RS232). One option is to use a RS232 to usb adapter and
> >> rewrite the C code for the usb port. So how do I go about that? Is
> >> usb serial port programming possible and documented anywhere?
> >
> > Nothing to "rewrite", just point your code at /dev/ttyUSB0 instead, and
> > away you go...
>
> Thanks for the prompt answer!
>
> That's what I was hoping for, and I would have tried that, but I don't
> have any /dev/ttyUSBX. I am connecting the camera to a usb to RS232
> cable:
>
> http://www.amazon.com/gp/product/B000BI95W0/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1
>
> Does this mean my adapter is not supported by linux? Also, nothing
> happens in /var/log/messages when I plug the cable into the usb port.
> This is my lsusb:
>
> 1) root:~> lsusb
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 005 Device 003: ID 0c45:1050 Microdia CF Card Reader
> Bus 005 Device 002: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse
> Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 004 Device 008: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
> Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 003 Device 005: ID 04fc:0561 Sunplus Technology Co., Ltd Flexcam 100
> Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
>
> No trace of the adapter.
What is the:
Bus 004 Device 008: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
device?
> Should /dev/ttyUSB0 pop up when I plug the adapter into the usb port,
> even before I connect anything to the serial port of the cable?
Yes.
What happens in the kernel log when you plug the device into the system?
Try doing:
dmesg -c
# plug in the adapter now
dmesg
to just see the log messages for that, and not the whole kernel boot
log.
> If the adapter is not supported, can I write a driver for it? I'll be happy to,
> with a little guidance to get me started. Any pointers?
Odds are the device id just needs to be added to an existing driver as
I do not know of any "new" usb-serial converter chips that Linux does
not already support.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-21 19:06 ` Greg KH
@ 2014-07-21 19:25 ` Amadeus W.M.
2014-07-21 19:46 ` Greg KH
0 siblings, 1 reply; 12+ messages in thread
From: Amadeus W.M. @ 2014-07-21 19:25 UTC (permalink / raw)
To: kernelnewbies
>
> What is the:
> Bus 004 Device 008: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
>
> device?
That's my backup power supply.
>
>> Should /dev/ttyUSB0 pop up when I plug the adapter into the usb port,
>> even before I connect anything to the serial port of the cable?
>
> Yes.
>
> What happens in the kernel log when you plug the device into the system?
>
> Try doing:
> dmesg -c
> # plug in the adapter now
> dmesg
> to just see the log messages for that, and not the whole kernel boot
> log.
>
2) root:~> dmesg -c #plug-in adapter
3) root:~> dmesg
Absolutely nothing. I also did
tail -f /var/log/messages
then plugged in the adapter, and again, everything seems dead. The USB port
is ok, because other devices (e.g. the Fushicai video grabber) do work.
>> If the adapter is not supported, can I write a driver for it? I'll be happy to,
>> with a little guidance to get me started. Any pointers?
>
> Odds are the device id just needs to be added to an existing driver as
> I do not know of any "new" usb-serial converter chips that Linux does
> not already support.
>
Oh, one more thing. Reading about these converters, I saw many use an
ftdi chip, so I did modprobed ftdi_elan and ftdi_sio:
7) root:~> lsmod | grep ftdi
ftdi_elan 36689 0
ftdi_sio 48770 0
In fact, the dmesg above was with the ftdi modules loaded.
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-21 19:05 ` Amadeus W.M.
@ 2014-07-21 19:42 ` Bruce Rowen
0 siblings, 0 replies; 12+ messages in thread
From: Bruce Rowen @ 2014-07-21 19:42 UTC (permalink / raw)
To: kernelnewbies
On Jul 21, 2014, at 1:05 PM, "Amadeus W.M." <amadeus84@verizon.net> wrote:
> On Mon, 21 Jul 2014 12:27:44 -0600, Bruce Rowen wrote:
>
>> Assuming your camera is RS232, you can use a simple RS232 daughter card on the Raspberry (about $7 from MCM electronics and others).
>> I have done this exact thing for communications with an old RS232 device.
>>
>> Alternative is of course a USB to RS232 adapter and as Greg writes, you just change the target device file (the $7 adapter also creates a /dev/ttyxxx device.
>>
>> -Bruce
>> On Jul 21, 2014, at 12:18 PM, Greg KH <greg@kroah.com> wrote:
>>
>
> Thank you, that's useful. This, you mean?
>
> http://www.mcmelectronics.com/product/83-15630
It looks like they may no longer carry it, sorry. There are others out there, try googling 'raspberry serial port GPIO adapter'
>
> This one is for Arduino. I couldn't find one for Pi on the MSM site, but
> knowing what to search for lead me to a plethora of expansion cards for
> the RPi:
>
> http://elinux.org/RPi_Expansion_Boards#RS232_to_TTL_converter
The USB-serial adapter may be the more expedient solution at this point,
Good luck!
>
> Thank you for the pointer.
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-21 19:25 ` Amadeus W.M.
@ 2014-07-21 19:46 ` Greg KH
2014-07-23 0:26 ` Amadeus W.M.
0 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2014-07-21 19:46 UTC (permalink / raw)
To: kernelnewbies
On Mon, Jul 21, 2014 at 07:25:24PM +0000, Amadeus W.M. wrote:
> >
> > What is the:
> > Bus 004 Device 008: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
> >
> > device?
>
> That's my backup power supply.
>
>
> >
> >> Should /dev/ttyUSB0 pop up when I plug the adapter into the usb port,
> >> even before I connect anything to the serial port of the cable?
> >
> > Yes.
> >
> > What happens in the kernel log when you plug the device into the system?
> >
> > Try doing:
> > dmesg -c
> > # plug in the adapter now
> > dmesg
> > to just see the log messages for that, and not the whole kernel boot
> > log.
> >
> 2) root:~> dmesg -c #plug-in adapter
> 3) root:~> dmesg
>
> Absolutely nothing. I also did
>
> tail -f /var/log/messages
Then USB isn't working :(
Or the device isn't, can you plug it into some other computer to test it
out?
> then plugged in the adapter, and again, everything seems dead. The USB port
> is ok, because other devices (e.g. the Fushicai video grabber) do work.
Sounds like a broken device.
> >> If the adapter is not supported, can I write a driver for it? I'll be happy to,
> >> with a little guidance to get me started. Any pointers?
> >
> > Odds are the device id just needs to be added to an existing driver as
> > I do not know of any "new" usb-serial converter chips that Linux does
> > not already support.
> >
>
> Oh, one more thing. Reading about these converters, I saw many use an
> ftdi chip, so I did modprobed ftdi_elan and ftdi_sio:
>
> 7) root:~> lsmod | grep ftdi
> ftdi_elan 36689 0
> ftdi_sio 48770 0
>
> In fact, the dmesg above was with the ftdi modules loaded.
You should get some kernel log messages when a new USB device is plugged
in, no matter what type it is. The fact that you are not is a problem.
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-21 3:19 usb serial programming Amadeus W.M.
2014-07-21 18:18 ` Greg KH
@ 2014-07-22 5:12 ` Sudip Mukherjee
2014-07-23 0:29 ` Amadeus W.M.
1 sibling, 1 reply; 12+ messages in thread
From: Sudip Mukherjee @ 2014-07-22 5:12 UTC (permalink / raw)
To: kernelnewbies
On Mon, Jul 21, 2014 at 8:49 AM, Amadeus W.M. <amadeus84@verizon.net> wrote:
> Not sure if this is the right venue for this question, please direct me to
> the right place if it's not.
>
> I have a C program that opens the serial port /dev/ttyS0 and sends commands
> (as strings) back and forth to a pan-tilt-zoom camera. That works very well,
> but I want to use the camera with a Raspberry Pi, which of course does not
> have a serial port (RS232). One option is to use a RS232 to usb adapter and
> rewrite the C code for the usb port. So how do I go about that? Is
> usb serial port programming possible and documented anywhere?
Raspberry PI is not having a dedicated serial port but GPIO14 and
GPIO15 are the Rx and Tx pins , so you can just connect a max3232 to
have a serial port .
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-21 19:46 ` Greg KH
@ 2014-07-23 0:26 ` Amadeus W.M.
0 siblings, 0 replies; 12+ messages in thread
From: Amadeus W.M. @ 2014-07-23 0:26 UTC (permalink / raw)
To: kernelnewbies
>> In fact, the dmesg above was with the ftdi modules loaded.
>
> You should get some kernel log messages when a new USB device is plugged
> in, no matter what type it is. The fact that you are not is a problem.
>
> greg k-h
Do you suppose this would work?
http://www.amazon.com/gp/product/B006PIU2KO/ref=ox_sc_act_title_1?ie=UTF8&psc=1&smid=A3CTCSJRE9G6AY
^ permalink raw reply [flat|nested] 12+ messages in thread
* usb serial programming
2014-07-22 5:12 ` Sudip Mukherjee
@ 2014-07-23 0:29 ` Amadeus W.M.
0 siblings, 0 replies; 12+ messages in thread
From: Amadeus W.M. @ 2014-07-23 0:29 UTC (permalink / raw)
To: kernelnewbies
> Raspberry PI is not having a dedicated serial port but GPIO14 and
> GPIO15 are the Rx and Tx pins , so you can just connect a max3232 to
> have a serial port .
I believe that requires some capacitors and possibly some electronics,
so I ordered one ready-made from China for $3 including shipping.
It's on its way. Slowly.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-07-23 0:29 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-21 3:19 usb serial programming Amadeus W.M.
2014-07-21 18:18 ` Greg KH
2014-07-21 18:27 ` Bruce Rowen
2014-07-21 19:05 ` Amadeus W.M.
2014-07-21 19:42 ` Bruce Rowen
2014-07-21 18:55 ` Amadeus W.M.
2014-07-21 19:06 ` Greg KH
2014-07-21 19:25 ` Amadeus W.M.
2014-07-21 19:46 ` Greg KH
2014-07-23 0:26 ` Amadeus W.M.
2014-07-22 5:12 ` Sudip Mukherjee
2014-07-23 0:29 ` Amadeus W.M.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).