I took an example code from the CubeWL packet, specifically PingPong, and it works fine out of the box.
After than I starded to work on the code to adapt it to my need. Specifically I opened CubeMX and added the I2C periferal. After the code generator finished I noted that the folder arrangement was changed and that I had to redo the coding done before. In this process also code from the example was lost and I had to fix that too.
At this point I was able to upload the code to the boards but they showed bad signal transmission.
I can't figure out what difference is causing the different performance results, the lora parameters a re basically identical.