SIGSEGV

Asked by santiago

Hi all,

I modified test-modbus.c to try to just do a single read of a a single holding register (register 4001 or address 0) from a Variable Frequency Drive (that controls a 350 kW electric motor) but I'm running with an issue:

When the drive is disconnected the program times out, just as expected. When I connect the drive, I get a SIGSEGV signal. This is the output of a backtrace on the program:

 (gdb) backtrace
#0 0xb7e4f6db in read_registers (mb_param=<value optimized out>, slave=<value optimized out>,
    function=<value optimized out>, start_addr=0, count=1, data_dest=0x80486d9) at modbus.c:703
#1 0x0804860a in main ()

I don't really know if this is an error due to drives, the program or the library... Help is very much appreciated!

Thanks in advance,

Santiago

Question information

Language:
English Edit question
Status:
Solved
For:
libmodbus Edit question
Assignee:
No assignee Edit question
Solved by:
santiago
Solved:
Last query:
Last reply:
Revision history for this message
Todd Denniston (todd-denniston) said :
#1

are you still using tab_rq_bits, from the test program, to get data back from the read_holding_registers function?

my first guess would be that while trimming out the stuff you do not need, you also got the line:
  tab_rq_bits = (int *) malloc(FIELDS * sizeof(int));

as the read_* functions are expecting a pointer to an array, not a single integer, for stuffing data into.

I would almost have to see a bit more of your program to make better guesses.

Revision history for this message
santiago (repepo) said :
#2

Hi Todd,

You are completely right! I got rid of the array part... I should have noticed it before.

Thank you so much!

Santiago