Serial Port/USB
Pages: 1 2
Chris Hall (132) 3554 posts |
To detect your USB serial link and obtain its USB number, you would need the information obtained with !USBDescriptor or !UsbInfo report just for this device. Or from *USBDevices The cheap USB-connected GPS devices are not supported by SerialUSB hence I am accessing them directly by their USB number. |
Norman Lawrence (3005) 172 posts |
It looks like you have done everything correctly in regards to the more expensive device (GlobalSat BU-353-S4 USB GPS Receiver). According to the GlobalSat manual, the device works only at 4800 baud rate, the correct OPENIN line is just as you have indicated. I use Before sending it back to the suppliers with a dead on arrival note, you should check that it is functioning correctly by trying it out on Windows. You can download the driver (Windows USB Driver) and simple app (GPS Info Tool For Windows) from the GlobalSat website https://www.globalsat.com.tw/en/a4-10593/BU-353S4.html. |
Jean-Michel BRUCK (3009) 359 posts |
Norman,, I agree with you, SerialUSB should work, but if you unplug and replug the port number is incremented ex: SerialUSB1. Hoping that the GlobalSat BU-353-S4 USB GPS Receiver module, is not out of order. |
Norman Lawrence (3005) 172 posts |
@Chris |
Chris Hall (132) 3554 posts |
Hopefully, Yes. Not sure I would claim that it was elegant. It does have 9600 baud specified in the BASIC programme (but that would be easy to amend). The full list of changes is given below (the programme LineData also has similar changes in its initialisation rourine.
|
Ronald (387) 195 posts |
The routine for finding the USB device numbers will be handy, cant recall the details but some audio boxes start up with unusual interfaces and have to be programmed initially. |
Andrew Conroy (370) 740 posts |
To find the USB device number, if you know the VID & PID for the device, can you look for the sys var
|
Chris Hall (132) 3554 posts |
Yes, it would return the two values:
both of which evaluate to 8. When you unplug the device the system variable gets unset, even if you still have an endpoint open. If you plug it back in then it evaluates to a new USB number. Nice one. One reason I do it via the description field is that I have two devices from the same vendor that have different product IDs but the same first six characters of the description. With one set up I can use either device. |
Norman Lawrence (3005) 172 posts |
versatile perhaps? @Chris One strange thing is that when I use Quit to close SatNav and then try to restart it, I get an Endpoint in use error in “Line Data: SVR line data and sprite data for text” |
Chris Hall (132) 3554 posts |
SatNav should close the input stream because unlike files you cannot open a stream more than once. Use the *SHUT command if you are not running anything else. By the time you get the endpoint in use error it no longer knows the file handle to close. |
Paul Porcelijn (8775) 10 posts |
Raspberry Pico can be configured as a USBserial device, duly identified as such bij *USBDevices: No. Bus Dev Class Description 1 1 1 9/ 0 Built-in EHCI root hub 2 1 2 9/ 0 Terminus Technology USB 2.0 Hub [MTT] 3 1 3 9/ 0 Terminus Technology USB 2.0 Hub 4 1 4 EF/ 2 MicroPython Board in FS mode 5 1 5 0/ 0 PixArt USB Optical Mouse 6 1 6 0/ 0 USB Keyboard USB Keyboard 7 2 1 9/ 0 Built-in EHCI root hub 8 1 7 FF/ 0 QinHeng Electronics USB SerialUSB4 MicroPython Dev USB4 Info: USB release : 0200
Conf USB4 Info: Current config : 1
Interface 0.0 class 2.2:0 ‘Board CDC’ Interface 1.0 class 10.0:0 ’’ Raspberry Pico thus presents itself as CDC serial defice with 3 endpoints (Bulk IN, Bulk OUT and Control). Quite normal. |
Thomas Milius (7848) 116 posts |
I don’t know whether the SerialUSB module is the right place to cope with this. |
Ronald (387) 195 posts |
I found this cdc open source driver code some time ago. |
Thomas Milius (7848) 116 posts |
In general USB devices which are acting a bit like a classical terminal (like a command shell or excepting AT commands as modems) can be accessed directly by reading and writing writing directly from/to the USB device. However compared to serial interfaces there is a subtile difference. Whilst a device can send characters at any time towards you USB bulk transfers requires that your program makes a “get data from device” inquiry. http://thomas-milius-stade.dnshome.de/Download/Freeware/USBSDvEmu.zip and http://thomas-milius-stade.dnshome.de/Download/Open_Source/USBSDvEmu_c.zip |
Chris Hall (132) 3554 posts |
SatNav has been updated to version 2.56 and now uses USB connected GPS devices in preference to OS_SerialOp only whilst one is plugged in. It therefore works on a ‘plug and play’ basis allowing the GPS unit to be unplugged and plugged in again (which changes its enumeration) without raising an error. Most cheap GPS devices on Amazon should work. 9600baud is assumed. Tested on a Pinebook Pro, it allows the device to be unplugged and plugged in again and SatNav continues working with no error, getting a GPS fix and calling on RiscOSM (if present, whether running or not so long as it has been ‘seen’ by the filer) to draw a map. The relevant changes to the code are as follows:
|
Pages: 1 2