2009-05-15 09:47:51 Problem with transmitting the data through UART0?
ThangarJ P (INDIA)
Message: 74107
Dear All,
I am working with uClinux-dist-2008 R1.5.-RC3. BF527-ezkit.
i have enabled the UART1 for debug purpose and UART0 for some other purpose.
i have changed the baud rate of UART0 using the below APis
cfsetispeed(&newmodes, B19200);
cfsetospeed(&newmodes, B19200);
tcsetattr(fd, TCSADRAIN, &newmodes);
then the baud rate is set properly.
after that i sent some characters using the write api as like below
write(fd,buf,5)
but the sent data is not received correctly on the receiver side .
but i have done the same things on UART1(which is used for console purpose).
the sent data is received properly on the console window.
how can we solve the problem?
Please provide your suggestions.
Thanks.
QuoteReplyEditDelete
2009-05-15 13:38:36 Re: Problem with transmitting the data through UART0?
Mike Frysinger (UNITED STATES)
Message: 74115
are you sure the receiver is configured properly ? why dont you hook up your PC to UART0 temporarily and run the test again. you can telnet into the board to control it remotely.
QuoteReplyEditDelete
2009-05-16 00:18:38 Re: Problem with transmitting the data through UART0?
Frank Van Hooft (CANADA)
Message: 74124
I found this webpage handy when I was setting up the serial ports:
www.easysw.com/~mike/serial/serial.html#3_1
It contains some useful info for configuring baud rates, handshaking, etc.
Remember you can always loop back transmit to receive on the same port, using a jumper or cable, so, for example, you can transmit out uart1 & receive it into uart1. That can be handy for debugging.
You should also be aware that some systems will "autobaud" on their receive RS232 ports. They'll analyze the first couple of characters received to determine the baud rate. If you're sending data to such a system, the first couple of characters can sometimes appear like garbage, before the system locks on & receives everything else normally. If you're only sending a few characters that can be an issue.
QuoteReplyEditDelete
2009-05-17 08:02:35 Re: Problem with transmitting the data through UART0?
ThangarJ P (INDIA)
Message: 74160
Dear Mike and Frank,
The UART0 is connected with ttyBF0 and has the default baue rate 9600.
if we transmit the data through the UART0 the data is receiving properly on the receiver side.
but if we changed to some other baud rates using the below APIs ,the transmit data is not receiving properly on the receiver side.
cfsetispeed(&newmodes, B19200);
cfsetospeed(&newmodes, B19200);
tcsetattr(fd, TCSADRAIN, &newmodes);
i thing the baud rate configuration using the above APIs are not set properly.
Am i doing any mistake while configuring the baud rates?
please provide your suggestions.
And also i am facing an issue with read also.
i have opened the device with blocking mode.
The read API should wait until read the specified size in the read API.
But it wont come out even if i am sending some characters from the other side.
Please provide your suggestions.
Thanks.
QuoteReplyEditDelete
2009-05-18 02:41:00 Re: Problem with transmitting the data through UART0?
ThangarJ P (INDIA)
Message: 74171
Dear Mike and Frank,
Now i am succeeded with trasmit the data after changing the baud rates.The data receive on the oterside is proper.
I have followed the link which you have sent.
But i couldn't succeeded with read .
The device opened in blocking mode.
The read is keep on blocking even if i sent the data from other side also.
Am i need to set any input,output or control flags in the termios structure through tcsetattr( ) this API?
Please provide your suggestions.
Thanks.
QuoteReplyEditDelete
2009-05-18 03:02:06 Re: Problem with transmitting the data through UART0?
Mike Frysinger (UNITED STATES)
Message: 74175
put UART0 into PIO mode and then watch /proc/interrupts to make sure the Blackfin proc is even receiving the data
QuoteReplyEditDelete
2009-05-18 04:13:01 Re: Problem with transmitting the data through UART0?
ThangarJ P (INDIA)
Message: 74179
Dear Mike,
Ya..its getting the interrupt.
Please find the below
root:/> cat /proc/interrupts
6: 231701 BFIN Timer Tick
13: 7840 PPI ERROR
16: 0 SPORT err
25: 0 SPORT RX Data
26: 0 SPORT TX Data
27: 28 i2c-bfin-twi
29: 10 BFIN_UART_RX------>This is ttyBF0 Receiving interrupt
30: 4 BFIN_UART_TX
31: 108 BFIN_UART_RX
32: 1639 BFIN_UART_TX
35: 1829 EMAC_RX
59: 1 musb_hdrc.0
62: 0 musb_hdrc.0
Err: 0
QuoteReplyEditDelete
2009-05-18 04:18:25 Re: Problem with transmitting the data through UART0?
Mike Frysinger (UNITED STATES)
Message: 74190
so enable debugging in the driver
also make sure you arent setting the termios to line buffered mode. read the termios man page for more info, or try sending newlines in your stream to see if they get sent up.
QuoteReplyEditDelete
2009-05-18 08:32:28 Re: Problem with transmitting the data through UART0?
ThangarJ P (INDIA)
Message: 74192
Dear Mike,
Thanks for your suggestion.
After disbling the line control flags i can able to read the data.
But if we read four or five characters ,some junk characters is apperaring at the end of the string.
could you please provide your suggestions regarding on that?
Thanks.