Video is better to explain the problem;
https://youtu.be/KenRduFPMmI
I don't know why/how X triggers before it hits the switch but I think I may be trying to home the printer where it shouldn't be? X/Y switches works without any problem. Center origin X0 Y0 is the physical origin center point of the bed. The bed size 500mm x 500 mm but the axis movement limits X400 Y430 Z500 mm
Here is my config.g code
; Configuration file for Duet WiFi (firmware version 3.3)
; executed by the firmware on start-up
;
; generated by RepRapFirmware Configuration Tool v3.3.10 on Sun Nov 28 2021 20:59:46 GMT+0300 (GMT+03:00)
; General preferences
G90 ; send absolute coordinates...
M83 ; ...but relative extruder moves
M550 P"DUET" ; Set machine name
M552 S1 ; Enable network
; Network
M552 S1 ; enable network
M586 P0 S1 ; enable HTTP
M586 P1 S0 ; disable FTP
M586 P2 S0 ; disable Telnet
; Drives
M569 P1 S1 ; physical drive 0 goes backwards
M569 P1 S0 ; physical drive 1 goes backwards
M569 P2 S1 ; physical drive 2 goes forwards
M569 P3 S1 ; physical drive 3 goes forwards
M569 P4 S0 ; physical drive 4 goes forwards
M584 X0 Y1 Z2 E3:4 ; set drive mapping
M350 X16 Y16 Z16 E16:16 I1 ; configure microstepping with interpolation
M92 X80.70 Y80.80 Z400.50 E100.00:100.00 ; set steps per mm
M566 X900.00 Y900.00 Z60.00 E750.00:750.00 ; set maximum instantaneous speed changes (mm/min)
M203 X9000.00 Y9000.00 Z200.00 E1200.00:1200.00 ; set maximum speeds (mm/min)
M201 X500.00 Y500.00 Z60.00 E750.00:750.00 ; set accelerations (mm/s^2)
M906 X1200 Y1200 Z1200 E1200:1200 I30 ; set motor currents (mA) and motor idle factor in per cent
M84 S30 ; Set idle timeout
;M572 D0:1 S0.25 ; Linear advance
; Axis Limits
M208 X-216:184, Y-215:215
; Endstops
M574 X2 S1 P"xstop" ; configure switch-type (e.g. microswitch) endstop for low end on X via pin xstop
M574 Y1 S1 P"ystop" ; configure switch-type (e.g. microswitch) endstop for low end on Y via pin ystop
M574 Z1 S2 ; configure Z-probe endstop for low end on Z
; Z-Probe
M950 S0 C"exp.heater7" ; create servo pin 0 for BLTouch
M558 P9 C"^zprobe.in" H5 F150 T9000 ; set Z probe type to bltouch and the dive height + speeds
G31 P500 X0 Y0 Z1.45 ; set Z probe trigger value, offset and trigger height
M557 X-180:200 Y-180:200 S170 ; define mesh grid
; Heaters
M308 S0 P"bedtemp" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin bedtemp
M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0
M307 H0 B0 R0.588 C280.3 D7.46 S1.00 ; enable bang-bang mode for the bed heater and set PWM limit
M140 H0 ; map heated bed to heater 0
M143 H0 S120 ; set temperature limit for heater 0 to 120C
M308 S1 P"e0temp" Y"thermistor" T99962 B4810 C6.7e-8 ; configure sensor 1 as thermistor on pin e0temp
M950 H1 C"e0heat" T2 ; create nozzle heater output on e0heat and map it to sensor 1
M307 H1 B0 R2.949 C172.9:117.9 D5.61 S1.00 V23.9 ; disable bang-bang mode for heater and set PWM limit
M143 H1 S280 ; set temperature limit for heater 1 to 280C
M308 S2 P"e1temp" Y"thermistor" T99962 B4810 C6.7e-8 ; configure sensor 2 as thermistor on pin e1temp
M950 H2 C"e1heat" T1 ; create nozzle heater output on e1heat and map it to sensor 2
M307 H2 B0 R4.803 C124.8:96.0 D9.61 S1.00 V22.8 ; disable bang-bang mode for heater and set PWM limit
M143 H2 S280 ; set temperature limit for heater 2 to 280C
; Fans
M950 F1 C"fan1" Q500 ; create fan 0 on pin fan0 and set its frequency
M106 P1 T45 S1 H1:2 ; set fan 1 value. Thermostatic control is turned off
M950 F0 C"fan0" Q500 ; create fan 1 on pin fan1 and set its frequency
M106 P0 S0 H-1 ; set fan 0 value. Thermostatic control is turned on
M950 F2 C"fan2" Q500 ; create fan 2 on pin fan2 and set its frequency
M106 P2 S0 H-1 ; set fan 2 value. Thermostatic control is turned off
; Tools
M563 P0 S"SOL" D0 H1 F0 ; define tool 0
G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets
G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C
M563 P1 S"SAĞ" D1 H2 F2 ; define tool 1
G10 P1 X0 Y0 Z0 ; set tool 1 axis offsets
G10 P1 R0 S0 ; set initial tool 1 active and standby temperatures to 0C
; Custom settings are not defined
; homeall.g
; called to home all axes
;
; generated by RepRapFirmware Configuration Tool v3.3.10 on Sun Nov 28 2021 20:59:47 GMT+0300 (GMT+03:00)
G91 ; relative positioning
G1 H2 Z5 F9000 ; lift Z relative to current position
G1 H1 X200 Y-220 F2400 ; move quickly to X and Y axis endstops and stop there (first pass)
G1 H2 X-5 Y5 F6000 ; go back a few mm
G1 H1 X200 Y-220 F600 ; move slowly to X and Y axis endstops once more (second pass)
G90 ; absolute positioning
G1 X0 Y0 F6000 ; go to first bed probe point and home Z
G30 ; home Z by probing the bed
; homex.g
; called to home the X axis
;
; generated by RepRapFirmware Configuration Tool v3.3.10 on Sun Nov 28 2021 20:59:47 GMT+0300 (GMT+03:00)
G91 ; relative positioning
G1 H2 Z5 F9000 ; lift Z relative to current position
G1 H1 X185 F2400 ; move quickly to X axis endstop and stop there (first pass)
G1 H2 X-5 F9000 ; go back a few mm
G1 H1 X185 F600 ; move slowly to X axis endstop once more (second pass)
G1 H2 Z5 F9000 ; lower Z again
G90 ; absolute positioning