bigtreetech / BIGTREETECH-S42B-V1.0

The closed-loop drive is to feedback the rotation angle of the stepping motor to the control panel, compare the distance that needs to be rotated with the distance of the actual rotation, calculate the error value, and then compensate, so as to prevent the problem of multi-step and lost step. The closed-loop drive can completely overcome the lost step of the open-loop stepping motor, and can also significantly improve the performance of the motor at high speed
108 stars 53 forks source link

Update oled.c to reduce possible interference with motor PWM harmonics #20

Open Quas7 opened 3 years ago

Quas7 commented 3 years ago

changed frequency from 0d80 (80) to 0x00 (0) to reduce speed for OLED communication in order to avoid motor PWM harmonics (EMI).

Also disccused here: https://github.com/bigtreetech/BIGTREETECH-S42B-V1.0/issues/16

Quas7 commented 3 years ago

The display issue seems to have two root-causes.

  1. 450-460kHz buck converter frequency
  2. Big Jitter on SPI-clock if SPI-data is transmitted

Regarding 1. increasing the F_OSC or internal clock of the OLED display seems to help. Regarding 2. the added NOPs to the SPI function clears the jitter issues.

Testing with a bigger sample size is now required.

Quas7 commented 3 years ago

testing by other contributers still showed issues with display glitches. A brute force re-init every 20sec is now my proposed measure of last resort.

Quas7 commented 3 years ago

changed re-init of OLED to ~60 seconds.