Test fails

Asked by Deimantas Zvirblis

Hello,

I'm using libmodbus 2.93 as master in embedded linux system.
It sends request for AVR microcontroler ATmega164p to read registers.
The response from ATmega164p is correct, but libmodbus returns:
ERROR modbus_read_registers single (-1)

Question information

Language:
English Edit question
Status:
Solved
For:
libmodbus Edit question
Assignee:
No assignee Edit question
Solved by:
Deimantas Zvirblis
Solved:
Last query:
Last reply:
Revision history for this message
Stéphane Raimbault (sra) said :
#1

What is the response (modbus_set_debug(ctx, TRUE))?

Revision history for this message
Deimantas Zvirblis (deimantas-zvirblis) said :
#2

ERROR modbus_read_registers single (-1)
Adress = 1
[01][03][00][02][00][01][25][CA]
Waiting for confirmation...
ERROR Connection timed out: select
ERROR modbus_read_registers single (-1)
Adress = 1
Test: 2 FAILS

Revision history for this message
Stéphane Raimbault (sra) said :
#3

Try to increase the timeout
void modbus_get_timeout_begin(modbus_t *ctx, struct timeval *timeout);
void modbus_set_timeout_begin(modbus_t *ctx, const struct timeval *timeout);

void modbus_get_timeout_end(modbus_t *ctx, struct timeval *timeout);
void modbus_set_timeout_end(modbus_t *ctx, const struct timeval *timeout);

Revision history for this message
Deimantas Zvirblis (deimantas-zvirblis) said :
#4

There was some problems with connection.
Now i get the response and its good, but still with error.

TEST READ:
[01][03][00][0C][00][01][44][09]
Waiting for a message (7 bytes)...
<01><03><01><00><0F><08><40>

ERROR Quantity (0) not corresponding to the query (1) (-3)
read_holding_registers: FAILED (nb points -3)

Revision history for this message
Deimantas Zvirblis (deimantas-zvirblis) said :
#5

Problem solved.
Thanks for your time.

Revision history for this message
Naman Agarwal (namankr1) said :
#6

Can you please elaborate the steps for solution... I am also receiving the same error.