Serail ID of /dec/tttACM0 using io.openport



  • Hi,

    I've got an Arduino Uno connected to the USB1 port of my Neuron M203, which is identified as /dev/ttyACM0. How do I open a connection to this device with io.openport(). This function needs a string argument containing the communication parameters: 'serial:6:9600,8,N,1'. Does anyone know where I can find the correct serial ID ?

    edit

    I've connected an usb to serial adapter and then it works with serial ID 10 for /dev/ttyUSB0.
    My code is based on the custom serial protocol example:

    def := 'serial:10:9600,8,N,1';
    handle := io.openport(def);
    
    IF handle >= 0 THEN
       state := 1;
    END_IF;
    

    handle is of type: io.commhandle which is an int. Whether or not io.openport works, it seems that the value of handle is always 0, so testing it makes no sense ?

    Thanks,
    Steve


  • administrators

    Hello @steve-vandenbussche,
    the serial ID for dynamic ports starts with 100.

    The return value of io.openport() is indeed type io.commhandle and you should be able to get the information whether the port has been opened or not. I will investigate the actual functionality as this looks like it's broken.

    Martin