All of lore.kernel.org
 help / color / mirror / Atom feed
* Possible issue with RS485 IOCTLs on 16C950 UARTs?
@ 2021-10-20 20:44 Matthew Howell
  2021-10-21  7:56 ` gregkh
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Howell @ 2021-10-20 20:44 UTC (permalink / raw)
  To: linux-serial; +Cc: gregkh, Ryan Wenglarz

Hi,

I'm not sure if this is the right place for this, but hopefully someone can help me figure out what else I can do to troubleshoot this problem, or point me to the right place to ask questions about this.

A recent investigation led us to discover issues related to the RS485 IOCTLs on our serial cards utilizing the 16C950 UART. More specifically, the TIOCSRS485 IOCTL to set the serial_rs485 flags as documented at https://www.kernel.org/doc/html/latest/driver-api/serial/serial-rs485.html .

When attempting to set the SER_RS485_ENABLED flag using TIOCSRS485 as per below I receive an error code 25, "Inappropriate IOCTL for device"

        /* -----RS485----- */
        struct serial_rs485 rs485conf = {0};
        rs485conf.flags |= SER_RS485_ENABLED;
        rc = ioctl(fd, TIOCSRS485, &rs485conf);
        if (rc < 0) {
                printf("error=%d %s\n", errno, strerror(errno));
                return rc;
        }

From what I've read this typically indicates an unsupported serial device, but the documentation mentions the 16C950 UART as a specific example, so I would think the kernel is intended to support this functionality on the 16C950.

I have tried this across several kernel versions: 3.10 (Centos 7) , 4.18 (Centos 8), and 5.11 (Ubuntu 21.04) with no change in the behavior.
The issue was originally discovered on a PLX OXPCIe952 UART, but has been replicated on 'standard' OX16C950 UARTs as well. setserial -ag correctly identifies all cards as 16950's (Specifically "16950/954").

Has anyone else had or seen this IOCTL issue on the 16C950? Are there any 'known good' 16C950 based cards people can confirm that this works with?

Let me know if you need any more details/testing. I also tried to configure my email client to behave nicely with the mailing list. Does it seem ok?

P.S, I also tried using 3rd party libraries that support the RS485 flags, such as https://pyserial.readthedocs.io/en/latest/pyserial_api.html#rs485-support, in case there was something broken in my C application, but I get the same error.

Thanks,
Matthew Howell
Applications Engineer
Sealevel Systems, Inc
Confidentiality Notice This message is intended exclusively for the individual or entity to which it is addressed. This communication may contain information that is PROPRIETARY, TRADE SECRET, PRIVILEGED, CONFIDENTIAL or otherwise legally exempt from disclosure. If you are not the named addressee, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this message in error, please notify the sender immediately either by phone (864.843.4343) or reply to this e-mail and delete all copies of this message.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Possible issue with RS485 IOCTLs on 16C950 UARTs?
  2021-10-20 20:44 Possible issue with RS485 IOCTLs on 16C950 UARTs? Matthew Howell
@ 2021-10-21  7:56 ` gregkh
  2021-10-21 14:10   ` mrhowel
  0 siblings, 1 reply; 5+ messages in thread
From: gregkh @ 2021-10-21  7:56 UTC (permalink / raw)
  To: Matthew Howell; +Cc: linux-serial, Ryan Wenglarz

On Wed, Oct 20, 2021 at 08:44:54PM +0000, Matthew Howell wrote:
> Confidentiality Notice This message is intended exclusively for the individual or entity to which it is addressed. This communication may contain information that is PROPRIETARY, TRADE SECRET, PRIVILEGED, CONFIDENTIAL or otherwise legally exempt from disclosure. If you are not the named addressee, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this message in error, please notify the sender immediately either by phone (864.843.4343) or reply to this e-mail and delete all copies of this message.

Now deleted.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Possible issue with RS485 IOCTLs on 16C950 UARTs?
  2021-10-21  7:56 ` gregkh
@ 2021-10-21 14:10   ` mrhowel
  2021-10-21 14:30     ` gregkh
  0 siblings, 1 reply; 5+ messages in thread
From: mrhowel @ 2021-10-21 14:10 UTC (permalink / raw)
  To: gregkh; +Cc: Matthew Howell, linux-serial, Ryan Wenglarz


That noticed is enforced by our exchange server. I have removed it by 
using an external email address instead.

Original message is copied below.

Hi,

I'm not sure if this is the right place for this, but hopefully someone 
can help me figure out what else I can do to troubleshoot this problem, or 
point me to the right place to ask questions about this.

