ajtwlsdlqp
Posts: 1
Joined: Tue Aug 02, 2016 6:33 am

Help Plz UART Comm with Java

Sun Feb 18, 2018 8:51 am

i want to do UART Rx Comm with Java

i linked
pi's Rx <---> Device Tx
pi's GND <-> Device GND
pi's 5V <----> Device 5V

and i try
this site ('http://pi4j.com/example/serial.html") and
this site ("https://eclipsesource.com/de/blogs/2012 ... -and-rxtx/")

result is same -> NonsuchPort

result Pi4J

************************************************************
************************************************************

<-- The Pi4J Project -->
Serial Communication Example

************************************************************
************************************************************

------------------------------
| PRESS CTRL-C TO EXIT |
------------------------------

-------------------------------------------------------------------
| Connecting to: /dev/ttyS0 (1200,8N1) {FC:NONE} |
| We are sending ASCII data on the serial port every 1 second. |
| Data received on serial port will be displayed below. |
-------------------------------------------------------------------
==>> SERIAL SETUP FAILED : Failed to SET terminal attributes for the serial port. (Error #5)


result RxTx

javax.comm.NoSuchPortException
at javax.comm.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:105)
at TwoWaySerialComm.connect(TwoWaySerialComm.java:13)
at TwoWaySerialComm.main(TwoWaySerialComm.java:82)

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
i want use pi's 8, 10 (GPIO 14, 15)

/dev/ttyAMA0

i search that pi3's case need turn off BLE so i turn off using

$sudo vi /boot/config.txt

add at last line
#bt disabled
dtoverlay=pi3-disable-bt

$sudo systemctl disable hciuart

$sudo reboot -h

$dmesg | grep Bluetooth
$ ~
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

plz help me.. i just want to Rx Function in pi3

os version is ubuntu mate
and i already try update and upgrade ..
thanks

Gaou
Posts: 1
Joined: Thu Mar 01, 2018 8:10 am

Re: Help Plz UART Comm with Java

Thu Mar 01, 2018 8:18 am

Hi,

I've had many problems using Pi4J in the past, UART wasn't stable etc...

Try using JSerialCom (http://fazecast.github.io/jSerialComm/), since then i have no problem using the pi3 serial port.

Dont forget you should hace these lines in the /boot/config.txt

enable_uart=1
dtoverlay=pi3-disable-bt (specific for Pi3)

And in the /boot/cmdline.txt, delete this

console=serial0,115200

Good luck

Gaou

Return to “Java”