Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Quas7
Copy link

@Quas7 Quas7 commented Oct 5, 2020

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: #16

changed frequency from 0d80 (80) to 0x00 (0) to reduce speed for OLED communication in order to avoid motor PWM harmonics (EMI)
Use SWDO pin (silkscreen on PCB) of S42B communication pin header as active low signal to trigger endstop based on angular deviation.

Mind that connecting SWDIO to an endstop pin on the mainboard is a non-buffered direct connection to the STM32 controller on the S42B
Adjust the sensitivty for sensorless homing with #define sensorless_sensitivty. And generally do not home too fast during testing.

Also note that the repurposing of the SWDIO Pin (PA13) as sensorless homing endstop output might break the on-the-fly SWD programming.
Pressing RES(ET) on the S42B once and retry programming normally works fine. The triggering of the sensorless homing sensitivty threshold kills the on-the-fly SWD interface!).
If it does not, you will have to hold the RES(ET) button manually until "hla_swd" is shown during openOCD programming.
Releasing RES directly at this point will start the normal programming. Holding RES too long will result in a timeout.
Added sensorless homing functionality.
@Quas7
Copy link
Author

Quas7 commented Oct 27, 2020

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.

changed comment for OLED F_OSC selection
…to recover from any glitches.

Screen goes blank for one second during re-init.
@Quas7
Copy link
Author

Quas7 commented Oct 27, 2020

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.

with the optimized NOPs in the SPI handler, my testing shows a display issue after 3 days sitting on my bench. As the occurence seems to lowered now, a higher OLED_reset_counter value might be more appropriate, e.g. once per minute (300k) or even once per 10min (3mio).
@Quas7
Copy link
Author

Quas7 commented Nov 3, 2020

changed re-init of OLED to ~60 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant