Serial Port/USB
Pages: 1 2
Chris Hall (132) 3558 posts |
On a machine (this is not a Raspberry Pi) with several USB ports, how do I tell OS_SerialOp which of the USB ports has incoming serial data? Or does it look at them all? |
Rick Murray (539) 13850 posts |
Doesn’t SerialOp always only talk to the internal hardware serial port? If you have a USB serial device, you’ll need Colin’s USB driver, and to talk to it via a DeviceFS handle (though if you’re familiar with serial blockdrivers, that’s possibly a simpler option?). For my weather station, I simply open two file handles (input and output) passing the serial format as a special string. That is to say: device$ = "SerialUSB#baud=2400;data=8;stop=1;noparity;nohandshake;noblock:" out% = OPENOUT(device$) in% = OPENIN(device$) Then just BGET and BPUT as necessary. If you need to fiddle with the data control lines (the weather station needs RTS on and DTR pulsed to wake it up), the OS_Args SWI with IOCTL commands to the output handle will do that. Get back to me if you need some example code. I won’t write it below as I’m writing this on my phone and automangle really loves snippets of code. ;) |
Chris Hall (132) 3558 posts |
Does SerialUSB work on the Pinebook and Pinebook Pro? |
Andrew Rawnsley (492) 1445 posts |
Chris, you’d want latest XAT SerialDev installed – check !Boot.Resources. On top of that, you’d need a compatible USB→Serial adapter. There are a variety of chips and some are better than others. I want to say that FTDI is the desireable one, but that’s a vague, unsubstantiated memory. Might be best to check the XAT website. |
Chris Hall (132) 3558 posts |
I have a couple of GPS devices which send serial data via a cable which just has a USB plug on the end. So it should be just a matter of using SerialUSB to open an input stream. I am obviously doing something wrong as I can’t even get this going on a Pi! Or the Pinebook for that matter. |
Alan Adams (2486) 1149 posts |
nq. I want to say that FTDI is the desireable one, but that’s a vague, unsubstantiated memory. My car has a diagnostic port which is accessed via a usb-serial FTDI adapter. However when I bought one, and installed the matching software on a laptop, it didn’t work. There are variations within FTDI, and I got a less effective one – or a fake. |
Ronald (387) 195 posts |
*USBDevices shows a list of the recognised devices, at the hardware connection level anyway. |
Chris Hall (132) 3558 posts |
USB descriptor says vendor id 1546 device 1a7 for one and the other is 1546/1a8but I am none the wiser… |
Grahame Parish (436) 481 posts | |
Chris Hall (132) 3558 posts |
There won’t need to be a ‘driver’ for the device itself, all it needs is something on the RISC OS side to read the serial stream. Who cares what is producing it. It is the USB host chip on the RISC OS side that the RISC OS module needs to drive. I have downloaded !SerialDev but the !Serial app shows no serial ports despite there being two USB sockets on the Pi as well as the GPIO TX and RX pins on the 40 pin header (which OS_SerialOp drives). Puzzled. |
Ronald (387) 195 posts |
That looks like a CDC-ACM device, they fall outside the two main supported groups. |
Norman Lawrence (3005) 172 posts |
I use a GlobalSat BU-353-S4 USB GPS Receiver which is a PL2303 device and Colin’s SerialUSB module. It works well on the PineBook. I have not tested it yet on my PineBook Pro, but I see no reason why it would not. Like Ronald, I suspect that your receiver is not one of the types supported by SerialUSB module. |
Chris Hall (132) 3558 posts |
Many thanks for this. I thought I would try two cheap ones in case they worked. This is a bit more expensive but I should be able to get it to work with SatNav and RiscOSM. |
Norman Lawrence (3005) 172 posts |
That will be a very welcome addition to SatNav and RISCOSM. |
Chris Hall (132) 3558 posts |
Hmmm! I have put the XAT !SerialDev into Boot Resources but get the following:
What am I doing wrong please? I am told this device works with SerialUSB. Vendor is 67b item is 23a3 a GlobalSat BU-353-S4 USB GPS Receiver which is a PL2303 device. It is actually marked BU353-N5 on the box but was ordered as a BU-353-S4 and the documentation with it shows it as a BU353-N5 (an upgrade to the BU 353-S4) and confirms that it uses a PL2303 driver. |
Jean-Michel BRUCK (3009) 362 posts |
is not the good way.
To check first:
to :
Attention the USB number changes on each reset or connexion! But to make it much simpler !Hearsay (version 2.24 ) allows you to communicate directly, it will detect your serial port and display it under the icon of the iconbar.You just have to adjust the parameters and choose a communication protocol if necessary. I will start with this solution, to test the NMEA protocol. |
Chris Hall (132) 3558 posts |
1. File ‘USBInfo’ not found 2. !Serial from XAT does not see the device. 3. Using Filer_OpenDir it is shown as USB4 (there are lpr and USB1 to USB9) |
Steve Fryatt (216) 2105 posts |
|
Stuart Swales (8827) 1357 posts |
nohandshake sp.? |
Chris Hall (132) 3558 posts |
Now using USB4 instead of SerialUSB in the OPENIN command, I am getting data but it is gobbldegook. I suspect it is not 4800 baud 8bit 1 stop bit as stated … Guesswork begins. |
Stuart Swales (8827) 1357 posts |
High Speed NMEA @ 38400? |
Chris Hall (132) 3558 posts |
I have tried 1200,2400,4800,9600,19200,38400 and 76800 all give gobbldegook. |
Ronald (387) 195 posts |
*help modules |
Chris Hall (132) 3558 posts |
Firstly it looks as though the expensive device was broken on delivery and was just producing garbage. I tried it on the Pinebook and Raspberry Pi and no joy. !Serial didn’t see it and it produced garbage. Many thanks for all the help. The expensive unit proved to be duff and the cheap units are not supported by SerialUSB. I have abandoned SerialUSB in favour of direct access and one of the cheaper devices works. Now to find a way of discovering the USB# number in software. Bit of a hack but there’s no useful SWI. It needs to use OS_GBPB rather than BGET so that it doesn’t block. Lines 300 and 310 are intended as a drop in replacement for the following line in SatNav:
|
Jean-Michel BRUCK (3009) 362 posts |
I think you have tested this device with Windows for example? For information Colin has developed his module for: |
Pages: 1 2