I want to connect a sensor to this lora board (RoLa Lora Radio Node containing Atmega328P as microcontroller) through MAX485 to transfer a RS485 data from a soil sensor. The sensor seems remains unconnected if i use pins D5-D8 or D3-D4. The D2 pin already used by the Lora 1278. When I use an Esp32 or Arduino Nano the sensor and MAX485 works
You should provide a link to the source code of the sketch you are using.
You should also run some basic tests where you do something like load an Arduino sketch that toggles the pins you want to connect the sensor to, and use a scope / LED / buzzer to make sure those are connected in the way you believe.
For serial communication you also need to consider if the baud rate is as believed - if your build a sketch with a mistaken setting of the board clock rate, your baud rate may be half or twice what was intended.