How to swap TX-RX pins in RS-485 serial

I suggest to bread board designs using the intended pin assignments and test with the intended software BEFORE going to the effort and expense of spinning a custom printed wiring board.

in reality the line is const int16_t dePin = 2; // Enable to TX PA2/Pin46

I always do this. This case was an unfortunate exception due to the delivery time.

You would save time if you explain your setup, what it really is hardware wise.

How?

I see it opposite, if the code is right, microcontroller will respond. If it receives valid request. How you debug the slave?

I used a known circuit and I know it works, because I have other boards with the same hardware and it works. I tested two other similar ones and the behavior is the same. I tested the request signal with an oscilloscope. Everything is ok.

I am using two tools to simulate the Master. The first is ModBus Poll and the other is an application I developed in SCADA software.

I agree with you that everything leads us to believe that it is the software, but we are not able to find the problem

If you want help to resolve things, post your circuit.

At what of the three possible points?

And what about the reply?

Signal on pin 1 of U7. other pins (2,3,4) at zero