I try to connect my paspbery pi to ATMega8 with RS485.
I double checked port settings. Settings -ok(all the same).
Please let me know what this code mean?
May be it help.
Illegal Function generally means you are trying to read a slave device with a function code that is not supported by the device or in the modbus spec. You might try reversing your RS-485 wires or checking your code because I'd be surprised if 7F was a valid function code. The more common function codes are 03 and 04.