makerbase-mks / MKS-SERVO42B

MKS SERVO42B is 3d printer closed loop stepper motor NEMA17 MKS SERVO42 developed by Makerbase that prevents losing steps. CPU is STM32F103C8T6 ARM 32-bit Cortex™-M3 CPU Core,72 MHz. Magnetic encoder is Allegro's A1333LLETR-T Contactless 0° to 360° angle sensor IC ,12bit .This Project open source hardware and code,support platformio build and upload firmware...
https://www.aliexpress.com/item/33032696338.html?spm=a2g0o.store_home.productList_8356958.pic_1
GNU General Public License v3.0
166 stars 70 forks source link

More flexible settings for Vref sine table. A1333 driver extensions. #21

Closed dzid26 closed 1 year ago

dzid26 commented 3 years ago

+Improved resolution of sine_table values - superseeds "intentions" of this PR https://github.com/makerbase-mks/MKS-SERVO42B/pull/20 +ability to adjust final Vref PWM resolution and frequency using VREF_SCALER (greater value = less resolution but higher PWM freq and less hissing noise). VREF_SCALER=6 is equivalent to original code (32767>>6=511). +Added Extended write/read feature to A1333 driver (ability to set on-chip hysteresis/filtering, etc). +Improved A1333 sequential angle read implementation.

mks-viva commented 3 years ago

I think you did a very good job, we will test it, but I need to confirm a few points

  1. 20 is not the best way to deal with it?

  2. Is the mute effect of the current #21 program running on 42B significantly improved?
dzid26 commented 3 years ago

@mks-viva

  1. I am having trouble understand intention of the #20. He just pasted the code from misfitTech that is not doing anything and isn't compatible with your implementation even (and it wasn't a dead code anyway). He probably just had a placebo effect of seeing any difference. I don't understand what was the issue there in the first place. The original code controls position fine.

  2. The muting affects high frequencies only > 15kHz, so some people may not even hear it at all. It wasn't that loud originally. To be honest I am not sure why this small hissing noise is there in the first place as the PWM runs at much higher frequency 140kHz. I am guessing it's harmonics. Setting VREF_SCALER to 7, 8 or 9 reduces the hissing without noticable effect of lower current resolution. Looking at volume levels I crudely measured with my phone, it seem it is quieter by 20dB at 19kHz peak.

This shows the higher frequency can reduce hissing and is adjustable via VREF_SCALER.

lonelymyp commented 3 years ago

@mks-viva @dzid26 about 1. that's where I made an assumption about how this code should look. https://github.com/makerbase-mks/MKS-SERVO42B/pull/20