pycomm3 icon indicating copy to clipboard operation
pycomm3 copied to clipboard

Generic Messaging Help

Open mikeadkins opened this issue 1 year ago • 6 comments

I am attempting to use Pycomm3 with a Japanese PLC brand called Toyopuc. I have gotten the reading of data working properly with generic messaging but am having trouble with the sending of data. I keep getting an error in the log stating: Generic message 'generic' failed: Insufficient command data. Would anyone have any idea as to what is happening? Thanks for any help you can provide.

EDS file: `$ EZ-EDS Version 3.21.1.20161208 Generated Electronic Data Sheet

[File] $ File Description Test DescText = "PC10G-CPU EDS File"; $ File Creation Date CreateDate = 05-18-2017; $ File Creation Time CreateTime = 16:22:28; $ Last Modification Date ModDate = 05-18-2017; $ Last Modification Time ModTime = 16:24:37; $ EDS Revision Revision = 1.1;

[Device] $ Vendor ID VendCode = 130; $ Vendor Name VendName = "JTEKT Corporation"; $ Product Type ProdType = 12; $ Product Type String ProdTypeStr = "Communications Adapter"; $ Product Code ProdCode = 1001; $ Major Revision MajRev = 1; $ Minor Revision MinRev = 1; $ Product Name ProdName = "PC10G-CPU";

[Device Classification] Class1 = EtherNetIP;

[Params] Param1 = 0, $ reserved, shall equal 0 ,, $ Link Path Size, Link Path 0x0000, $ Descriptor 0xC8, $ Data Type 4, $ Data Size in bytes "RPI", $ name "microsecond", $ units "", $ help string 2000,10000000,50000, $ min, max, default data values ,,,, $ mult, div, base, offset scaling ,,,, $ mult, div, base, offset links ; $ decimal places Param2 = 0, $ reserved, shall equal 0 ,, $ Link Path Size, Link Path 0x0000, $ Descriptor 0xC7, $ Data Type 2, $ Data Size in bytes "Produced Data Size", $ name "byte", $ units "", $ help string 1,1448,2, $ min, max, default data values ,,,, $ mult, div, base, offset scaling ,,,, $ mult, div, base, offset links ; $ decimal places Param3 = 0, $ reserved, shall equal 0 ,, $ Link Path Size, Link Path 0x0000, $ Descriptor 0xC7, $ Data Type 2, $ Data Size in bytes "Consumed Data Size", $ name "byte", $ units "", $ help string 1,1448,2, $ min, max, default data values ,,,, $ mult, div, base, offset scaling ,,,, $ mult, div, base, offset links ; $ decimal places Param4 = 0, $ reserved, shall equal 0 ,, $ Link Path Size, Link Path 0x0000, $ Descriptor 0xC6, $ Data Type 1, $ Data Size in bytes "Produced Assembly ID", $ name "", $ units "", $ help string 100,199,100, $ min, max, default data values ,,,, $ mult, div, base, offset scaling ,,,, $ mult, div, base, offset links ; $ decimal places Param5 = 0, $ reserved, shall equal 0 ,, $ Link Path Size, Link Path 0x0000, $ Descriptor 0xC6, $ Data Type 1, $ Data Size in bytes "Consumed Assembly ID", $ name "", $ units "", $ help string 100,199,101, $ min, max, default data values ,,,, $ mult, div, base, offset scaling ,,,, $ mult, div, base, offset links ; $ decimal places

[Connection Manager] Object_Name = "Connection Manager Object"; Object_Class_Code = 0x06; Connection1 = 0x02030002, $ 0-15 = supported transport classes $ 16 = trigger: cyclic $ 17 = trigger: change of state $ 18 = trigger: application $ 19-23 = trigger: reserved $ 24 = application type: listen-only $ 25 = application type: input-only $ 26 = application type: exclusive-owner $ 27 = application type: redundant-owner $ 28-30 = reserved $ 31 = Direction: Client = 0 / Server = 1 0x44640305, $ 0 = O->T fixed size supported $ 1 = O->T variable size supported $ 2 = T->O fixed size supported $ 3 = T->O variable size supported $ 4-5 = O->T number of bytes per slot (obsolete) $ 6-7 = T->O number of bytes per slot (obsolete) $ 8-10 = O->T Real time transfer format $ 11 = reserved $ 12-14 = T->O Real time transfer format $ 15 = reserved $ 16 = O->T connection type: NULL $ 17 = O->T connection type: MULTICAST $ 18 = O->T connection type: POINT2POINT $ 19 = O->T connection type: reserved $ 20 = T->O connection type: NULL $ 21 = T->O connection type: MULTICAST $ 22 = T->O connection type: POINT2POINT $ 23 = T->O connection type: reserved $ 24 = O->T priority: LOW $ 25 = O->T priority: HIGH $ 26 = O->T priority: SCHEDULED $ 27 = O->T priority: reserved $ 28 = T->O priority: LOW $ 29 = T->O priority: HIGH $ 30 = T->O priority: SCHEDULED $ 31 = T->O priority: reserved ,0,, $ O->T RPI, size, format Param1,Param2,, $ T->O RPI, size, format ,, $ proxy config size, format ,, $ target config size, format "Input Only(ID Type)", $ Connection Name "", $ help string "20 04 24 01 2C FE 2C [Param4]"; $ Path Connection2 = 0x02030002, $ 0-15 = supported transport classes $ 16 = trigger: cyclic $ 17 = trigger: change of state $ 18 = trigger: application $ 19-23 = trigger: reserved $ 24 = application type: listen-only $ 25 = application type: input-only $ 26 = application type: exclusive-owner $ 27 = application type: redundant-owner $ 28-30 = reserved $ 31 = Direction: Client = 0 / Server = 1 0x44640305, $ 0 = O->T fixed size supported $ 1 = O->T variable size supported $ 2 = T->O fixed size supported $ 3 = T->O variable size supported $ 4-5 = O->T number of bytes per slot (obsolete) $ 6-7 = T->O number of bytes per slot (obsolete) $ 8-10 = O->T Real time transfer format $ 11 = reserved $ 12-14 = T->O Real time transfer format $ 15 = reserved $ 16 = O->T connection type: NULL $ 17 = O->T connection type: MULTICAST $ 18 = O->T connection type: POINT2POINT $ 19 = O->T connection type: reserved $ 20 = T->O connection type: NULL $ 21 = T->O connection type: MULTICAST $ 22 = T->O connection type: POINT2POINT $ 23 = T->O connection type: reserved $ 24 = O->T priority: LOW $ 25 = O->T priority: HIGH $ 26 = O->T priority: SCHEDULED $ 27 = O->T priority: reserved $ 28 = T->O priority: LOW $ 29 = T->O priority: HIGH $ 30 = T->O priority: SCHEDULED $ 31 = T->O priority: reserved ,0,, $ O->T RPI, size, format Param1,Param2,, $ T->O RPI, size, format ,, $ proxy config size, format ,, $ target config size, format "Input Only(Tag Type)", $ Connection Name "", $ help string "SYMBOL_ANSI"; $ Path Connection3 = 0x04030002, $ 0-15 = supported transport classes $ 16 = trigger: cyclic $ 17 = trigger: change of state $ 18 = trigger: application $ 19-23 = trigger: reserved $ 24 = application type: listen-only $ 25 = application type: input-only $ 26 = application type: exclusive-owner $ 27 = application type: redundant-owner $ 28-30 = reserved $ 31 = Direction: Client = 0 / Server = 1 0x44640405, $ 0 = O->T fixed size supported $ 1 = O->T variable size supported $ 2 = T->O fixed size supported $ 3 = T->O variable size supported $ 4-5 = O->T number of bytes per slot (obsolete) $ 6-7 = T->O number of bytes per slot (obsolete) $ 8-10 = O->T Real time transfer format $ 11 = reserved $ 12-14 = T->O Real time transfer format $ 15 = reserved $ 16 = O->T connection type: NULL $ 17 = O->T connection type: MULTICAST $ 18 = O->T connection type: POINT2POINT $ 19 = O->T connection type: reserved $ 20 = T->O connection type: NULL $ 21 = T->O connection type: MULTICAST $ 22 = T->O connection type: POINT2POINT $ 23 = T->O connection type: reserved $ 24 = O->T priority: LOW $ 25 = O->T priority: HIGH $ 26 = O->T priority: SCHEDULED $ 27 = O->T priority: reserved $ 28 = T->O priority: LOW $ 29 = T->O priority: HIGH $ 30 = T->O priority: SCHEDULED $ 31 = T->O priority: reserved Param1,Param3,, $ O->T RPI, size, format Param1,Param2,, $ T->O RPI, size, format ,, $ proxy config size, format ,, $ target config size, format "Exclusive-Owner", $ Connection Name "", $ help string "20 04 24 01 2C [Param5] 2C [Param4]"; $ Path

[Port] Object_Name = "Port Object"; Object_Class_Code = 0xF4; Port1 = TCP, "Ethernet Port", "20 F5 24 01", 2, 0;

[Capacity] MaxCIPConnections = 128; MaxConsumersPerMcast = 128; TSpec1 = TxRx, 1, 1000; TSpec2 = TxRx, 1448, 1000;

My code:drive_path = '192.168.250.25' with CIPDriver(drive_path) as drive:
param=drive.generic_message( service=Services.set_attribute_single, class_code=ClassCode.assembly, instance=101, attribute=b'\x03', request_data= b'\x0f', data_type=BYTE, name='generic', connected=True, unconnected_send=True, route_path=True )`

