Ahoj,
snažím se rozchodit
mb2hal, ale zatím se nedaří. Povedlo se mi rozchodit MODBUS RTU režim i komunikaci (čtení i zápis), ale jen pod Windows (program ModScan32). LinuxCNC 2.7 (RTAI Debian 7 Wheezy) na tom samém PC se s tím měničem nějak není sto spojit. Že by přecijen problém v použitém dongle?
- Správně vyčtené parametry 1-10
- Nastavení connection parametrů
Dongle je pod Linuxem vidět:
Kód: Vybrat vše
[ 10.960873] usbcore: registered new interface driver usbserial
[ 10.960883] usbcore: registered new interface driver usbserial_generic
[ 10.960891] USB Serial support registered for generic
[ 10.960907] usbserial: USB Serial Driver core
[ 10.970365] usbcore: registered new interface driver ch341
[ 10.970380] USB Serial support registered for ch341-uart
[ 10.970389] ch341 2-1.7:1.0: ch341-uart converter detected
[ 10.972189] usb 2-1.7: ch341-uart converter now attached to ttyUSB0
ale jak píšu, LinuxCNC si s měničem při stejných nastaveních nepokecá:
Kód: Vybrat vše
linuxcnc /home/tomas/linuxcnc/configs/neotor/neotor.ini
LINUXCNC - 2.7.15
Machine configuration directory is '/home/tomas/linuxcnc/configs/neotor'
Machine configuration file is 'neotor.ini'
Starting LinuxCNC...
Found file(REL): ./neotor.hal
Found file(REL): ./custom.hal
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [INIT_DEBUG] [3]
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [HAL_MODULE_NAME] [mb2hal]
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [SLOWDOWN] [0.000]
mb2hal parse_common_section DEBUG: [MB2HAL_INIT] [TOTAL_TRANSACTIONS] [1]
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [LINK_TYPE] [serial] [0]
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_PORT] [/dev/ttyUSB0]
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_BAUD] [19200]
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_BITS] [8]
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_PARITY] [none]
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_STOP] [2]
mb2hal parse_serial_subsection DEBUG: [TRANSACTION_00] [SERIAL_DELAY_MS] [10]
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_SLAVE_ID] [11]
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [FIRST_ELEMENT] [2]
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [NELEMENTS] [1]
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MAX_UPDATE_RATE] [0.000]
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_RESPONSE_TIMEOUT_MS] [2000]
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_BYTE_TIMEOUT_MS] [2000]
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [DEBUG] [3]
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [MB_TX_CODE] [fnct_03_read_holding_registers] [2]
mb2hal parse_transaction_section DEBUG: [TRANSACTION_00] [HAL_TX_NAME] [remoteIOcfg]
mb2hal parse_ini_file OK: parse_transaction_section 0 OK
mb2hal main OK: parse_ini_file done OK
mb2hal init_mb_links DEBUG: LINK 0 (RTU) link_type[0] device[/dev/ttyUSB0] baud[19200] data[8] parity[N] stop[2] fd[-1]
mb2hal main OK: init_gbl.mb_link done OK
mb2hal init_mb_tx DEBUG: MB_TX 0 lk_n[0] tx_n[0] cfg_dbg[3] lk_dbg[1] t_inc[0.000] nxt_t[0.000]
mb2hal main OK: init_gbl.mb_tx done OK
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.remoteIOcfg.num_errors]
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.remoteIOcfg.00]
mb2hal main OK: HAL components created OK
mb2hal main OK: Link thread loop and logic 0 created OK
mb2hal main OK: mb2hal is running
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[-1] going to TEST availability
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[-1] going to TEST connection
mb2hal get_tx_connection DEBUG: mb_tx_num[0] mb_links[0] new connection -> fd[4]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] lk_dbg[1] going to EXECUTE transaction
mb2hal fnct_03_read_holding_registers DEBUG: mb_tx[0] mb_links[0] slave[11] fd[4] 1st_addr[2] nelem[1]
[0B][03][00][02][00][01][25][60]
Waiting for a confirmation...
ERROR Connection timed out: select
mb2hal fnct_03_read_holding_registers ERR: mb_tx[0] mb_links[0] slave[11] = ret[-1] fd[4]
mb2hal link_loop_and_logic ERR: mb_tx_num[0] mb_links[0] thread[0] fd[4] transaction failure, num_errors[1]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] SERIAL_DELAY_MS activated [10]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] going to TEST availability
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] going to TEST connection
mb2hal get_tx_connection DEBUG: mb_tx_num[0] mb_links[0] already connected to fd[4]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] lk_dbg[1] going to EXECUTE transaction
mb2hal fnct_03_read_holding_registers DEBUG: mb_tx[0] mb_links[0] slave[11] fd[4] 1st_addr[2] nelem[1]
[0B][03][00][02][00][01][25][60]
Waiting for a confirmation...
ERROR Connection timed out: select
mb2hal fnct_03_read_holding_registers ERR: mb_tx[0] mb_links[0] slave[11] = ret[-1] fd[4]
mb2hal link_loop_and_logic ERR: mb_tx_num[0] mb_links[0] thread[0] fd[4] transaction failure, num_errors[2]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] SERIAL_DELAY_MS activated [10]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] going to TEST availability
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] going to TEST connection
mb2hal get_tx_connection DEBUG: mb_tx_num[0] mb_links[0] already connected to fd[4]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] lk_dbg[1] going to EXECUTE transaction
mb2hal fnct_03_read_holding_registers DEBUG: mb_tx[0] mb_links[0] slave[11] fd[4] 1st_addr[2] nelem[1]
[0B][03][00][02][00][01][25][60]
Waiting for a confirmation...
ERROR Connection timed out: select
mb2hal fnct_03_read_holding_registers ERR: mb_tx[0] mb_links[0] slave[11] = ret[-1] fd[4]
mb2hal link_loop_and_logic ERR: mb_tx_num[0] mb_links[0] thread[0] fd[4] transaction failure, num_errors[3]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] SERIAL_DELAY_MS activated [10]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] going to TEST availability
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] going to TEST connection
mb2hal get_tx_connection DEBUG: mb_tx_num[0] mb_links[0] already connected to fd[4]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] lk_dbg[1] going to EXECUTE transaction
mb2hal fnct_03_read_holding_registers DEBUG: mb_tx[0] mb_links[0] slave[11] fd[4] 1st_addr[2] nelem[1]
[0B][03][00][02][00][01][25][60]
Waiting for a confirmation...
^Cmb2hal quit_signal DEBUG: signal [2] received
mb2hal quit_cleanup DEBUG: started
task: 756 cycles, min=0.000005, max=0.020633, avg=0.009815, 0 latency excursions (> 10x expected cycle time of 0.010000s)
mb2hal quit_cleanup DEBUG: unloading HAL module [15] ret[0]
mb2hal quit_cleanup DEBUG: done OK
mb2hal main OK: going to exit!
Traceback (most recent call last):
File "/usr/bin/axis", line 3540, in <module>
o.mainloop()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1035, in mainloop
self.tk.mainloop(n)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1432, in __call__
def __call__(self, *args):
KeyboardInterrupt
Shutting down and cleaning up LinuxCNC...
tomas@debian-cnc-home:~$
Resp. není mi jasné, jestli má být měnič pro
mb2hal nastaven na RTU nebo ASCII, ale nefungovalo ani jedno. Ve Windows fungoval jen ten RTU režim.
Nemáte někdo tento
obyč dongle pod stejným Linuxem ověřen?
Příp. jak bych ho ověřil, je na to nějaký (přiměřeně) snadný postup*?
Dík, T.
*EDIT: Možná
https://www.modbusdriver.com/modpoll.html? Zkusím zítra..