Logic Machine Forum
RS232 - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Hardware (https://forum.logicmachine.net/forumdisplay.php?fid=12)
+--- Thread: RS232 (/showthread.php?tid=6020)



RS232 - JMM - 11.06.2025

Hello, 
I have a client who has a Homelynk on their installation running with LM5 firmware. 
Everything works perfectly except the RS232 port which is not recognized. 
Do you have a solution for this?" 

BR


RE: RS232 - Daniel - 11.06.2025

How did you test it?


RE: RS232 - JMM - 11.06.2025

Code:
-- Fonction pour vérifier si le port est libre (sans lsof)
function isPortFree()
  local test_port = serial.open('/dev/RS232', {
    baudrate = 1200,
    databits = 7,
    stopbits = 1,
    parity = 'even',
    duplex = 'half'
  })
 
  if test_port then
    test_port:close()
    log("Port libre")
    return true
  else
    log("Port occupé ou inaccessible")
    return false
  end
end

isPortFree()


And error log :
test le port rs232 11.06.2025 10:45:53
User script:3: attempt to index global 'serial' (a nil value)
stack traceback:
User script:3: in function 'isPortFree'
User script:21: in main chunk


RE: RS232 - Daniel - 11.06.2025

Actually this is correct. Hw is not the same as LM and this will not work.


RE: RS232 - JMM - 11.06.2025

OK thank Daniel.


RE: RS232 - Erwin van der Zwart - 11.06.2025

I think it will work if you add on top -> require('serial')
Code:
require('serial')
port = serial.open('/dev/RS232', {
  baudrate = 38400,
  databits = 8,
  stopbits = 1,
  parity = 'none',
  duplex = 'full'
})



RE: RS232 - JMM - 11.06.2025

Hello,

Yes of course I just copied the function but require('serial') is present in the script