Thank you folks for the advice!
@Aciera: I am using INIT_DEBUG=3. This is the typical output I get (here trying to access register 40011):
Code:
[code]halcmd -f sinamics_mb2hal.hal
...
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[9600] data[8] parity[E] stop[1] 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.100] 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.accel_time.num_errors]
mb2hal create_each_mb_tx_hal_pins DEBUG: mb_tx_num [0] pin_name [mb2hal.accel_time.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
Component Pins:
Owner Type Dir Value Name
4 float OUT 0 mb2hal.accel_time.00.float
4 s32 OUT 0 mb2hal.accel_time.00.int
4 u32 OUT 0x00000000 mb2hal.accel_time.num_errors
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
[b]mb2hal fnct_03_read_holding_registers DEBUG: mb_tx[0] mb_links[0] slave[1] fd[4] 1st_addr[40011] nelem[1]
[01][03][9C][4B][00][01][DA][4C]
Waiting for a confirmation...
<01><83><02><C0><F1>
ERROR Illegal data address
mb2hal fnct_03_read_holding_registers ERR: mb_tx[0] mb_links[0] slave[1] = 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]
Bytes flushed (0)
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] SERIAL_DELAY_MS activated [0]
mb2hal link_loop_and_logic DEBUG: mb_tx_num[0] mb_links[0] thread[0] fd[4] gbl.slowdown activated [1.000]
...
sudo pkill mb2hal
mb2hal quit_signal DEBUG: signal [15] received
mb2hal quit_cleanup DEBUG: started
mb2hal quit_cleanup DEBUG: unloading HAL module [4] ret[0]
mb2hal quit_cleanup DEBUG: done OK
mb2hal main OK: going to exit![/b]
[/code]
As you see the only error is the illegal data address, everything else seems to be fine. And the response bytes are consistent. This leads me to suppose that the hardware comm is fine (since everything is consistent), and the sent bytes and answer bytes are coherent with what should be sent and received (I checked that).
@Todd: Ok, will try! I just thought "It can't be that simple"...