simon-jouet / ESP32Controller

ESP32-based 3D printer controller
120 stars 29 forks source link

I2S motor and FET issues #10

Closed vivian-ng closed 3 years ago

vivian-ng commented 5 years ago

As @simon-jouet mentioned in PR#6 about starting a new issue to discuss the I2S-related motor and FET issues, I have taken the liberty to open the issue.

I am also experiencing issues with the I2S stream for motors, similar to what @Ringel mentioned. Sometimes, after the motors have stopped, it will start to drift on its own (I see this on my X axis, which uses the pins 128, 129, and 130). I also had an experience where partway through a print, the X gantry just drifted toward X_MIN, and kept crashing into the endstop until I had to turn off the printer. It seemed random because I did the same print again and the print completed.

As for driving of FETs, I am able to drive my E0 MOSFET using pin 140, but I am not able to control my fan MOSFET using pin 141. I will check to see if using a pin from 144 and higher will give more consistent results.

I have horrible temperature reading fluctations of plus minus 5 degs, which could be due to noise from the I2S lines as mentioned by @felixstorm before. Will try to reroute the lines and add a ground plane below the I2S lines to see if it helps. Meanwhile, I had to set TEMP_HYSTERESIS as 10 to allow for printing to commence. Definitely not ideal, haha.

I haven't had any luck with trying to drive the LCD controllers via I2S, but will try to use the pins 144 and above to see if it works. If my understanding of what @simon-jouet is saying, the lower pins (128 to 143) should be used for the motors, while the higher pins (144 to 159) can be used for MOSFETs and LCD. Will give that a try.