I'm trying to write a small program in node.js to communicate over serial port. I'm using node.js for that with a sample code like that:
var SerialPort = require("serialport");
var serialPort = new SerialPort("/dev/ttyAMA0", {
baudrate: 9600
});
serialPort.on("open", function () {
console.log('open');
serialPort.on('data', function (data) {
console.log('data received: ' + data);
});
setInterval(function () {
serialPort.write(new Buffer('4', 'ascii'), function (err, results) {
console.log('err ' + err);
console.log('results ' + results);
});
}, 1000);
});
This is however not working at all after i disable the login shell over serial port serial port in raspi-config. After that i'm unable to send/recieve any data.
I connected pin 8 with pin 10 to create a self-loop and tried using minicom to send something over it with no success as well. I checked the /boot/config.txt and enable_uart is set to 1. I also checked the /boot/cmdline.txt and there are no entries with AMA0 port.
Can anybody provide me with a solution to this problem?
For anyone looking for solution - this did it for me and opened a serial port.
https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=159984&p=1039065#p1039065