I need help. I'm using an LS425 player and I need to send the following command to an LG TV via serial port: 'ka 00 00\r'.
The idea is to send it from an internal module in Node.js, but first I have conducted tests from the presentation to send and receive serial commands. The presentation is made in BrightAuthor:Connected.
I have configured the port, in this case, port 0.
I have tried sending and receiving the message, but nothing happens.
When trying to send from the presentation, the logs show the following, but nothing is actually sent.
I am testing by connecting the player to the PC to send a command and change the state, but it does not receive it either.
Do I need to activate anything else within the player?
8 comments
-
Bright Scripters It would be serial port 1 or 2.
-
Nasbid I have also tested with those ports, but when I configure one of those ports in the presentation and load it onto the player, I immediately start getting the following errors:
These errors do not happen with port 0. -
Bright Scripters The LS425 does not have a built-in serial port.
What peripheral are you using to add a serial port?
-
Nasbid ok, so those errors don't really mean anything for this case.
I am using the USB-C to Serial/USB cable from the BrightSign store.
It is connected to the TV to which I want to send the commands or to the PC for testing. -
Lee DYDOMITE Dydo Can you share the steps that you’re performing for the PC side of the test?
-
Nasbid Of course.
I connect the cable from the player to the PC.
Serial input:
I load a simple presentation to the player that receives a serial input to change to another state. I have tested on ports 0, 1, and 2, and the specified input is <*>. I have also tested with specific data, but now I am testing with any data to make the change.
I use Hercules software and connect to the USB serial port (COM4) on my pc. I open the port and send any command, but the player does not receive it.Serial output:
In the presentation I handle a UDP input and configure it in >Advanced >send >Send serial string.
In the same way, I tried port 0, 1, 2 and set the chain to send.
I created a simple module with Node.js to receive serial messages in COM4.
But when I send the UDP message, the player does not send anything.I don't know if I am missing something.
I have configured the ports with a baud rate: 9600 according to the TV specifications.
The images showing the presentation configuration are at the beginning of the post
I hope I've explained that clearly -
Bright Scripters Testing with Hercules is a good idea.
I’d start by sending outgoing messages, confirming they are received by at PC side.
Keep it simple. No plugins yet as serial port can be accessed by either BrightAuthor or plugin. Not both.
Also, Rx and Tx must be crossed-over (Null Modem).
Once you start seeing activity on the PC, you know your port settings are correct.
Baud rate 115200! -
Nasbid I have managed to establish communication with the XD1034 player.
The problem with the Ls425 model was the adapter I used.After validating the operation from a presentation, I am doing it from code with Node, in the documentation there is the following example project for using the serial port with the javascript APIs
https://github.com/brightsign/bs-node-serialport/tree/masterTaking that as an example, I have done it for my case, I have confirmed that it is taking the port path correctly:
Path: /dev/ttyS0But, when creating the port I get the following error:
Uncaught (in promise) TypeError: SerialPort is not a constructorSo I think it's a version issue, I'd like to know what I'm doing wrong.
I attach the code I am using, I hope you can help me, thank you.
const SerialPort = require('@serialport/stream');
const ReadlineParser = require('@serialport/parser-readline');
const BrightSignBinding = require('@brightsign/serialport');
const SerialPortListClass = require("@brightsign/serialportlist");
console.log("#################################################");
console.log('Node Version: ' + process.version);
async function main() {
const serialPortList = new SerialPortListClass();
const serialPorts = await serialPortList.getList();
if (serialPorts.length !== 2) {
console.error(`Found a total of ${serialPorts.length}. Expecting a total of 2 serial connections, 3.5mm serial cable sends to USB-A serial device.`);
}
if ("UART" == serialPorts[0]["fid"].substring(0,4)) {
serial35mmPath = serialPorts[0]["path"];
}
console.log(JSON.stringify(serialPorts));
SerialPort.Binding = BrightSignBinding;
console.log("Serial path: ",serial35mmPath);
let serialPort35mm = createSerialPort(serial35mmPath, "serialPort35mm");
// let countTx = 0;
// setTimeout(writeOut, 1000, serialPort35mm, countTx);
}
function createSerialPort(path, name) {
const options = {
baudRate: 9600, // Update to reflect the expected baud rate
dataBits: 8,
stopBits: 1,
parity: "none",
autoOpen: false,
}
port = new SerialPort(path, options);
let parser = port.pipe(new ReadlineParser());
port.open(function (err) {
if (err) {
return console.log(`Error opening port: ${err.message}`);
}
console.log(`connected to serial ${path}, isOpen: ${port.isOpen}`);
});
// Receiver
parser.on('data', function (data) {
console.log(`Received on ${path} parsed data: ${data}`);
});
// Open errors will be emitted as an error event
port.on('error', function (err) {
console.log(err);
console.log(`Error: ${err.message}`);
})
return port;
}
main();