LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)

More
1 year 8 months ago - 1 year 8 months ago #320484 by meister
hate modbus protocol :)

sorry, need some time to fix that problem

EDIT2:
I have now ordered a 32 relay card,
I will not receive the 16-channel card in time.

The protocol is a bit different, but it looks like I'll have to write a sub-plugin for each type, as no one really follows the standard :(
Last edit: 1 year 8 months ago by meister.

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #320583 by meister
ok, until I have a better solution,
I have added a new 'type' (201 : Custom Boolean)

sample config (gui setup will not work / need to added by hand in the json config):
Code:
{ "type": "modbus", "pins": { "tx": { "pin": "MODBUS:TX" }, "rx": { "pin": "MODBUS:RX" }, "tx_enable": { "pin": "MODBUS:TX_ENABLE" } }, "uid": "modbus0", "config": { "relais1": { "type": 201, "address": 11, "on": [6 ,0, 1, 1, 0], "off": [6 ,0, 1, 0, 0], "timeout": 100, "delay": 60, "direction": "output" } } }

"on": the bytes of the frame to switch the output on (without address and checksum)
"off": the bytes of the frame to switch the output off (without address and checksum)

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #320671 by babinda01
Hi Olli
Thank you very much for your efforts, I will download the latest dev of riocore tonight and will let you know how it goes.

Andrew

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #320759 by meister
i got my 32 relay card today and changed something in the setup, i will test everything again later.

you can now use func:6 and set the datatype (new option) to bool, as register the 112 (0x70) and Values = 16

 
Code:
            "config": {                 "relais": {                     "address": 11,                     "type": 6,                     "register": 112,                     "values": 16,                     "datatype": "bool",                     "scale": 1.0,                     "unit": "",                     "error_values": "",                     "format": "",                     "timeout": 100,                     "delay": 60,                     "direction": "output"                 }             }

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago - 1 year 8 months ago #320771 by meister
Works for me :)
www.youtube.com/shorts/ZcQjW4829R0

the modbus has some delay, thats why it is a little asynchronous
Code:
M64 P0 G4 P0.1 M64 P1 G4 P0.1 M64 P2 G4 P0.1 ... M65 P1 G4 P0.1 M65 P2 G4 P0.1 M65 P3 ...


@Andrew
there is also a template now for your board, but without input yet, would be nice if you can give me your config for the inputs
Last edit: 1 year 8 months ago by meister.

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #320891 by babinda01
Hi Olli
Thank you once again for your prompt response to my issue.
I have done a very quick test and at the moment I am over the moon, all the outputs work as they should.
I am using your template for N4D3E16, with exactly your settings.
When I use LinuxCNC it works perfectly, but if I use the test-gui in riocore the outputs work, but i get the following errors in the terminal window.

loading board setup: Tangbob
connection via: UDP
IP: 192.168.10.194
PORT: 2390
WARNING: can not set timeouts: timed out
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 457, resource id: 11699426, major code: 40 (TranslateCoords), minor code: 0
ERROR: modbus CSUM failed [173, 219] != [136, 17]
ERROR: modbus CSUM failed [92, 27] != [136, 17]
ERROR: modbus CSUM failed [92, 27] != [136, 17]
ERROR: modbus CSUM failed [173, 219] != [136, 17]
ERROR: modbus CSUM failed [60, 136] != [1, 225]
ERROR: modbus CSUM failed [108, 27] != [73, 209]
ERROR: modbus CSUM failed [173, 219] != [136, 17]


I will test for a little while longer to see if I can figure out if I have configured something incorrectly.

To use the inputs originally I used the following settings. I cant remember why I broke them into lots of 4, I'm thinking that if I put a "values" as 16 it wouldn't work

"inputs1_4": {
"address": 1,
"type": 3,
"register": 129,
"values": 4,
"is_float": false,
"scale": 1.0,
"unit": "",
"error_values": "",
"format": "d",
"timeout": 100,
"delay": 60,
"direction": "input"
},
"inputs5_8": {
"address": 1,
"type": 3,
"register": 133,
"values": 4,
"is_float": false,
"scale": 1.0,
"unit": "",
"error_values": "",
"format": "d",
"timeout": 100,
"delay": 60,
"direction": "input"
},
"inputs9_12": {
"address": 1,
"type": 3,
"register": 137,
"values": 4,
"is_float": false,
"scale": 1.0,
"unit": "",
"error_values": "",
"format": "d",
"timeout": 100,
"delay": 60,
"direction": "input"
},
"inputs13_16": {
"address": 1,
"type": 3,
"register": 140,
"values": 4,
"is_float": false,
"scale": 1.0,
"unit": "",
"error_values": "",
"format": "d",
"timeout": 100,
"delay": 60,
"direction": "input"
}
},


Thanks again.

Andrew

Please Log in or Create an account to join the conversation.

Time to create page: 0.096 seconds
Powered by Kunena Forum