Author Topic: Can I use a usb port as a com-port?  (Read 3382 times)

Wim Brul

  • Full Member
  • ***
  • Thank You
  • -Given: 3
  • -Receive: 28
  • Posts: 130
    • View Profile
    • Wim's home page
Re: Can I use a usb port as a com-port?
« Reply #15 on: March 16, 2017, 11:48:24 am »
Hallo Roberto,

Win, with usbcom.sys 10.215

MODE COM8:110,N,8,1,TO=ON
SYS0700: The baud rate 110 is not supported by the serial port hardware.

 I test with 110,150,300,9600,57600 and in all cases the same error.
Saludos

There are 3 things that you could do:

1. Try the valerius usbcom.sys driver.

2. Try the following MODE command:
Code: [Select]
/* setup communication mode */
'MODE '||ddName||',,N,8,1'

3. Try without the MODE command.

Regards
« Last Edit: March 16, 2017, 06:53:54 pm by Wim Brul »

roberto

  • Sr. Member
  • ****
  • Thank You
  • -Given: 13
  • -Receive: 6
  • Posts: 295
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #16 on: March 16, 2017, 06:11:30 pm »
There are 3 things that you could do:
1. Try the valerius usbcom.sys driver.
The link is dead.
Quote
2. Try the following MODE command:
COM8,,N,8,1
Unknown command "COM8"

MODE COM8,,N,8,1
SYS0700: The baud rate 300 is not supported by the serial port hardware.

At this point I can think of other possible solutions:
1- Open-close the port with rxusbcalls, and send the commands.The usbcalls work well.
2- Buy a USB cable to rs232, and connect it with two cables to the board. As David proposes. But it is possible that the converter cable has another 2303.
3- Use it as paperweights, hahaha.
I appreciate your opinion.
Saludos

Saludos

ivan

  • Hero Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 24
  • Posts: 630
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #17 on: March 16, 2017, 07:02:50 pm »
The link isn't dead because I just downloaded it (now attached here just in case your ISP is blocking you).

Edit:
I still think you should try with a 5 volt power supply as well.  We have a client that uses similar boards and they refuse to work unless there is a separate 5v supply.
« Last Edit: March 16, 2017, 07:06:19 pm by ivan »

roberto

  • Sr. Member
  • ****
  • Thank You
  • -Given: 13
  • -Receive: 6
  • Posts: 295
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #18 on: March 16, 2017, 11:00:47 pm »
Ivan , Thanks for the file. After donwload your file, the link works well.
With this driver:usbcom-20110818.zip
[D:\usbreles]mode com8
SYS0021: The drive is not ready.

[D:\usbreles]MODE COM8:110,N,8,1,TO=ON
SYS0020: The system cannot find the device specified.
NOTREADY:20 Device driver COM8 currently in use. Please try later.

After that I modifi config.sys to default usbcom.sys /V
And show COM1 in charge, but the same error in com1
The power supply is on and with voltage in all tests.
Saludos

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 7
  • -Receive: 87
  • Posts: 1095
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #19 on: March 16, 2017, 11:59:43 pm »
If you're planning on buying ArcaOS, just wait till the end of the month as it ships with a usbcom.sys that should work for you, otherwise I guess you need an Arca Noae subscription

ivan

  • Hero Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 24
  • Posts: 630
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #20 on: March 17, 2017, 07:49:48 pm »
Another thing that might be the problem.

All the computers that we manage that are using USB com port units also have, and load, the standard com.sys driver.

I don't know if this is necessary, it was there when we imaged the disk for these units and all we did was add the usbcom.sys when the new motherboards no longer has normal com ports.


André Heldoorn

  • Full Member
  • ***
  • Thank You
  • -Given: 37
  • -Receive: 7
  • Posts: 190
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #21 on: March 18, 2017, 09:24:15 am »
the new motherboards no longer has normal com ports.

