2008-11-10 07:24:23     Read UART Registers

Document created by Aaronwu Employee on Aug 8, 2013
Version 1Show Document
  • View in full screen mode

2008-11-10 07:24:23     Read UART Registers

Samuel Ayet (SPAIN)

Message: 64924   

 

Hi all,

 

I want to read the Line Status Register of the UART1 (UART1_LSR) to see exactly when finish the transmision of the data (just reading the TEMT bit) and I don´t know how to read it. I have read that UART1_LSR is in the address 0xFFC02014. I have seen that all the SERIAL_REGISTERS are defined on the serial_reg.h on linux/include but i don´t know how to read it from my app.

 

Someone knows how to read the register?

 

Thak u!

 

Samuel

QuoteReplyEditDelete

 

 

2008-11-10 08:52:06     Re: Read UART Registers

Samuel Ayet (SPAIN)

Message: 64927   

 

Sorry, I miss some information maybe usefull for help me.

 

BF537 - STAMP Board running uClinux 2008R1.5-RC3

 

 

 

 

 

Thank you!

QuoteReplyEditDelete

 

 

2008-11-10 08:56:22     Re: Read UART Registers

Mike Frysinger (UNITED STATES)

Message: 64929   

 

are you using Linux ?  if so, there is already a UART driver.

QuoteReplyEditDelete

 

 

2008-11-10 09:31:31     Re: Read UART Registers

Samuel Ayet (SPAIN)

Message: 64937   

 

Yes, I´m using linux (uClinux of course). And how can I use the driver to know when the serial port finish the transmision?

 

To explain me better I need to put a high level on a GPIO when the serial port is transmitting data and when it finish the transmision I have to put a low level. Just I will poll the state of the serial TX buffer and put the level on the GPIO.

 

If i don´t need to read Supervisor Register, could you tell me how can I know when a serial transmision is finished using the Driver? Is there any funcition that returns the state of the TX buffer?

 

Thank you Mike!

QuoteReplyEditDelete

 

 

2008-11-10 09:52:33     Re: Read UART Registers

Mike Frysinger (UNITED STATES)

Message: 64939   

 

there is no way in userspace to monitor the state of the UART buffer.  the driver itself provides functions as to whether it has any bytes left to transmit.

 

what hardware are you talking to that you need to do this GPIO munging ?  is it a custom FPGA or a standard device ?

QuoteReplyEditDelete

 

 

2008-11-10 10:13:58     Re: Read UART Registers

Samuel Ayet (SPAIN)

Message: 64942   

 

O.K. I will use the driver support to know when the transmision finish. But, I don´t know exactly what is the function i have to use from the driver and how to use it. With the serial port I just manage it using a file descriptor, could you tell what function I have to use from the driver? How can I know how many bytes left to finish the serial port transmision?

 

I don´t know exactly what driver uses my board. I just compile the uClinux-dist enabling the UART1. I have surfed the uClinux-dist dir and i have find in drivers a folder called serla where i think it will be the driver, but i don´t know exactly what driver i use so I don´t know exactly the support that I have for the UART.

 

Also I have find in the docs.blackfin.uclinux site and I have no luck because the section 'using drivers' is comming soon... http://docs.blackfin.uclinux.org/doku.php?id=using_drivers

 

I have to talk with a RS-485 bus converter and I need to have a high level signal while i´m transmiting in the uart...it´s strange...I know...but here is like the bus converter we use works.

 

Reading some harware specifications in hardware manuals of the uart i noticed that the UARTs are logically compliant to EIA-232E, EIA-422, EIA-485 and LIN standards, but usually require external transceiver devices to meet electrical requirements (copied from the UART Hardware reference manual) and I think if I use the UART with EIA-485 compilant i won´t have to manage the GPIO when UART starts/finish the transmision.

 

 

 

Thank you again!!!

 

 

 

 

QuoteReplyEditDelete

 

 

2008-11-10 10:21:33     Re: Read UART Registers

Samuel Ayet (SPAIN)

Message: 64943   

 

I have found the driver (uClinux-dist/linux-2.6.x/drivers/serial/bfin_5xx.c) and in this driver there is a function called bfin_serial_tx_empty() that returns the valua of the TEMT that is exactly what I need. So, how can I use this driver in my application that will run on the blackfin?

 

Thank you Mike!

QuoteReplyEditDelete

 

 

2008-11-10 10:45:40     Re: Read UART Registers

Mike Frysinger (UNITED STATES)

Message: 64947   

 

if it's to talk to a RS485, then you'll need to modify the bfin_5xx.c driver yourself ... there is no other way currently

QuoteReplyEditDelete

 

 

2008-11-11 05:06:58     Re: Read UART Registers

Samuel Ayet (SPAIN)

Message: 65014   

 

I´m not talking directly to an a RS485 bus, I have a RS232 to RS485 Trsansciever that needs a high level in one input when I transmit to the transciever the RS232 comand that will be translated. I just need to have a output  high level signal from the blackfin when transmit from the UART, and this is read the TEMT bit (in the Line Status Register of the UART). As I can´t read supervisor register, in the driver there is a function called bfin_serial_tx_empty() and if I can use this function I don´t need to change anything of the driver ¿How can I use this driver function?

 

On the other hand, if I have to change the bfin_5xx.c driver, I will just put a high level in a GPIO when is called the bfin_serial_start_tx() and then put a low level when bfin_serial_stop_tx(), do you think it will solve my problem?

 

Thank you Mike!

QuoteReplyEditDelete

 

 

2008-11-11 05:18:57     Re: Read UART Registers

Mike Frysinger (UNITED STATES)

Message: 65015   

 

currently you must modify the bfin_5xx.c driver directly yourself

 

QuoteReplyEditDelete

Attachments

    Outcomes