On the BeagleBone Black I’m using UART4 for my application.
When I check the UART4 TxD output with the Oscilloscope I’m getting confusing results. Maybe I’m sending the data over UART wrongly, hopefully somebody can help me.
At the beginning I do: stty -F /dev/ttyO4 raw
afterwards I expect the logic to be standard. With 1 HIGH and 0 LOW
But when I do it on BBB for 1 (HIGH) i get
root@beaglebone:~# echo 1 > /dev/ttyO4
root@beaglebone:~# echo 0 > /dev/ttyO4
root@beaglebone:~# echo 110 > /dev/ttyO4
root@beaglebone:~# echo 010 > /dev/ttyO4
root@beaglebone:~# echo 11111111 > /dev/ttyO4
Is it possible to have a normal digital logic as the output of UART? If yes, how to do so.
Thanks you for the help on this, was really helpful.
But do you know how can I send the binary instead of ascii? (Do I need to put maybe prefix of SB before the value to send binary?)
After many unsuccessful attempts of sending binary over UART, I’m looking at possibility to change the UART MODE described in TI AM335x ARM A8 Microprocessors technical reference manual , maybe this will allow me to send the binary then.
For my project, the transceiver that I wan to connect to UART needs CMOS/TTL logic.
I’m really not sure this question at all. UART4 Tx a single wire which is high by default. Put a multimeter on the uart4tx pin to confirm this. If you send data to it then it goes out in blocks of N bits (N normally being 10 - start bit, 8 data bits, stop bit), then returns to the default state of high until the next transmission. http://en.wikipedia.org/wiki/Asynchronous_start-stop
Do you want to send binary data bit-by-bit, as in: write 1 to it, the pin goes high, write 0 and the pin goes low? Then that’s not what a UART does - sounds like GPIO to me.
Do you want to send the byte 0, as in: start bit, 8 x low bits, stop bit? Then “echo -n \x00 > /dev/ttyO4” should do it. But much easier to do this in C (or any other language) as the ttyO4 is just a file: open it, set it up as a TTY (in C with functions tcsetattr, cfmakeraw etc), then write the zero byte to the stream.
It’s the shell causing your problems, not the UART. First, it should be
“echo -n \x00 > /dev/ttyO4”
Two backslashes (my error, sorry). Second, “man echo” and take a look at the syntax, you can’t just do “\xNNNNNNNNN”. To repeat, you should really write some software to do this rather than doing it from the shell.
Yes, I know I need to write a software, I initially wanted to check the method of sending the data over the UART on shell and then write the software to do the same thing.
I suppose it’s not the best way to include the: system (“echo … > /dev/ttyO4”), call in the software, as it’s the shell that causes the problems for me.
Can you maybe suggest the best way how I should address the UART in my software, I haven’t seen any examples for the UART programming using c/c++ on beaglebone online.