[pedantic]Only the connector is missing. Or, in the case of some portable computers, the connector looks like a docking station connector. A port replicator will replicate an existing port.[/pedantic]. Of course USB will have been a desktop's reasonable and efficient alternative for soldering, and so on.

Just pointing out that the port will still be there, so users of such a "normal" serial connector don't always have to throw away their devices or debuggers.

ivan

  • Hero Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 24
  • Posts: 630
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #22 on: March 18, 2017, 10:36:44 am »
<even more pedantic>Many of the new boards don't even have the header in the board any more.  Those that do we solder a set of pins in place that allow us to plug in standard ports.</even more pedantic>  All said with a big smile.

Unfortunately, the manufacturers are headed in the direction of not having the UART on the boards now so everything has to be USB (Intel I'm looking at you).

roberto

  • Sr. Member
  • ****
  • Thank You
  • -Given: 13
  • -Receive: 6
  • Posts: 295
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #23 on: March 18, 2017, 01:46:55 pm »
Quote
  All said with a big smile.
Finally someone with a little humor! It is also good to laugh. jajaja

Dave, I can wait for the new Arcanoae version.
Saludos

Wim Brul

  • Full Member
  • ***
  • Thank You
  • -Given: 3
  • -Receive: 28
  • Posts: 130
    • View Profile
    • Wim's home page
Re: Can I use a usb port as a com-port?
« Reply #24 on: March 18, 2017, 04:18:10 pm »
Hallo Roberto,

Quote
At this point I can think of other possible solutions:
1- Open-close the port with rxusbcalls, and send the commands.The usbcalls work well.
2- Buy a USB cable to rs232, and connect it with two cables to the board. As David proposes. But it is possible that the converter cable has another 2303.
3- Use it as paperweights, hahaha.
I appreciate your opinion.

I would go for option 1 first.
So I prepared some rexx code that, to begin with, tries to get the current settings of baudrate, stopbits, parity and databits and to set these to 9600,N,8,1.
For this to work you need to rem out the usbcom.sys device driver statement in config.sys.
I modified Code Snippets taken from the "USBCALLS - REXX/2 Reference Guide".

Code: [Select]
/* add UsbLoadFuncs */
rc = RxFuncAdd('UsbLoadFuncs','usbcalls','UsbLoadFuncs')
say '+UsbLoadFuncs(),RC=0x'd2x(rc)
/* invoke UsbLoadFuncs */
rc = ('' <> UsbLoadFuncs())
say '*UsbLoadFuncs(),RC=0x'b2x(rc)
/* drop UsbLoadFuncs */
rc = RxFuncDrop('UsbLoadFuncs')
say '-UsbLoadFuncs(),RC=0x'd2x(rc)

/* invoke RxUsbOpen */
drop Handle /* receives device handle */
EnumDevice=0 /* accept any free device */
idVendor=x2d(067B) /* vendor identifier */
idProduct=x2d(2303) /* product identifier */
bcdDevice=x2d(0300) /* device release number */
rc = RxUsbOpen(Handle,EnumDevice,idVendor,idProduct,bcdDevice)
say '*RxUsbOpen(),RC=0x'd2x(rc)

/* invoke RxUsbDeviceSetConfiguration */
Config=1 /* configuration value to be set */
rc = RxUsbDeviceSetConfiguration(Handle,Config)
say '*RxUsbDeviceSetConfiguration(),RC=0x'd2x(rc)

/* invoke RxUsbCtrlMessage device-to-host */
drop Data /* receives string of data bytes read */
RequestType=x2d(A1); Request=x2d(21) /* GetLineCoding interface class */
Value=x2d(0000); Index=x2d(0000); NumBytes=7; Timeout=8000; /* interface 0 */
rc = RxUsbCtrlMessage(Handle,RequestType,Request,Value,Index,NumBytes,Data,Timeout)
say '*RxUsbCtrlMessage(),RC=0x'd2x(rc)
if (rc = 0) then do
  say ' BaudRate:' c2x(reverse(substr(Data,1,4)))
  say ' StopBits:' c2x(substr(Data,5,1))
  say ' ParyType:' c2x(substr(Data,6,1))
  say ' DataBits:' c2x(substr(Data,7,1))
end

/* invoke RxUsbCtrlMessage host-to-device */
Data=x2c(80250000 00 00 08) /* 9600,N,8,1 */
RequestType=x2d(21); Request=x2d(20) /* SetLineCoding interface class */
Value=x2d(0000); Index=x2d(0000); drop NumBytes; Timeout=8000; /* interface 0 */
rc = RxUsbCtrlMessage(Handle,RequestType,Request,Value,Index,NumBytes,Data,Timeout)
say '*RxUsbCtrlMessage(),RC=0x'd2x(rc)
if (rc = 0) then do
  say ' BaudRate:' c2d(reverse(substr(Data,1,4)))
  say ' StopBits:' c2d(substr(Data,5,1))
  say ' ParyType:' c2d(substr(Data,6,1))
  say ' DataBits:' c2d(substr(Data,7,1))
end

/* invoke RxUsbClose */
rc = RxUsbClose(Handle)
say '*RxUsbClose(),RC=0x'd2x(rc)

/* add UsbDropFuncs */
rc = RxFuncAdd('UsbDropFuncs','usbcalls','UsbdropFuncs')
say '+UsbDropFuncs(),RC=0x'd2x(rc)
/* invoke UsbDropFuncs */
rc = ('' <> UsbDropFuncs())
say '*UsbDropFuncs(),RC=0x'b2x(rc)
/* drop UsbDropFuncs */
rc = RxFuncDrop('UsbDropFuncs')
say '-UsbDropFuncs(),RC=0x'd2x(rc)

   



 


roberto

  • Sr. Member
  • ****
  • Thank You
  • -Given: 13
  • -Receive: 6
  • Posts: 295
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #25 on: March 18, 2017, 11:30:41 pm »
The return:
[d:\usbreles]urwim.cmd
+UsbLoadFuncs(),RC=0x0
*UsbLoadFuncs(),RC=0x0
-UsbLoadFuncs(),RC=0x0
*RxUsbOpen(),RC=0x0
*RxUsbDeviceSetConfiguration(),RC=0x0
*RxUsbCtrlMessage(),RC=0x0
 BaudRate: 00002580
 StopBits: 00
 ParyType: 00
 DataBits: 00
*RxUsbCtrlMessage(),RC=0x0
 BaudRate: 9600
 StopBits: 0
 ParyType: 0
 DataBits: 8
*RxUsbClose(),RC=0x0
+UsbDropFuncs(),RC=0x0
*UsbDropFuncs(),RC=0x0
-UsbDropFuncs(),RC=0x0
End return ----------
I have doubts, if I should include this line, because the pcboard says to speak English (usbtest.cmd), and I have the default system in code page 850.
 /* load all RexxUtil functions */
Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
Call SysLoadFuncs
rc=SysSetProcessCodePage(437)

Saludos

Wim Brul

  • Full Member
  • ***
  • Thank You
  • -Given: 3
  • -Receive: 28
  • Posts: 130
    • View Profile
    • Wim's home page
Re: Can I use a usb port as a com-port?
« Reply #26 on: March 19, 2017, 11:08:04 am »
Hallo Roberto,

Quote
I have doubts, if I should include this line, because the pcboard says to speak English (usbtest.cmd), and I have the default system in code page 850.
 /* load all RexxUtil functions */
Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
Call SysLoadFuncs
rc=SysSetProcessCodePage(437)

That is not necessary. I think It only relates to the string descriptors.

The posted results are so far so good. Therefore I have rearranged and extended the script.
It sets DTR and RTS and tries to bulk write 8 bytes of 0x50 and to bulk read any response.

Code: [Select]
/* add UsbLoadFuncs */
rc = RxFuncAdd('UsbLoadFuncs','usbcalls','UsbLoadFuncs')
say '+UsbLoadFuncs(),RC=0x'd2x(rc)
/* invoke UsbLoadFuncs */
rc = ('' <> UsbLoadFuncs())
say '*UsbLoadFuncs(),RC=0x'b2x(rc)
/* drop UsbLoadFuncs */
rc = RxFuncDrop('UsbLoadFuncs')
say '-UsbLoadFuncs(),RC=0x'd2x(rc)

/* invoke RxUsbOpen */
drop Handle /* receives device handle */
EnumDevice=0 /* accept any free device */
idVendor=x2d(067B) /* vendor identifier */
idProduct=x2d(2303) /* product identifier */
bcdDevice=x2d(0300) /* device release number */
rc = RxUsbOpen(Handle,EnumDevice,idVendor,idProduct,bcdDevice)
say '*RxUsbOpen(),RC=0x'd2x(rc)

/* invoke RxUsbDeviceSetConfiguration */
Config=1 /* configuration value to be set */
rc = RxUsbDeviceSetConfiguration(Handle,Config)
say '*RxUsbDeviceSetConfiguration(),RC=0x'd2x(rc)

/* invoke RxUsbCtrlMessage host-to-device */
Data=x2c(80250000 00 00 08) /* 9600,1,N,8 */
RequestType=x2d(21); Request=x2d(20) /* SetLineCoding interface class */
Value=x2d(0000); Index=x2d(0000); drop NumBytes; Timeout=8000; /* interface 0 */
rc = RxUsbCtrlMessage(Handle,RequestType,Request,Value,Index,NumBytes,Data,Timeout)
say '*RxUsbCtrlMessage(),RC=0x'd2x(rc)
if (rc = 0) then do
  say ' BaudRate:' c2d(reverse(substr(Data,1,4)))
  say ' StopBits:' c2d(substr(Data,5,1))
  say ' ParyType:' c2d(substr(Data,6,1))
  say ' DataBits:' c2d(substr(Data,7,1))
end

/* invoke RxUsbCtrlMessage device-to-host */
drop Data /* receives string of data bytes read */
RequestType=x2d(A1); Request=x2d(21) /* GetLineCoding interface class */
Value=x2d(0000); Index=x2d(0000); NumBytes=7; Timeout=8000; /* interface 0 */
rc = RxUsbCtrlMessage(Handle,RequestType,Request,Value,Index,NumBytes,Data,Timeout)
say '*RxUsbCtrlMessage(),RC=0x'd2x(rc)
if (rc = 0) then do
  say ' BaudRate:' c2d(reverse(substr(Data,1,4)))
  say ' StopBits:' c2d(substr(Data,5,1))
  say ' ParyType:' c2d(substr(Data,6,1))
  say ' DataBits:' c2d(substr(Data,7,1))
end

/* invoke RxUsbCtrlMessage host-to-device */
RequestType=x2d(21); Request=x2d(22) /* SetControlLineState interface class */
Value=x2d(0300); Index=x2d(0000); drop NumBytes; Timeout=8000; /* DTR=ON,RTS=ON,interface 0 */
rc = RxUsbCtrlMessage(Handle,RequestType,Request,Value,Index,NumBytes,,Timeout)
say '*RxUsbCtrlMessage(),RC=0x'd2x(rc)

/* invoke RxUsbBulkWrite */
drop NumBytes /* receives number of data bytes written */
Endpoint=2; AltSetting=0; Data=copies(x2c(50),8); Timeout=8000
rc = RxUsbBulkWrite(Handle,Endpoint,AltSetting,NumBytes,Data,Timeout)
say '*RxUsbBulkWrite(),RC=0x'd2x(rc)

/* invoke RxUsbBulkRead */
drop Data /* receives string of data bytes read */
Endpoint=128+3; AltSetting=0; NumBytes=8; Timeout=8000
rc = RxUsbBulkRead(Handle,Endpoint,AltSetting,NumBytes,Data,Timeout)
say '*RxUsbBulkRead(),RC=0x'd2x(rc)
if (rc = 0) then do
  say ' Data:' c2x(Data)
end

/* invoke RxUsbClose */
rc = RxUsbClose(Handle)
say '*RxUsbClose(),RC=0x'd2x(rc)

/* add UsbDropFuncs */
rc = RxFuncAdd('UsbDropFuncs','usbcalls','UsbdropFuncs')
say '+UsbDropFuncs(),RC=0x'd2x(rc)
/* invoke UsbDropFuncs */
rc = ('' <> UsbDropFuncs())
say '*UsbDropFuncs(),RC=0x'b2x(rc)
/* drop UsbDropFuncs */
rc = RxFuncDrop('UsbDropFuncs')
say '-UsbDropFuncs(),RC=0x'd2x(rc)


Regards
« Last Edit: March 19, 2017, 11:16:10 am by Wim Brul »

roberto

  • Sr. Member
  • ****
  • Thank You
  • -Given: 13
  • -Receive: 6
  • Posts: 295
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #27 on: March 19, 2017, 01:17:10 pm »
[d:\usbreles]urwim2
+UsbLoadFuncs(),RC=0x0
*UsbLoadFuncs(),RC=0x0
-UsbLoadFuncs(),RC=0x0
*RxUsbOpen(),RC=0x0
*RxUsbDeviceSetConfiguration(),RC=0x0
*RxUsbCtrlMessage(),RC=0x0
 BaudRate: 9600
 StopBits: 0
 ParyType: 0
 DataBits: 8
*RxUsbCtrlMessage(),RC=0x0
 BaudRate: 9600
 StopBits: 0
 ParyType: 0
 DataBits: 8
*RxUsbCtrlMessage(),RC=0x0
*RxUsbBulkWrite(),RC=0x0
*RxUsbBulkRead(),RC=0x280
*RxUsbClose(),RC=0x0
+UsbDropFuncs(),RC=0x0
*UsbDropFuncs(),RC=0x0
-UsbDropFuncs(),RC=0x0


roberto

  • Sr. Member
  • ****
  • Thank You
  • -Given: 13
  • -Receive: 6
  • Posts: 295
    • View Profile
Re: Can I use a usb port as a com-port?
« Reply #28 on: March 19, 2017, 02:58:27 pm »
I think that this file can help you, is the result from usbwrite.cmd, I attach.
I do not undertand endpoint=128+3
And *RxUsbBulkRead(),RC=0x280
the x280 when I wait for AC
By now is nice.

Wim Brul

  • Full Member
  • ***
  • Thank You
  • -Given: 3
  • -Receive: 28
  • Posts: 130
    • View Profile
    • Wim's home page
Re: Can I use a usb port as a com-port?
« Reply #29 on: March 19, 2017, 04:20:19 pm »
Hi Roberto,
I think that this file can help you, is the result from usbwrite.cmd, I attach.
I have that information already, but thanks anyway.
Quote
I do not undertand endpoint=128+3
endpoint=128+3 is the same as endpoint=x2d(83) and is the bulk input endpoint. The direction bit is 0x80 (hexadecimal) which is 128 (decimal) for input.
Quote
And *RxUsbBulkRead(),RC=0x280
the x280 when I wait for AC
The 0x280 is ERROR_TIMEOUT. The RxBulkRead waited 8 seconds for the 8 byte input. Please modify it to ask for only 1 byte. Perhaps that will work then.
Quote
By now is nice.
It could be better though.

Edited: I am now looking in pl2303.c from linux and I see that some vendor specific requests are required.
It is time for dinner now. After some study I will hopefully reply tomorrow.

Regards
« Last Edit: March 19, 2017, 06:39:30 pm by Wim Brul »