Re: Single UART handling multiple devices.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, 2009-08-14 at 07:31 -0700, srinivasramana wrote:
> Hi Greg/Kris,
> 
> >>  you _can't_ multidrop with RS232
> Thats correct. I am not attempting to multidrop RS232. I have a micro
> controller handling all my devices and that micon connects to the host over
> UART. Basically, my need is to make each of those devices connected to micon
> appear in linux as serial devices so that I can make use of my existing
> applications.(also wide range of applications available for serial devices).
> 
> So, i have been looking into the multiport serial card drivers. I understood
> that the tty driver can create the multiple nodes required. I couldn't find
> yet how to connect my tty driver to the UART driver. As per my UART driver
> understanding, it happens in uart_add_one_port(). But how do I do that when
> I am working top to down(tty to uart)?
> Also, since i have single physical UART port, i believe interrupt handling
> is just like normal serial driver. please correct me if this is wrong.
> 
> Suppose I have 4 nodes and applications are waiting on all these 4 nodes for
> read, when i do tty_flip_buffer_push() in my Rx ISR, which app thread gets
> unblocked and get the data?
> 
> Thanks & Regards,
> -- Srinivas R
> 
> 
> Microbit_Ubuntu wrote:
> > 
> > Hi Greg,
> > 
> > On Thu, 2009-08-13 at 20:41 -0400, Greg Freemyer wrote:
> >> On Thu, Aug 13, 2009 at 3:52 PM,
> >> srinivasramana<srinivas.ramana@xxxxxxxxx> wrote:
> >> >
> >> > Hi All,
> >> >
> >> > I have been working on the feasibility of having multiple device
> >> > nodes(serial type device) for a single device so that applications can
> >> treat
> >> > each of these device nodes as separate devices.
> >> >
> >> > 1. Can i write a tty driver which creates multiple nodes(i will set
> >> minors
> >> > to the number of nodes i need)
> >> > 2. Now, If I write from user space on any of these nodes i have seen
> >> that it
> >> > comes to the tty drivers write call.
> >> > 3. I want to know how do i link my physical driver with this tty
> >> driver?
> >> > 4. If mutiple applications are waiting on read on different nodes, how
> >> do i
> >> > wake up a particular read based on the incoming data from hardware(on
> >> Rx
> >> > interrupt)?
> >> >
> >> > please help.
> >> >
> >> > Thanks & Regards,
> >> > -- Srinivas R
> >> >
> >> >
> >> >
> >> > srinivasramana wrote:
> >> >>
> >> >> Hi,
> >> >>
> >> >> Thanks for the response. I have explored the option of FIFOs, but the
> >> >> issue is I need Full duplex support from the devices. In that case I
> >> will
> >> >> have to use two FIFOs for each device. So, it would be good to know if
> >> >> there is any better option.
> >> >>
> >> >> Also, I was thinking of multiple virtual device nodes with single
> >> UART.
> >> >> But, I want to know how do I have these layers communicate? multiple
> >> >> virtual ttys with single UART work?
> >> >> Please suggest.
> >> >>
> >> >> Thanks & Regards,
> >> >> -- Srinivas R
> >> >>
> >> >>
> >> >> matthias-44 wrote:
> >> >>>
> >> >>> Hi,
> >> >>>
> >> >>> Why you don't put everything in user space. So you just need the
> >> >>> driver to communicate with your UART port.
> >> >>> Use pipes for communication between your applications and the
> >> >>> UART-controller-application in user space.
> >> >>>
> >> >>> regards,
> >> >>> Matthias
> >> >>>
> >> >>> 2009/7/19 srinivas ramana <srinivas.ramana@xxxxxxxxx>:
> >> >>>> Hi All,
> >> >>>>
> >> >>>> I have a UART port on my device. A micro controller which drives
> >> >>>> multiple
> >> >>>> other devices is connected to this UART port.
> >> >>>> I need all those devices, connected to micro controller, to be
> >> visible
> >> >>>> to
> >> >>>> Linux applications as separate UART devices/ports.
> >> >>>>
> >> >>>> What is the best way to do this? What all driver layers i need to
> >> >>>> add/modify. Please help.
> >> >>>> Thanks in advance.
> >> >>>>
> >> >>>> Note: assume there is a protocol between micro controller & Linux to
> >> >>>> understand which device is requesting service.
> >> >>>>
> >> >>>> Thanks & Regards,
> >> >>>> -- Srinivas R
> >> 
> >> I'm going to ignore the electrical aspect of multidrop rs-232, but I
> >> really don't think that works at all.
> >> 
> >> Assuming you have somehow overcome that major hurdle, I don't
> >> understand your problem.
> >> 
> >> You start with a standard multi-port uart serial driver.  Then modify
> >> it such that when data comes in your driver decodes the protocol to
> >> get the address/routing info and delivers the data payload to
> >> appropriate device (/dev/ttyx) as if it were a multi-port device.
> >> 
> >> On write, your driver gets data from userspace (/dev/ttyx) and wraps
> >> the comm protocol around it and sends it on its way.
> >> 
> >> >From a software perspective none of this unusual, strange, or weird in
> >> any way.
> >> 
> >> If you think about a 8-port serial card, it works exactly as you
> >> describe.  A single hardware driver gets the incoming data from the
> >> card, decodes the cards signaling protocol and delivers the data to
> >> the correct device (/dev/ttyx).   And on write, it uses the cards
> >> signalling protocol to tell it which port to send the data out.  The
> >> only difference is a hardware card uses hardware registers to control
> >> the routing, where as you have it embedded in the data stream.
> >> 
> >> Note: TCP/IP also embeds the routing info in the data stream  (ie. the
> >> port).  It is a totally standard thing to do.
> >> 
> >> Greg
> >> -- 
> >> Greg Freemyer
> >> Head of EDD Tape Extraction and Processing team
> >> Litigation Triage Solutions Specialist
> >> http://www.linkedin.com/in/gregfreemyer
> >> Preservation and Forensic processing of Exchange Repositories White Paper
> >> -
> >> <http://www.norcrossgroup.com/forms/whitepapers/tng_whitepaper_fpe.html>
> >> 
> >> The Norcross Group
> >> The Intersection of Evidence & Technology
> >> http://www.norcrossgroup.com
> >> 
> >> --
> >> To unsubscribe from this list: send an email with
> >> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> >> Please read the FAQ at http://kernelnewbies.org/FAQ
> >> 
> > 
> > 
> >> I'm going to ignore the electrical aspect of multidrop rs-232, but I
> >> really don't think that works at all.
> > 
> > That's correct, you _can't_ multidrop with RS232 - electrically that is.
> > (So even stuffing of routing/steering or transport data would be totally
> > pointless)
> > You could multiplex perhaps, but that's not multidrop, of course.
> > Even RS422 by standard is 1 transmitter and multiple receivers, so for a
> > network
> > you need to make one big loop node-to-node and return to the Master.
> > You'd need at least RS485.
> > 
> > 
> > -- 
> > Best regards,
> > Kris
> > 
> > 
> > 
> > --
> > To unsubscribe from this list: send an email with
> > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> > Please read the FAQ at http://kernelnewbies.org/FAQ
> > 
> > 
> > 
> 

Sorry I didn't get back to your question yet !
I see Greg's helped you in the interim, which is great because I'm a kernel newbie
in any case.
I've got many years of embedded & mixed signal (RF/HW/SW) behind me, while I mainly
specialised in very low power but high performance custom ISM products with my consulting
business. So, if it's RF and the likes or OS-less firmware I can help, but Linux I'm still getting
my feet wet.
Well, that's off my chest in the meantime. Now on with (embedded) Linux studying/playing :-)

Good luck.

-- 
Best regards,
Kris



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux