Serial communication on WAGO PFC 200

mirasoft
2017-12-22
2018-03-21
  • mirasoft - 2017-12-22

    Hi,

    I have just installed "CODESYS Control for PFC200". Before the update, I used CODESYS 2.3 to communicate with the serial port. Now i tried to port the working code to CODESYS 3.5, but without success. I'm using the internal serial port. Before the update, I had to use com port number 0. I tried port 0 - port 4 without success. Do I have to do any thing before?

    Code before:

    port         : SERIAL_INTERFACE := (bCOM_PORT_NR := 0, cbBAUDRATE := BAUD_9600, cpPARITY := PARITY_NO, csSTOPBITS := STOPBITS_1, cbsBYTESIZE := BS_8);
    
    ``````
    
    port(xOPEN_COM_PORT := xOpen, xSTART_SEND := xSend, utRECEIVE_BUFFER := receive, xInit := xInit, iBYTES_TO_SEND := length, ptSEND_BUFFER := ADR(buffer));
    

    New 3.5 code:

       portSettings   : SysCom.COM_Settings := ( sPort := 1, byStopBits := 1, byParity := COM_Parity.SYS_NOPARITY, ulBaudrate := COM_Baudrate.SYS_BR_9600, ulBufferSize := SIZEOF(buffer) );
       _   : SysCom._ := ( byByteSize := 8 );
       port         : RTS_IEC_HANDLE := SysCom.RTS_INVALID_HANDLE;
    
    ``````
    
          IF port = SysCom.RTS_INVALID_HANDLE THEN
             port := SysComOpen2(ADR(portSettings), ADR(_), ADR(result));
          END_IF
          
          SysComWrite(port, ADR(buffer), length, COM_Timeout.SYS_NOWAIT, ADR(result));
    

    I have also tried to modify CODESYSControl.cfg

    [SysCom]
    Linux.Devicefile=/dev/ttyO
    portnum := COM.SysCom.SYS_COMPORT1
    
     
  • eschwellinger

    eschwellinger - 2017-12-23

    Hi,
    modification in the CODESYScontrol.cfg ist not needed.
    Just leave it as it was.

    Linux.Devicefile=/dev/ttyO

    Did you change the Setting inthe WBM.

    In CODESYS you need to use com1 then.

    In the plcbrower you could switch between RS485/RS232
    serialmode rs232

    BR
    Edwin

    IMG: WBM.jpg

     
  • mirasoft - 2017-12-23

    Edwin Schwellinger hat geschrieben:
    In the plcbrower you could switch between RS485/RS232
    serialmode rs232
    BR
    Edwin

    Thank you Edwin. I forgot to switch the port to RS232. Now it works!

     
  • mirasoft - 2018-02-25

    Sorry for warming up this old topic, but the question fits:

    I try to change the described RS232 connection to the service interface. I need the serial interface for a RS485 connection.

    So I opened the WBM and set the owner of the service interface there to "Unassigned" and rebooted the device.

    Then I simply switched sPort to SYS_COMPORT2 and hoped that the communication works. Unfortunately without success.

    Which COM port number does the service interface have? Is there anything else to consider?

    Thank's for help

     
  • eschwellinger

    eschwellinger - 2018-02-25

    Hi,
    Com1...
    BR
    Edwin

     
  • mirasoft - 2018-02-25

    Edwin Schwellinger hat geschrieben:
    Hi,
    Com1...
    BR
    Edwin

    Hi Edwin,

    but COM1 is the seems to be the serial interface. Even after switching the service interface to unassigned.

    If the serial interface is COM1, what number does the service interface have?

    Can I use them at the same time?

    Regards

    Thomas

     
  • eschwellinger

    eschwellinger - 2018-02-25

    Hi Thomas,
    never done this with the sevice interface
    ... you need to remove the connection to the Wago Ethernet Settings tool (
    (which is set by default to connect with this interface)
    dmesg | grep -i tty
    hows on my PFC:
    dmesg | grep -i tty
    [ 0.540139] 4806c000.serial: ttyO1 at MMIO 0x4806c000 (irq = 89, base_baud = 3000000) is a OMAP UART1
    [ 0.541155] 49020000.serial: ttyO2 at MMIO 0x49020000 (irq = 90, base_baud = 3000000) is a OMAP UART2
    [ 0.543062] 4806a000.serial: ttyO0 at MMIO 0x4806a000 (irq = 88, base_baud = 3000000) is a OMAP UART0 HWIRQ
    so ttyO0 is the Com Port...
    Did you aready try Com2 and Com3 in CODESYS?
    BR
    Edwin

     
  • mirasoft - 2018-02-25

    Edwin Schwellinger hat geschrieben:
    ... you need to remove the connection to the Wago Ethernet Settings tool (
    (which is set by default to connect with this interface)
    Edwin

    I changed the owner of the service interface via Web Based Management front end.

    Edwin Schwellinger hat geschrieben:
    Did you aready try Com2 and Com3 in CODESYS?

    Yes both, COM2 and COM3. I am getting a handle, but without any functionality.

    Any other ideas?

     
  • mirasoft - 2018-02-25

    Do I have to change anything in CODESYSControl.cfg? It seems that only tty0 is addressed:

    [SysCom]
    Linux.Devicefile=/dev/ttyO
    portnum := COM.SysCom.SYS_COMPORT1
    
     
  • mirasoft - 2018-02-25

    Sorry. Just learned that the service interface is not an ordinary RS232 interface. I need a TTL level converter.

     
  • mirasoft - 2018-03-05

    Sorry, but unfortunately I still can not finish this topic.

    I bought a WAGO 750-650 card, built it in and added it to the project.

    Now I thought that I only need to change the COM port to COM2, COM3 or COM4. But unfortunately, no communication is measurable. The status light never flickers. CTS and RTS is bridged.

    [    0.540293] 4806c000.serial: ttyO1 at MMIO 0x4806c000 (irq = 89, base_baud = 3000000) is a OMAP UART1
    [    0.541308] 49020000.serial: ttyO2 at MMIO 0x49020000 (irq = 90, base_baud = 3000000) is a OMAP UART2
    [    0.543155] 4806a000.serial: ttyO0 at MMIO 0x4806a000 (irq = 88, base_baud = 3000000) is a OMAP UART0 HWIRQ
    [   22.681405] tty driver flags: 0x0000000d
    

    Thanks for any hint

     
  • eschwellinger

    eschwellinger - 2018-03-05

    Hi,
    at the moment we do not have a library for using these serial modules/slices.
    So using them is maybe possible but you need to implement the whole code in your application.
    Not sure if this possible without having a huge effort.

    The question is:
    How many Interfaces to you need and why not using the one with is proved to work (750-8204 for example) .
    BR
    Edwin

     
  • mirasoft - 2018-03-06

    Edwin Schwellinger hat geschrieben:
    Hi,
    at the moment we do not have a library for using these serial modules/slices.
    So using them is maybe possible but you need to implement the whole code in your application.
    Not sure if this possible without having a huge effort.
    The question is:
    How many Interfaces to you need and why not using the one with is proved to work (750-8204 for example) .
    BR
    Edwin

    Hi,
    that is a pity. I relied on the document Supported Modules.

    I need two serial interfaces. One RS232 and one RS485.

    Regards

    Thomas

     
  • eschwellinger

    eschwellinger - 2018-03-06

    Hi Thomas,

    I agree, the main problem is, we support to use them by using the process data. ( which means you need to do all in the application 'by hand') - which is probably a nightmare.
    But you expect them to use as serial com interface - open it with handle and so on...(but keep in mind - KBUS is in between)!
    Not sure if even Wago offers a device driver to use them.
    What are the connected serial devices which you need to use?

    BR
    Edwin

     
  • mirasoft - 2018-03-06

    Edwin Schwellinger hat geschrieben:
    What are the connected serial devices which you need to use?

    Some energy meters with Modbus RTU and Light controller with RS232

     
  • eschwellinger

    eschwellinger - 2018-03-13

    Hi Thomas,
    https://www.sps-forum.de/wago/91285-wag ... inden.html
    'Dann ist die Sub-D Schnittstelle COM0, die Service Schnittstelle COM1 und gesteckte serielle Module beginnen bei COM2.'
    Maybe I was wrong....
    So this could be a try to use them as com2 ...??
    Either you try this or you send us the module and we could do this...

    BR
    Edwin

     
  • eschwellinger

    eschwellinger - 2018-03-21

    Hi Thomas,

    no - this was wrong,
    it is really like we thought... !
    no Com Port available for the add on Serial modules!

    BR
    Edwin

     

Log in to post a comment.