@Phaedrux Yes, the problem was there.
For those reading this, I solved it like this:
; homeall.g
; called to home all axes
;
; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale)
G91 ; relative positioning
G1 H1 X-395 F3000 ; move quickly to X and stop there (first pass)
G1 H1 Y-345 F3000 ; move quickly to Y and stop there (first pass)
G1 X5 F1800 ; go back a few mm
G1 Y5 F1800 ; go back a few mm
G1 H1 X-395 F360 ; move slowly to X and Y axis endstop once more (second pass)
G1 H1 Y-345 F360 ; move slowly to X and Y axis endstop once more (second pass)
;G92 X0 Y0
G1 H1 Z410 F1800 ; move Z up until the endstop is triggered
G92 Z410 ; set Z position to axis maximum (you may want to adjust this)
G1 Z-5 F1800 ; go back a few mm
G1 H1 Z410 F1800 ; move slowly to X and Y axis endstop once more (second pass)
G92 Z410 ; set Z position to axis maximum (you may want to adjust this)
G90 ; absolute position
The single code are then reported in the single axes home files.