mikeadkins avatar Apr 30 '24 11:04 mikeadkins

What does your tag structure look like in the PLC?

Also see #279

Colt-H avatar May 01 '24 12:05 Colt-H

Toyopuc does not use Tags. All of the data is mapped to what they call 'Link Bits'. L000-L01F. I have 2 bytes for assembly 100 and 2 bytes for assembly 101. I have used another device (Omron ERT1 remote I/O) and it works. I receive an INT that has the data for the 16 bits of each assembly.

mikeadkins avatar May 01 '24 14:05 mikeadkins

Specifically, the insufficient command data is telling you that the requested service didn't supply enough data for the requested operation.

Are you supplying it with two bytes in request_data?

len(b'\x0f')

Returns 1.

Colt-H avatar May 01 '24 16:05 Colt-H

I wasn't but I am now. I believe it is in the PLC side. If I monitor with Wireshark it does show success with set_attribute_single and it shows the data I sent (0x0a for this example). Screenshot 2024-05-01 130825

I did find in the Toyopuc manual the following comment regarding Transport Class. It supports Class 1 and Class 3 is not supported. I do not know enough about this subject to say if that is the problem.

Also if I do a get_attribute_single on the same assembly 101 after the set I can see the data I sent, but it never shows up in the PLC monitor. This brand of PLC is very outdated and only used in one auto manufacturer who also owns the PLC company so it wouldn't surprise me if it doesn't work. Thanks.

mikeadkins avatar May 01 '24 17:05 mikeadkins

If it's not showing on the monitor, you could try linking the bit to a counter. Maybe it only goes high for 1 scan.

backrent avatar Sep 26 '24 10:09 backrent