markniu / Bed_Distance_sensor

Auto bed level with High resolution distance sensor
281 stars 28 forks source link

Unable to make it working on MKS Robin nano 1.2 #53

Closed Carontes closed 8 months ago

Carontes commented 11 months ago

On my printer I have a 3D Touch V3.2 Pro by Geeetech and it works. Now I wanted to switch to the BD Sensor, so I just switched the 3D touch with the bd sensor, since they have the same wire connections, but it doesn't work. Then I thought it could have been something in my wire connection so I used the wires that come with the sensor and connected them directly to the motherboard but still no success. I used this code in Marlin #define I2C_BD_SDA_PIN PA11 #define I2C_BD_SCL_PIN PA8 according to this page. Is there something I'm doing wrong or missing? Thank you

markniu commented 11 months ago

Since there is a large signal filter capacitor on the endstop pin on all the MKS board. we can't use that pin directly, here you can try to use the PB2 instead of PA8. image

Carontes commented 11 months ago

I tried it but when it's time to home the Z axis the printer fails and on the screen there's this message BDsensor connect Err!: PRINTER HALTED Please Reset It's the same message as the one it appeared with the "old" setting when I used the PA8. In Marlin I use the pins_MKS_ROBIN_NANO_common.h file to edit the pins for the sensor, is it right?

markniu commented 11 months ago

oh, sorry, not PA8 but PA11. it should be like this:

define I2C_BD_SDA_PIN PB2

define I2C_BD_SCL_PIN PA8

Carontes commented 11 months ago

Thank you now it works. But now there's another problem, the bed leveling doesn't work. It starts the first row out of 8 and then it stops

markniu commented 11 months ago

could you share your confiure files or send to me?

Carontes commented 11 months ago

Where can I send it?

markniu commented 11 months ago

niujl123@sina.com, you can upload to google drive and send me the link.

Carontes commented 11 months ago

Did you receive it?

Carontes commented 11 months ago

I tried disabling BD_SENSOR_PROBE_NO_STOP and it works, but of course I loose the fast way of leveling the bed (but it's always faster than doing it with a bl touch). So there must be something weird in that line, I don't know if it can helps but I also use a dual Z stepper system so I can use the auto-alignment feature in Marlin. My STRING_DISTRIBUTION_DATE "2023-11-18" to be sure, in case this bugfix version doesn't have it enabled in it

markniu commented 10 months ago

Here is one temp solution. https://github.com/MarlinFirmware/Marlin/issues/26738#issuecomment-1916999940 replace the if (inInc > 0 ? (pos >= cmp) : (pos <= cmp)) break; with if (inInc > 0 ? ((pos+1) >= cmp) : (pos <= (cmp+1))) break;

in the file Marlin/src/gcode/bedlevel/abl/G29.cpp

I tried disabling BD_SENSOR_PROBE_NO_STOP and it works, but of course I loose the fast way of leveling the bed (but it's always faster than doing it with a bl touch).

Carontes commented 8 months ago

Hi, sorry for the long delay but I had troubles with my printer and never had the chance to use it. Anyway I tried your solution and it works, hoping to see the new fix in the next Marlin versions without changing the code manually. Thank you again