cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Participant
Participant
6,801 Views
Registered: ‎11-09-2015

handling serial port interupts with Linux

Hello All -

 

My system incorporates 7 serial ports on a custom board with the Zynq-7000.  Two of the ports are two-wire RS485 and the processor has been given the control of the TX Enable lines to those two ports (using the N16550a IP core.)  The problem I am having is that there appears to be data in the serial port internal FIFO when the write returns to Linux, so if I drop the TX line at that point, I am truncating the outgoing data.  I've made it work, but simply waiting a few milliseconds (timing calculated by determining baud rate, number of bytes sent, ect.)  Obviously this isn't the reliable way to do it.  I want to handle the TX buffer emtpy interuprt from the 16550 to determine when it is safe to drop the tx enable.  Can anyone provide some guidance on how to do this?  We are using Ubuntu on core 0.  I'm under a tight time constraint to get this working, so any help is greatly appreciated. 

 

Below is the device tree entry for one of the 485 links:

 

  serial@43cb0000 {
   clock-frequency = <0x5f5e100>;
   clock-names = "ref_clk";
   clocks = <0x1 0x0>;
   compatible = "xlnx,xps-uart16550-2.00.a", "ns16550a";
   current-speed = <0x1c200>;
   device_type = "serial";
   interrupt-parent = <0x3>;
   interrupts = <0x0 0x20 0x4>;
   port-number = <0x5>;
   reg = <0x43cb0000 0x10000>;
   reg-offset = <0x1000>;
   reg-shift = <0x2>;
   xlnx,external-xin-clk-hz = <0x17d7840>;
   xlnx,external-xin-clk-hz-d = <0x19>;
   xlnx,has-external-rclk = <0x0>;
   xlnx,has-external-xin = <0x0>;
   xlnx,is-a-16550 = <0x1>;
   xlnx,s-axi-aclk-freq-hz-d = "100.0";
   xlnx,use-modem-ports = <0x1>;
   xlnx,use-user-ports = <0x1>;
  };

 

Thanks

 

 

0 Kudos
Reply
0 Replies