A recent investigation led us to discover issues related to the RS485 
IOCTLs on our serial cards utilizing the 16C950 UART. More specifically, 
the TIOCSRS485 IOCTL to set the serial_rs485 flags as documented at 
https://www.kernel.org/doc/html/latest/driver-api/serial/serial-rs485.html 
.

When attempting to set the SER_RS485_ENABLED flag using TIOCSRS485 as per 
below I receive an error code 25, "Inappropriate IOCTL for device"

	/* -----RS485----- */
	struct serial_rs485 rs485conf = {0};
	rs485conf.flags |= SER_RS485_ENABLED;
	rc = ioctl(fd, TIOCSRS485, &rs485conf);
	if (rc < 0) {
        	printf("error=%d %s\n", errno, strerror(errno));
		return rc;
	}

From what I've read this typically indicates an unsupported serial device, 
but the documentation mentions the 16C950 UART as a specific example, so I 
would think the kernel is intended to support this functionality on the 
16C950. 
 
I have tried this across several kernel versions: 3.10 (Centos 7) , 4.18 
(Centos 8), and 5.11 (Ubuntu 21.04) with no change in the behavior. 
The issue was originally discovered on a PLX OXPCIe952 UART, but has been 
replicated on 'standard' OX16C950 UARTs as well. setserial -ag correctly 
identifies all cards as 16950's (Specifically "16950/954").

Has anyone else had or seen this IOCTL issue on the 16C950? Are there any 
'known good' 16C950 based cards people can confirm that this works with?

Let me know if you need any more details/testing. I also tried to 
configure my email client to behave nicely with the mailing list. Does it 
seem ok?

P.S, I also tried using 3rd party libraries that support the RS485 flags, 
such as 
https://pyserial.readthedocs.io/en/latest/pyserial_api.html#rs485-support, 
in case there was something broken in my C application, but I get the same 
error.

Thanks,
Matthew Howell
Applications Engineer
Sealevel Systems, Inc



On Thu, 21 Oct 2021, gregkh@linuxfoundation.org wrote:

> On Wed, Oct 20, 2021 at 08:44:54PM +0000, Matthew Howell wrote:
> > Confidentiality Notice This message is intended exclusively for the individual or entity to which it is addressed. This communication may contain information that is PROPRIETARY, TRADE SECRET, PRIVILEGED, CONFIDENTIAL or otherwise legally exempt from disclosure. If you are not the named addressee, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this message in error, please notify the sender immediately either by phone (864.843.4343) or reply to this e-mail and delete all copies of this message.
> 
> Now deleted.
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Possible issue with RS485 IOCTLs on 16C950 UARTs?
  2021-10-21 14:10   ` mrhowel
@ 2021-10-21 14:30     ` gregkh
  2021-10-21 17:37       ` mrhowel
  0 siblings, 1 reply; 5+ messages in thread
From: gregkh @ 2021-10-21 14:30 UTC (permalink / raw)
  To: mrhowel; +Cc: Matthew Howell, linux-serial, Ryan Wenglarz

On Thu, Oct 21, 2021 at 10:10:30AM -0400, mrhowel@g.clemson.edu wrote:
> 
> That noticed is enforced by our exchange server. I have removed it by 
> using an external email address instead.
> 
> Original message is copied below.
> 
> Hi,
> 
> I'm not sure if this is the right place for this, but hopefully someone 
> can help me figure out what else I can do to troubleshoot this problem, or 
> point me to the right place to ask questions about this.
> 
> A recent investigation led us to discover issues related to the RS485 
> IOCTLs on our serial cards utilizing the 16C950 UART. More specifically, 
> the TIOCSRS485 IOCTL to set the serial_rs485 flags as documented at 
> https://www.kernel.org/doc/html/latest/driver-api/serial/serial-rs485.html 
> .
> 
> When attempting to set the SER_RS485_ENABLED flag using TIOCSRS485 as per 
> below I receive an error code 25, "Inappropriate IOCTL for device"
> 
> 	/* -----RS485----- */
> 	struct serial_rs485 rs485conf = {0};
> 	rs485conf.flags |= SER_RS485_ENABLED;
> 	rc = ioctl(fd, TIOCSRS485, &rs485conf);
> 	if (rc < 0) {
>         	printf("error=%d %s\n", errno, strerror(errno));
> 		return rc;
> 	}
> 
> >From what I've read this typically indicates an unsupported serial device, 
> but the documentation mentions the 16C950 UART as a specific example, so I 
> would think the kernel is intended to support this functionality on the 
> 16C950. 
>  
> I have tried this across several kernel versions: 3.10 (Centos 7) , 4.18 
> (Centos 8), and 5.11 (Ubuntu 21.04) with no change in the behavior. 
> The issue was originally discovered on a PLX OXPCIe952 UART, but has been 
> replicated on 'standard' OX16C950 UARTs as well. setserial -ag correctly 
> identifies all cards as 16950's (Specifically "16950/954").
> 
> Has anyone else had or seen this IOCTL issue on the 16C950? Are there any 
> 'known good' 16C950 based cards people can confirm that this works with?

I do not think that that type of hardware actually supports RS485, as the
kernel is reporting that the driver says it is not allowed.

Perhaps you need to find some hardware that does support it?  It is not
very common at all.

good luck!

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Possible issue with RS485 IOCTLs on 16C950 UARTs?
  2021-10-21 14:30     ` gregkh
@ 2021-10-21 17:37       ` mrhowel
  0 siblings, 0 replies; 5+ messages in thread
From: mrhowel @ 2021-10-21 17:37 UTC (permalink / raw)
  To: gregkh; +Cc: mrhowel, Matthew Howell, linux-serial, Ryan Wenglarz


On Thu, 21 Oct 2021, gregkh@linuxfoundation.org wrote:

> On Thu, Oct 21, 2021 at 10:10:30AM -0400, mrhowel@g.clemson.edu wrote:
> > 
> > That noticed is enforced by our exchange server. I have removed it by 
> > using an external email address instead.
> > 
> > Original message is copied below.
> > 
> > Hi,
> > 
> > I'm not sure if this is the right place for this, but hopefully someone 
> > can help me figure out what else I can do to troubleshoot this problem, or 
> > point me to the right place to ask questions about this.
> > 
> > A recent investigation led us to discover issues related to the RS485 
> > IOCTLs on our serial cards utilizing the 16C950 UART. More specifically, 
> > the TIOCSRS485 IOCTL to set the serial_rs485 flags as documented at 
> > https://www.kernel.org/doc/html/latest/driver-api/serial/serial-rs485.html 
> > .
> > 
> > When attempting to set the SER_RS485_ENABLED flag using TIOCSRS485 as per 
> > below I receive an error code 25, "Inappropriate IOCTL for device"
> > 
> > 	/* -----RS485----- */
> > 	struct serial_rs485 rs485conf = {0};
> > 	rs485conf.flags |= SER_RS485_ENABLED;
> > 	rc = ioctl(fd, TIOCSRS485, &rs485conf);
> > 	if (rc < 0) {
> >         	printf("error=%d %s\n", errno, strerror(errno));
> > 		return rc;
> > 	}
> > 
> > >From what I've read this typically indicates an unsupported serial device, 
> > but the documentation mentions the 16C950 UART as a specific example, so I 
> > would think the kernel is intended to support this functionality on the 
> > 16C950. 
> >  
> > I have tried this across several kernel versions: 3.10 (Centos 7) , 4.18 
> > (Centos 8), and 5.11 (Ubuntu 21.04) with no change in the behavior. 
> > The issue was originally discovered on a PLX OXPCIe952 UART, but has been 
> > replicated on 'standard' OX16C950 UARTs as well. setserial -ag correctly 
> > identifies all cards as 16950's (Specifically "16950/954").
> > 
> > Has anyone else had or seen this IOCTL issue on the 16C950? Are there any 
> > 'known good' 16C950 based cards people can confirm that this works with?
> 
> I do not think that that type of hardware actually supports RS485, as the
> kernel is reporting that the driver says it is not allowed.
>
> Perhaps you need to find some hardware that does support it?  It is not
> very common at all.

I know support for serial_rs485 is not very common, but the documentation 
for serial_rs485 explicitly mentions the 16C950 UART, which is the UART 
used by the serial card under test.

The datasheet for the 16C950 indeed does not mention "RS485 Auto-Enable", 
but it does say that the DTR pin may be programmed to automatically turn 
the transmitter on and off. See "485_EN" on Page 10 and "ACR[4:3]: DTR# 
line configuration" on page 36 of the manual. 
(https://www.semiconductorstore.com/pdf/newsite/oxford/ox16c950b.pdf)

It doesn't use the same terminology, but it is my understanding that the 
functionality of these registers is sufficient for the 16C950 to support 
RS485 Auto-Enable.

Additionally, the Windows driver for this card supports RS485 Auto-Enable.
 
> good luck!
> 
> greg k-h
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-21 17:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 20:44 Possible issue with RS485 IOCTLs on 16C950 UARTs? Matthew Howell
2021-10-21  7:56 ` gregkh
2021-10-21 14:10   ` mrhowel
2021-10-21 14:30     ` gregkh
2021-10-21 17:37       ` mrhowel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.