Friday, January 26, 2018

Beaglebone Black - UART

Beaglebone black has one UART connection pinout. It can be used for uart console communication or normal uart function.
The pinout is purely RX and TX, no CTS and RTS pin for hardware flow control. Typically usage for serial console as standard baud rate is 115200.

UART is simple protocol and simple connection, no clock, one direction.
Picture from wiki page.

To read from Beaglebone, a simple tap to TX pin is suffice.

I connect one probe from LA1002 to the Beaglebone black J1 connector.


Now for the KINGST software settings:


Back to Beaglebone console.
I am using the USB console, instead of uart console. The USB controller is loading USB-CDC driver to emulate USB port as serial port. It will appears as com port in window PC.

By using the USB serial, leave me one unused uart serial communication.

First, checking the device node.
root@beaglebone:~# dmesg | grep tty
[    0.000000] Kernel command line: console=ttyO0,115200n8 capemgr.disable_partno=BB-BONELT-HDMI capemgr.enable_partno=ADAFRUIT-SPI0 root=UUID=06dba3af-499e-44ca-a059-6ee71880bfd0 ro rootfstype=ext4 rootwait coherent_pool=1M quiet init=/lib/systemd/systemd cape_universal=enable
[    0.530794] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 72) is a OMAP UART0
[    0.542649] console [ttyO0] enabled

The uart device node is ttyO0.

Doing a simple echo to ttyO0.
echo 123 > /dev/ttyO0

From the KINGST VIS, I get this

Took me sometime to get it, after trying to change the KINGST VIS UART configuration.
0x31, 0x32, 0x33, 0x0A - is actually ASCII code. Refer to: http://www.asciitable.com/
Char                HEX
1                      0x31
2                      0x32
3                      0x33
new line          0x0A

haha, I send a normal "hello world"

too bad, the KINGST VIS doesnt have ASCII decoder function.

TO BE CONTINUE ...

I have one Adafruit uart to usb converter. It is pin compatible with Beaglebone Black.
I like module, so easy to use.

Open up one of my favourite terminal software - termite.
Then from Putty console - cat /dev/ttyO0
Testing ... (from PC to Beaglebone)


Testing ... (from Beaglebone to PC)


Will update more if anything interesting come out.

Wednesday, January 24, 2018

Beaglebone Black I2C Verifying

My Beaglebone black, laying there for months. I wass caught up with work load, the work stress and I wanted a complete blank mind at home.

I was indulging myself in novel and movie. Completely waste of time without making any progress in my self-achievement.

Previously, I promised myself to write one blog per month. I want to try something new, explore new feature, experience that little achievement when proof of concept is working. But I was utterly wasted all the time on movies, make no progress in work, didnt make effort to step out of that vicious cycle.

Cut long story short.
Now I have some time, I want to continue exploring Beaglebone Black.

Most simple one is always the I2C communication.

I have my favourite logic analyzer LA1002, just updated the KINGST VIS to version 2.1. (Cant be sure what is the new features).

This is the settings I have set at the KINGST VIS.

Now to the pinout for I2C. P9 - pin 19 and pin 20.

Picture from BeagleBoard.org

Taking out my elongated header pin, I connect the LA1002 and pin 19 & pin 20.


For the test app, I use the famous i2c-tools.

for the device node, only 2 device nodes are available, I2C2 is mapped to /dev/i2c-1
bash command: ls /dev/i2c*
/dev/i2c-0  /dev/i2c-1

Run the command: i2cdetect -r 1

Let see the output at KINGST VIS side.
Signal is sent start from address 3:

Frequency is 100KHz:

Value is decoded, all NACK (expected as no slave device attached):

I2C is proven working, now is to find a slave device and write a user app for it.

TO BE CONTINUE ...
To the slave device testing.
I have one Adafruit BME280 module.


Use the i2cdetect to check the slave device and there it is, circled in red.

Now to google a test app. "Control Everything Community"
Providing free c code for BME280. Worth the promotion.
source code github link

You need to do little modification, change the slave device address.

Do the compilation: gcc -Wall -Wextra bme280.c -o bme280


Type this command to continue showing the data: "watch -n 1 ./bme280"

Now bring the thing to your mouth and continue blowing, you will see the reading changes.

TO BE CONTINUE