Post by kazuhiro on Problems using MySql Library and SysProcessExecuteCommand2 together
CODESYS Forge
talk
(Post)
I use fbMsSQL_compact(FUN) of the MySQL Library to write data to the database. There is no problem when writing data using only fbMsSQL_compact(FUN). However, when I try to write data obtained using SysProcessExecuteCommand2 to the database using fbMsSQL_compact(FUN), an error message "Dest server on ip address:xxx.xxx.xxx.xxx and port:1433 is unreachable" appears and writing is not possible. From what I have researched, it seems that writing is not completed in one cycle of fbMsSQL_compact(FUN), and when SysProcessExecuteCommand2 is executed first in the second cycle, the work done in one cycle of fbMsSQL_compact(FUN) is reset. Could you please give me some advice?
Last updated: 2024-06-18
Post by xiaolo on Raspberry Pi 5
CODESYS Forge
talk
(Post)
Does Ver. 4.12 support Raspberry Pi 5? I have three issues. The first issue is that Codesys cannot detect the RPI 5 when I want to download the runtime. When assigning the IP Address manually then I can download the runtime. The second issue is that I cannot connect to the RPI to download a program. Sometimes the window pops up and it ask for the user credentials, but it is still not connecting. The third issue is that I cannot connect to an ESP32 configured as a Modbus Slave with a Raspberry Pi 4B. I can connect to the ESP32 via a Radzio! Modbus Master Simulator. I am also missing the function Write Holding Registers in the setup of the slave. Are this known issues and when it will be solved?
Last updated: 2024-07-12
Post by sigurdrb on Codesys and error messages, warnings exceptions etc.
CODESYS Forge
talk
(Post)
Hi, I tried some different libraries (CmpApp etc.) to find some global variables that I could read out as a variable in the codesys environment. Do any one of you know which libraries are best suited for this, and how I can read it out? My goal is to send messages, warnings etc. to the system that communicates to the PLC. Currently if something goes wrong I need to see the logfiles, or go online with the controller. I think I could save a lot of time if I could read the errors from our user interface that is connected to the PLC by TCP/IP.
Last updated: 2024-11-06
Post by gallusrrr on usb2can in Codeysy 3.5 Can Gateway
CODESYS Forge
talk
(Post)
Hallo und guten Morgen, Ich danke für die Rückmeldung. ich habe das oben geschriebene durchgeführt und auch festgestellt das mit die Commandos für die Can befehle noch fehlen. (Google angeschmissen und geschaut auch gefunden) sudo apt-get install can-utils (damit auch jemanden anders der Post hilft) Anschließend habe ich das CAN System komplett aufgebaut so das ich mit einen anderen CAN Adapter schauen konnte ob die Nachricht auch ankommt. die Nachricht kommt an :) danach habe ich follgende Ausgabe: pi@Codesys:~ $ sudo ip -s -d link show can0 3: can0: <noarp,up,lower_up,echo> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10 link/can promiscuity 0 allmulti 0 minmtu 0 maxmtu 0 can state ERROR-ACTIVE restart-ms 0 bitrate 250000 sample-point 0.875 tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1 brp 12 gs_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp_inc 1 clock 48000000 re-started bus-errors arbit-lost error-warn error-pass bus-off 0 0 0 0 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 parentbus usb parentdev 1-1.4:1.0 RX: bytes packets errors dropped missed mcast 3549 819 0 0 0 0 TX: bytes packets errors dropped carrier collsns 32 4 0 0 0 0</noarp,up,lower_up,echo> (Sorry habe kein Speicherplatz im Web um Bilder anzuzeigen..) man kan sehen das die Nachricht abgeht und auch 32 Byte Empfangen worden sind. Die nachricht ist auch am anderen CAN Adapter sichtbar gewesen. Wie bekomem ich den einrichteten Adapter in Codesys rein? das ich den Befehl sudo ip link set can0 up type can bitrate 500000 das ich die Einrichtungs des Can Adapters noch in die Rasperry Start rutine nehmen muss ist mir klar. Ich bedanke mich .
Last updated: 2024-01-18
Post by jari-koivuluoma on Problem trying Net Base Services 3.5.15.0 TCP connection
CODESYS Forge
talk
(Post)
I have a need to send messages between 2 PLCs and I cant use network variables (because of size limit) so I tried writing this simple test program. This seems to work fine. I can send messages back and forth when a first "Start server" and then "Connect client". See the attached image. However, if I disconnect the client by setting ClientConnect to false and try to re-connect then the TCP_Client just gives me TIMEOUT error. When I stop and start the server again, then Im able to reconnect. How is this supposed to work? Why reconnecting wont work. There is not other way of disconnecting the client than setting xEnable of the TCP_Client to false. This is just a testing program and I will try it on 2 seperate devices once this works. PROGRAM PLC_PRG VAR CONSTANT mySize : UDINT := 255; END_VAR VAR Server: NBS.TCP_Server; ServerIpStr: STRING := '127.0.0.1'; ServerIP: NBS.IP_ADDR; ServerPort: UINT := 50000; ServerConnection: NBS.TCP_Connection; Client: NBS.TCP_Client; ServerRead: NBS.TCP_Read; ServerWrite: NBS.TCP_Write; ServerSend: STRING(mySize); ServerReceive: STRING(mySize); ServerConnect: BOOL; bServerSend: BOOL; IP: NBS.INADDR; ConnectedClientIP: STRING; ClientPort: UINT := 50000; ClientIpStr: STRING := '192.168.1.49'; ClientIP: NBS.IP_ADDR; ClientRead: NBS.TCP_Read; ClientWrite: NBS.TCP_Write; ClientSend: STRING(mySize); ClientReceive: STRING(mySize); ClientConnect: BOOL; bClientSend: BOOL; Error: BOOL; Message: BOOL; END_VAR // Server ServerIP.sAddr := ServerIpStr; Server( ipAddr := ServerIP, uiPort := ServerPort ); ServerConnection( xEnable := Server.xEnable, hServer := Server.hServer, ); IP := ServerConnection.IPAddress; ConnectedClientIP := F_Concat7( BYTE_TO_STRING(IP.S_un_b.s_b1),'.', BYTE_TO_STRING(IP.S_un_b.s_b2),'.', BYTE_TO_STRING(IP.S_un_b.s_b3),'.', BYTE_TO_STRING(IP.S_un_b.s_b4)); ServerRead( xEnable := ServerConnection.xActive, hConnection := ServerConnection.hConnection, szSize := SIZEOF(ServerReceive), pData := ADR(ServerReceive) ); IF ServerRead.xReady AND ServerRead.szCount > 0 THEN Message := TRUE; END_IF IF ServerRead.eError > 0 THEN Error := TRUE; END_IF ServerWrite( xExecute := ServerConnection.xActive AND bServerSend, hConnection := ServerConnection.hConnection, szSize := LEN(ServerSend)+1, pData := ADR(ServerSend) ); IF ServerWrite.xDone THEN bServerSend := FALSE; END_IF IF ServerWrite.eError > 0 THEN Error := TRUE; END_IF // Client ClientIP.sAddr := ClientIpStr; Client( xEnable := ClientConnect, ipAddr := ClientIP, uiPort := ServerPort, udiTimeOut := 10000000 ); ClientRead( xEnable := Client.xActive, hConnection := Client.hConnection, szSize := SIZEOF(ClientReceive), pData := ADR(ClientReceive) ); IF ClientRead.xReady AND ClientRead.szCount > 0 THEN Message := TRUE; END_IF IF ClientRead.eError > 0 THEN Error := TRUE; END_IF ClientWrite( xExecute := Client.xActive AND bClientSend, hConnection := Client.hConnection, szSize := LEN(ClientSend)+1, pData := ADR(ClientSend) ); IF ClientWrite.xDone THEN bClientSend := FALSE; END_IF IF ClientWrite.eError > 0 THEN Error := TRUE; END_IF
Last updated: 2024-10-03
Post by forest on SM Drive license error
CODESYS Forge
talk
(Post)
Hi, when it comes about license, I used INVTmatic Studio, which uses Codesys, for programming INVT plc. I bought Codesys Modbus license, it was not expensive, and then realised that INVT didn't have License Manager option (greyed out in program) which is needed for using of Codesys License. I contacted support from INVT, but developers told me that option is still not available. So depending on environment for programming Codesys, you can or not use Modbus license. Good thing about this version of Modbus TCP it works both direction. I could send commands and receive feedbacks from drive. But communication stops after 30 mins. So I used simple version of ethernet modbus which is somewhere in INVT or Condesys library (I can check tomorrow) which works only one way. I could send cmd to drive, and control it, but didn't have any feedback, like some readings back in PLC. which is bad, but at least I could start it and it didn't fail after 30 mins.
Last updated: 2024-01-10
Post by chalk on No source code available
CODESYS Forge
talk
(Post)
Hello, This is my first time using Codesys, I am trying to add EtherNetIP communication to a Raspberry PI. I’ve added the EtherNetIP Adapter configured the network setting and added some modules to the pi but when I download the project it generates the following error: “There is no source code available for the object because it is in the compiled library ‘cip object, 4.5.1.0 (3s – smart software solution gmbh)’. Do you want to browse for the original library in order to display the source code? There are 2 errors in the log which are: SOURCEPOSITION App=[Application] area=3, offset=332760 EXCEPTION [Application] occurred: App=[Application], Task=[ENIPAdapterServiceTask] I can’t for the life of me work out how to get around this. I can’t find the source code anywhere or any information regarding this error. I’m using Codesys V3.5 SP19 Patch 3, the version of the Ethernet adapter is 4.5.1.0 and the version of the modules is 4.1.0.0. Any help on this will be greatly appreciated. Thanks
Last updated: 2024-02-02
Post by nizrahel on OpC UA server on Raspberry Pi 64 SL runtime
CODESYS Forge
talk
(Post)
Hi all! I'm working on an home project using a Raspberry Pi 3 device with Codesys for Raspberry Pi 64 SL runtime. I would like to create the HMI interface with Siemens WinCC Unified (or Advanced) configuring the Raspberry as OPC UA server. I tryed everything, but I didn't find the way to let the OPC UA connection works using UaExpert. I tryed to use anonymous connection, authenticated connection and the ip address instead of the server name in the path connection. There is no way to connect to the OPC UA server and I was asking myself if this feature is really supported for the runtime version used. Another strange thing I noted, is that is not possible to quickly create an OPC UA certificate in the Security Screen, as show in any tutorials. I have correctly created the Symbol Configuration enabling the OPC UA feature. I attach to this topic some printscreen of the actual configuration (sorry for the italian language interface, but I didn't find the way to switch to english). Thank you very much in advance for your support and advices!
Last updated: 2023-12-03
Post by vipul on Multicast udp
CODESYS Forge
talk
(Post)
Hi, Good afternoon can anybody help me with UDP Multicast code. I am not able to send or recieve data when code is dumped on linux device. Below is my code. Declaration: PROGRAM udp_multicast VAR oneTimeFlag :UINT :=0; state: INT:=0; driver: UDP.UDPDriver; //port : UDP.Port;//moved to GVL src_ipAddr_ud: UDINT; src_ipAddr_st:STRING := '192.168.127.155';//'192.168.1.155';//ipms ip address dst_ipAddr_ud:UDINT; group_ipAddr_st:STRING := '239.1.5.10'; //group_ipAddr_ud:UDINT; result: SysTypes.RTS_IEC_RESULT; //result of recieve function. bind: UDINT; //result of binding. resultCreate:SysTypes.RTS_IEC_RESULT;//result of port creation. timer:BLINK; temFlag :INT:= 0; post:INT :=0; checksumFunc:checksumXor; localStringBuf:STRING[500]; chksum:BYTE; dataBuffer:POINTER TO BYTE; checksumString:ARRAY[0..5] OF BYTE; recvSize:__XINT; errorCode:UDINT; joinGroupErrorCode:UDINT; END_VAR ************8 Implementation: IF oneTimeFlag <> 1 THEN oneTimeFlag:=1; resultCreate := driver.CreatePort(ADR(GVL.port)); src_ipAddr_ud := UDP.IPSTRING_TO_UDINT(sIPAddress:= src_ipAddr_st); GVL.group_ipAddr_ud := UDP.IPSTRING_TO_UDINT(sIpAddress:= group_ipAddr_st); GVL.port.IPAddress := src_ipAddr_ud; GVl.port.ReceivePort:= GVL.src_port;//port on which messages are expected. GVl.port.SendPort := GVL.dest_port; GVl.port.OperatingSystem := 0; //0- any system GVL.port.Socket :=3; //3- socket type is multicast bind := GVL.port.Bind(udiIPAddress:=src_ipAddr_ud,); GVl.port.JoinGroup(udiGroupAddress:= GVL.group_ipAddr_ud,udiInterfaceAddress:= src_ipAddr_ud,eLogCode=>joinGroupErrorCode); END_IF timer(ENABLE:=TRUE,TIMELOW:=T#100MS,TIMEHIGH:=T#100MS); IF timer.OUT = TRUE THEN GVL.port.Send(udiIPTo:=GVL.group_ipAddr_ud,GVL.dest_port,pbyData:=ADR(GVL.writeData),diDataSize:=SIZEOF(GVL.writeData)); ELSE SysMemSet(ADR(GVL.readData[0]),0,SIZEOF(GVL.readData)); result := GVl.port.Receive(ADR(GVL.readData),diDataSize:=SIZEOF(GVL.readData),udiIPFrom=>dst_ipAddr_ud,diRecvSize=>recvSize,eLogCode=>errorCode); SysMemMove(ADR(GVL.readDataBuf[0]),ADR(GVL.readData[0]),SIZEOF(GVL.readData)); END_IF post:=LEN(GVL.readDataBuf);
Last updated: 2024-01-14
Post by rabaggett on Reading Named Pipes in Linux Is there a better way?
CODESYS Forge
talk
(Post)
I have a Python program that will handle things in my application such as VISA over IP and Telnet control of instruments. I want the main control and HMI in Codesys. My problem is communication between the two. I have looked at several ways to accomplish this, and settled on having the Python program create two named pipes, one to send information to Codesys, and one for Codesys to send information to Python. The information would be packetized with \n for end of packet.. Seems simple. I think the named pipes method should work, but file reading in Codesys using the CAA file library starts to get difficult when the file is never ending, as in this case. Before I spend too much time making something that may be fundamentally flawed I want to ask. Is there a better way? Is there a way to read the file 'one line at a time' which might solve my never ending file problem? Thanks!
Last updated: 2024-05-09
Post by abinvest579 on TCP Client
CODESYS Forge
talk
(Post)
Hi All, I am using codesys based plc to read and control magna power DC supply over LXI protocol using SCPI command. To connect device required socket programming for that i am using Net base service library function block TCP_Client to establish connection over TCP/IP , TCP_Write to write SCPI commands and TCP_Read to read data from Magna power DC supply. I have attached screenshot for logic developed. I am able to connect and write commands to device but i not receiving any information from device. For writing Commands i also tried various end of line character like \n,<nl>, A, D, 10, 13, 0x0A, 0x0D but not received any status from device. For testing purpose i am using simple command '*IDN?' to read data. Also if tried to check on hercules software what data actually plc read, first it read correct data after that is read wrong data as see in screen shot. 'Hello World' was correct read and after that Codesys in replaced with 'Codesysorld' that is not correct way. Same issue also appeared for send data. Any one have face same issue how i can read data directly from device correctly and send data please suggest solution on this.</nl>
Last updated: 2024-07-01
Post by aliazzz on Unable to deploy Virtual Control SL on ARM64 (Raspberry Pi5)
CODESYS Forge
talk
(Post)
Hi, I have successfully deployed "Virtual Control SL" on a few x86/64 machines now. However, I'd now like to deploy this to a Raspberry Pi (ARM64). To do this I prepared the Raspberry Pi5 with the following prereq's; * Minimal PREEMPT Debian * Latest Bootfirmware * full SSH access via non-root account * Podman * RedHat Cockpit with CODESYS LicensServer plugin up and running However, I can't seem to resolve copying the correct (deploy) Images as they wont show up in the CODESYS IDE I have added CODESYS Virtual Control for Linux SL and the CODESYS LicenseServer for Linux SL via the CODESYS installer on my DevBox. I open CODESYS > Tools > Deploy Control SL Next I enter the SSH targets IP and Credentials and for my RPi5 and it shows "Connected". In the next tab, Deployment, the dropdown box only shows one (1) image, which also is the incorrect CPU architecture. Only Virtual Control AMDx64 shows up (!?) while I expect to see the ARM64 based images for both Edge and Control. Has someone encountered this too? I'd like to hear other people experiences with Virtual Control deployment on ARM based architecture. attachment 1: AMD64 based deployment pulldown menu (correct images) attachment 2: ARM64 based deployment pulldown menu (incorrect images) regards,
Last updated: 2024-07-28
Post by denkihitsuji on Content update through Data URI on Web Brower on Visualization Toolbox
CODESYS Forge
talk
(Post)
Objective: I want to dynamically update the content with strings and JPEG images received from a TCP/IP socket. For this purpose, I am exploring the possibility of utilizing the Web Browser feature of the Visualization toolbox. Example: In a standard web browser, entering data:text/plain;charset=utf-8;base64,SGVsbG8gc3RyYW5nZXI= in the URL window will display "Hello stranger" on the webpage. Issue: When attempting to use this method in the Web Browser of the Visualization toolbox, the content does not display as expected. Instead, it shows the error:'Navigation to the webpage was canceled.'. Request: I seek guidance on how to resolve this issue so that the Web Browser in the Visualization toolbox correctly interprets and displays the data URI content. Alternative Solution Welcomed: Or, if it is possible to directly use Codesys Structured Text (ST) variables within an HTML page, this approach would also meet my requirements. Thank you for your attention.
Last updated: 2024-07-30
Post by jeffg on ERROR: GetNetLinkSockAndInfoByMac(): could not open netlink socket: Too many open files
CODESYS Forge
talk
(Post)
I just installed codesys runtime on a raspberry pi Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz (Compute Module 4) I am running on Codesys control for raspberry pi 64 SL ver 4.13.0 and I keep getting a crash after about five to ten minutes. This program was running fine on a 32bit system with runtime 4.8 previously but they upgraded the panel PC cause it got smashed. Looking at the logs I see this error "ERROR: GetNetLinkSockAndInfoByMac(): could not open netlink socket: Too many open files" at the time of crash. I do have a UDP socket open for a serial to ethernet adapter and im wondering if maybe its opening a bunch of sockets and while receiving messages, Im not sending anything to the device only receiving. Below is the code used for the UDP VAR // Scale Comm fbPeerServer : NBS.UDP_Peer; ipAddress : NBS.IPv4Address; fbReceive : NBS.UDP_Receive; xPeerActiv : BOOL := TRUE; abyReceive : ARRAY [0..255] OF BYTE; sLastValidReceive : STRING(255); udiIndex : UDINT; END_VAR IF xPeerActiv AND NOT fbPeerServer.xBusy THEN ipAddress.SetInitialValue(ipAddress := gvlSettings.sIPAddres); fbPeerServer(xEnable := TRUE, itfIPAddress := ipAddress, uiPort := gvlSettings.uiPort); END_IF fbPeerServer(); fbReceive(xEnable := fbPeerServer.xBusy, itfPeer := fbPeerServer, pData := ADR(abyReceive), udiSize := SIZEOF(abyReceive)); IF fbReceive.udiCount > 0 THEN IF fbReceive.udiCount < SIZEOF(sLastValidReceive) THEN SysMem.SysMemCpy(pDest := ADR(sLastValidReceive), pSrc := ADR(abyReceive), udiCount := fbReceive.udiCount); // Set End of String sLastValidReceive[fbReceive.udiCount] := 0; END_IF END_IF If anyone as seen this I could really use some help figuring it out. I included the Log report
Last updated: 2024-09-19
Post by yannickasselin on MQTT QoS 1 & 2
CODESYS Forge
talk
(Post)
Hello, After some more tests, here is what I found out. It seems we have to increase the uiKeepAlive and tPingInterval parameters. If I increase the uiKeepAlive value to 60s and the tPingInterval to 30s, then if I disconnect the ethernet cable from Codesys and publish some messages to which Codesys subscribes to and then reconnect within 30s, I will get the messages. If I don't reconnect the cable within 30s (ping interval), the client goes in error with "ACKNOWLEDGE_TIMEOUT". When this happens, it will not automatically reconnect after reconnecting the cable. I have to disable and re-enable the client but I will not get the published messages. I need to do more tests because there are a lot of weird things happening when playing with the ping interval and the keep alive. It is not clear to me what does what. I even ended up not receiving messages anymore, even if I disabled and re-enabled the mqtt client. The client did not give any error. The only way I was able to get messages again was by modifying my client ID. After that, if I try to re-use one of the old client IDs, nothing works (publish, subscribe) and I get a TCP_INIT_ERROR and sometimes a TCP_READ_ERROR. I need more explanation/documentation about these weird behaviors. Maybe it is the way I use it, maybe it is related to the broker (I am using Mosquitto with default parameters). When using a Node-Red client, everything works perfectly. I am trying to achieve the same behavior with Codesys but it seems impossible so far.
Last updated: 2024-10-30
Post by scoob on ModbusFB - Slow Response Time
CODESYS Forge
talk
(Post)
Hello, I have been trying to use the ModbusFB functions so I can put some code into libraries, but it seems to be very slow for me. I have a Modbus device with 100ms registers. I previously setup 10 channels in the 'traditional' Modbus Slave with channels and mappings - and set a cyclic trigger at 100ms - this worked fine. I then tried the ModbusFB example, and setup reading the same 10 blocks of modbus addresses, copying the example and putting all of the requests into an array and triggering the requests sequentially. I timed how long the requests are taking to get round to each one, and it is around 1s 450ms. How do I speed this up to match the cyclic time? IF NOT(init) THEN init := TRUE; // Set the required IP address: ipAddress[0] := 192; ipAddress[1] := 168; ipAddress[2] := 1; ipAddress[3] := 10; // Pass the required IP address to the clinet FB: client_NetworkSwitch.aIPaddr := ipAddress; client_NetworkSwitch.udiLogOptions := (ModbusFB.LoggingOptions.ClientConnectDisconnect OR ModbusFB.LoggingOptions.ClientReceivedValidReplies); // Try to connect the client client_NetworkSwitch(xConnect:=TRUE); // Configure all the channels to read connecting them to the client: portStatus_Request(rClient := client_NetworkSwitch, uiStartItem := 4096, uiQuantity := 32, pData := ADR(portStatus), udiReplyTimeout := udiReplyTimeout); portSpeed_Request(rClient := client_NetworkSwitch, uiStartItem := 4352, uiQuantity := 32, pData := ADR(portSpeed)); flowControl_Request(rClient := client_NetworkSwitch, uiStartItem := 4608, uiQuantity := 32, pData := ADR(flowControl)); linkUpCounter_Request(rClient := client_NetworkSwitch, uiStartItem := 5888, uiQuantity := 32, pData := ADR(linkUpCounter)); txPacketCounter1_Request(rClient := client_NetworkSwitch, uiStartItem := 8192, uiQuantity := 100, pData := ADR(txPacketCounter1)); txPacketCounter2_Request(rClient := client_NetworkSwitch, uiStartItem := 8292, uiQuantity := 28, pData := ADR(txPacketCounter2)); rxPacketCounter1_Request(rClient := client_NetworkSwitch, uiStartItem := 8448, uiQuantity := 100, pData := ADR(rxPacketCounter1)); rxPacketCounter2_Request(rClient := client_NetworkSwitch, uiStartItem := 8548, uiQuantity := 28, pData := ADR(rxPacketCounter2)); txErrors_Request(rClient := client_NetworkSwitch, uiStartItem := 8704, uiQuantity := 64, pData := ADR(txErrors)); rxErrors_Request(rClient := client_NetworkSwitch, uiStartItem := 8960, uiQuantity := 64, pData := ADR(rxErrors)); // Trigger all client requests initially FOR clientRequestsCnt := 0 TO (SIZEOF(clientRequests)/SIZEOF(clientRequests[0]))-1 DO pClientRequest := clientRequests[clientRequestsCnt]; pClientRequest^.xExecute := TRUE; END_FOR // Prepare sequential trigger / control of client requests. clientRequestsCnt := 0; pClientRequest := clientRequests[clientRequestsCnt]; END_IF // Call the client to do request processing: client_NetworkSwitch(); // Now we trigger client request sequentially ... IF NOT pClientRequest^.xExecute AND NOT pClientRequest^.xDone AND run AND client_NetworkSwitch.xConnected THEN pClientRequest^.xExecute := TRUE; END_IF // .. and check result/error IF pClientRequest^.xExecute AND run AND client_NetworkSwitch.xConnected THEN IF pClientRequest^.xDone THEN // Prepare next trigger of client request (a rising edge of xExecute) pClientRequest^.xExecute := FALSE; IF clientRequestsCnt < SIZEOF(clientRequests)/SIZEOF(clientRequests[0])-1 THEN // next client request clientRequestsCnt := clientRequestsCnt + 1; ELSE clientRequestsIterationCounter := clientRequestsIterationCounter + 1; clientRequestsCnt := 0; END_IF pClientRequest := clientRequests[clientRequestsCnt]; END_IF END_IF I did try a semi-coded way using the IoDrvModbusTCP library, and setting the slave com settings, then 10 commands and 10 requests, then using a TP on xDone as a pause, before triggering another request - this is time the delay is around 120ms - so the device is fine with the speed, just something I am doing wrong in the ModbusFB method I am sure.
Last updated: 2024-04-26
Post by martinlithlith on Device User Logon and No device is responding.. Pi4b codesys 3.5 SP19 2 + (64-bit)
CODESYS Forge
talk
(Post)
Hi! Im slowly starting to loose it and i need som help! After a few night of reading up and testing i´m still stuck as a rock and you guys and girls are my last resort for this project. Basic facts; Win 11 Codesys 3.5 SP19 2 + (64-bit) Raspberry pi 4 model b 2 gb Raspian release 11 aarch64 What keeps me up late at night; Username and Password when trying to connect to device and device only beeing connectable for a few seconds. Some of the things I have tried; Username and passord; Credientials from the raspberry Administrator Administrator admin admin Admin Admin administrator administrator Usernames and passwords that I sometimes use (this was a longshot i know, but i was running out of ideas and energy). :) Epand filesystem, activating i2c, spi, 1-wire I can start the gateway and start the runtime. I cant install the edgearm64, arm64 runtime package eventhough I guess i should, i get code [ERROR] Error output: dpkg: error processing archive /tmp/codesysedge_edgearm64_4.8.0.0_arm64.deb (--install): [ERROR] Error output: package architecture (arm64) does not match system (armhf) [ERROR] Error output: Errors were encountered while processing: [ERROR] Error output: /tmp/codesysedge_edgearm64_4.8.0.0_arm64.deb code as a respons. I have tried to Reset Origin Device - no change. I have tried to remove the /etc/CODESYSControl_User.cfg [CmpUserMgr] but i could not find it and i was not sure if i should add it instead but i did not want to mess somthing up. I have tried to create a second gateway with the specific ip if the pi, that did not help. Could it be that i´m currently connected to the pi through WIFI? I can ping the pi and I can connect and control it through VNC. When i scan to select gateway target (scan edge gateway) i find 17-21 devices but can find the pi throug the mac adress. I started of trying to use the "CODESYS Control for Raspberry Pi SL" (I have a license sience earlier) as i read somewhere that this could be used on a Pi4 as well but now i´m trying with the MC SL, no changes, same problem. Right now - gateway version 4.8.0.0 (edgearmHF, armhf), Runtime Package 4.5.0.0 (raspberry, armhf). Any sugestions are very welcome! As mentioned above, theese are some of the things that i have tried/done - but i have been going at this for a while. Best, Martin
Last updated: 2023-09-10
Post by ppix on Establishing TLS Connection with MQTT Broker using MQTT Client SL Package
CODESYS Forge
talk
(Post)
I’m currently working on establishing a TLS connection with an MQTT broker using the MQTT Client SL package in CODESYS. While I’ve successfully established communication with the broker without TLS, I'm encountering issues when trying to enable TLS. In the 'MQTT Explorer' application, I can easily upload the server certificate (.crt), client certificate (.crt), and client key (.key). However, in CODESYS, I can’t find a way to upload my client key (.key file). Here's a summary of my current setup: Certificates: I have uploaded both the client and server certificates to the certificate store under the 'Trusted Certificates' folder in the security screen. TLS Context Initialization: Despite setting the _sCommonName as the name of my client certificate, a new self-signed certificate is created and placed within the device’s certificates. I then need to manually move this certificate to the trusted certificates folder. This results in three certificates in my trusted certs folder: client cert, server cert, and the newly created cert. _ciDefaultCertInfo : MQTT.NBS.CERT_INFO := (psInfo := ADR(_sCommonName), udiSize := TO_UDINT(LEN(_sCommonName))); // CN of the certificate (common name) _sCipherList : MQTT.NBS.CIPHER_LIST := STRUCT(psList := ADR('HIGH'), udiSize := 4); // Cipher string see https://www.openssl.org/docs/man1.1.1/man1/ciphers.html _tlsContext : MQTT.NBS.TLSContext := ( sUseCaseName := _sCommonName, // A certificate is stored in the certificate store with the use case name. You can choose any name. Here we use the common name. ePurpose := MQTT.NBS.PURPOSE.CLIENT_SIDE, // For client certificates set this to NBS.PURPOSE.CLIENT_SIDE sTLSVersion := '1.3', // The TLS version sCipherList := _sCipherList, // Set the cipher list sHostname := sHostname, // The hostname of the broker udiVerificationMode := 2, // 2 => Active Peer verification ciCertInfo := _ciDefaultCertInfo, // Set the cert info itfCertVerifer := 0); // 0 => No Verifier mqttClient : MQTT.MQTTClient := (xUseTLS:=TRUE, itfTLSContext := _tlsContext, itfAsyncProperty := _asyncProperty); Additional Details: In the client FB, I’ve set uiPort:= 8883, xUseTLS:= TRUE, and configured itfTLSContext as mentioned above. The certificates are encrypted with SHA256RSA. sHostname is the IP address of my broker. I’ve attached a copy of the client FB, which shows straight lines where variables are assigned and boxes where they are not. I am currently trying this on the only 2 compatible versions of COSDESYS with my controller (V3.5.15.20 and V3.5.18.40) My Question: How do I correctly set up this mTLS connection? What might I be missing? Any guidance or suggestions would be greatly appreciated, especially considering I’ve already successfully established a non-TLS connection with the same broker. Thank you in advance for your help!
Last updated: 2024-06-19
To search for an exact phrase, put it in quotes. Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it. Example: docs -help
To search on specific fields, use these field names instead of a general text search. You can group with AND
or OR
.