weinzierl-engineering / baos

BAOS SDK - http://weinzierl-engineering.github.io/baos
MIT License
40 stars 18 forks source link

serial I/O error #11

Closed Keele520 closed 2 years ago

Keele520 commented 4 years ago

Hi, i'm using raspberry pi 3 b+ with kberry module. Following the user guide document but get the error below. Need help or advise...thanks.

14:02:08:274 [] Console Logger Started 14:02:08:297 [kdrive.connector.Connector] Open failed: I/O error: short write on serial port: 0 of 4 bytes 14:02:08:398 [BaosSerial] I/O error: short write on serial port: 0 of 4 bytes

weinzierl-engineering commented 4 years ago

Hi Keele520,

first, you should check if your setup is working properly.

Check serial connection

To do that disconnect or power down the KNX connection of the kBerry, so that the power LED turns off. Go to the console of your raspberry PI and execute:

od -x  < /dev/ttyAMA0

Then while this command is running, reconnect the KNX Bus, and check if the power LED on the device turns back on. Now you should see something similar to this:

0000000 c010 16c0 c010 16c0 c010 16c0 0b68 680b
0000020 f0f3 00c2 000a 0001 010a bb00 6816 0b0b
0000040 f368 c2f0 0a00 0100 0a00 0001 16bb 0b68
0000060 680b f0f3 00c2 000a 0001 010a bb00 6816
0000100 0b0b f368 c2f0 0a00 0100 0a00 0001 16bb
0000120 0b68 680b f0d3 00c2 000a 0001 010a 9c01
0000140 6816 0b0b d368 c2f0 0a00 0100 0a00 0101
0000160 169c 0b68 680b f0d3 00c2 000a 0001 010a
0000200 9c01 6816 0b0b d368 c2f0 0a00 0100 0a00

in the console. If not check your wiring, KNX connection, KNX power, /boot/config.txt, /boot/cmdline.txt etc. If it worked Ctrl+C to stop the od command.

Compile the BaosSerial.cpp sample with DEBUG output

Add the line Poco::Logger::root().setLevel("debug"); after INIT_ROOT_CONSOLE_LOGGER(); and recompile. Then copy the modified sample to the device( if you cross compiled)

Run it and check the output. If you still having issues, please post the output of that run here.

Keele520 commented 4 years ago

od -x < /dev/ttyAMA0 will get "0000000" only.

Compile the BaosSerial.cpp sample with DEBUG output, get output below: pi@raspberrypi:~/baos/build_unix $ bin/sample_BaosSerial 12:08:04:771 [] Console Logger Started 12:08:04:773 [kdrive.io.serial.SerialPort] Opening serial port /dev/ttyAMA0, speed 19200, parameters 8E1, flow control none 12:08:04:774 [kdrive.io.serial.SerialPort] Sending 4 byte(s) 0000 10 40 40 16 .@@. 12:08:04:794 [kdrive.io.serial.SerialPort] Closing serial port 12:08:04:794 [kdrive.connector.Connector] Open failed: I/O error: short write on serial port: 0 of 4 bytes 12:08:04:895 [BaosSerial] I/O error: short write on serial port: 0 of 4 bytes

weinzierl-engineering commented 4 years ago

The od command is a test if the device is at all reachable. Did you check your whole setup? The configuration of the uart etc. . There is no use running any sample as long as the device is not properly configured in linux. Its hard to tell what on your setup is not working properly. Please make sure that the kBerry is connected and also make sure that you followed every step in https://github.com/weinzierl-engineering/baos/blob/master/docs/Raspbian.adoc (kBerry preperation section). Only if the od command during boot up of the kberry works properly the BAOS SDK can be used to communicate with the device.

Keele520 commented 2 years ago

Ooups...sorry for late update, this issue is solve by manually enable serial port on raspi-config rather then "sudo sed –ie "s/enable_uart=0/enable_uart=1/g" /boot/config.txt".