Serial Communication - cannot set even parity

stlim
2022-06-01
2022-06-03
  • stlim - 2022-06-01

    Hello Edwin Schwellinger,

    I found problem in serial communication as below. I would be very appreciated if you can raise these problem on Jira.

    1. SysCom, 3.5.17.0, setting is as below.
      COM_RS232C.sPort:=SysCOM.SYS_COMPORT1;
      COM_RS232C.byParity:=SysCOM.SYS_EVENPARITY;
      COM_RS232C.byStopBits:=SysCOM.SYS_ONESTOPBIT;
      COM_RS232C.ulBaudrate:=SysCOM.SYS_BR_115200;
      COM_RS232C.ulBufferSize:=50;
      COM_RS232C.ulTimeout:=0;
      COM_RS232CEx.byByteSize:=8;
      When I sent data via SysCom.SysComWrite to PC, it read data normally with NOPARITY setting on PC but I read corrupted data with EVENPARITY setting.
    2. Problem in Serial Communication, 3.5.17.0, setting is as below
      eParameters : ARRAY [1..7] OF COM.PARAMETER := [
      (udiParameterId := COM.CAA_Parameter_Constants.udiPort, udiValue := 1),
      (udiParameterId := COM.CAA_Parameter_Constants.udiBaudrate, udiValue := 115200),
      (udiParameterId := COM.CAA_Parameter_Constants.udiParity, udiValue := COM.PARITY.EVEN),
      (udiParameterId := COM.CAA_Parameter_Constants.udiStopBits, udiValue := COM.STOPBIT.ONESTOPBIT),
      (udiParameterId := COM.CAA_Parameter_Constants.udiTimeout, udiValue := 0),
      (udiParameterId := COM.CAA_Parameter_Constants.udiByteSize, udiValue := 8),
      (udiParameterId := COM.CAA_Parameter_Constants.udiBinary, udiValue := 1) ];
      I generated error code 5004, when I executed the code below.
      comOpen(xExecute:= TRUE, usiListLength:= 7, pParameterList:= ADR(eParameters), hCom=> hCom);
     
  • stlim - 2022-06-03

    Problem solved!

    I found the solution.
    I changed the serial connection from GPIO to USB serial convertor on Raspberry pi it works.
    I added these in Raspberry

    sudo nano /etc/CODESYSControl.cfg
    [SysCom]
    Linux.Devicefile.2=/dev/ttyUSB0
    Linux.Devicefile.1=/dev/ttyS0

     
  • eschwellinger

    eschwellinger - 2022-06-03

    I would recommend to move this section to:
    sudo nano /etc/CODESYSControl_User.cfg
    otherwise it will not work after a runtime update

     

Log in to post a comment.