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

MKS SBASE Set current issue #14

Closed
Lopezno68 opened this issue Apr 23, 2021 · 9 comments
Closed

MKS SBASE Set current issue #14

Lopezno68 opened this issue Apr 23, 2021 · 9 comments

Comments

@Lopezno68
Copy link

There is an error in the configuration of the motor current at routine "mks_set_current" in the file mks_sbase.c
The correct line is:
static const uint8_t wiper_registers[] = {0x00, 0x01, 0x06, 0x07};

@Lopezno68
Copy link
Author

MCP443X_commands

@terjeio
Copy link
Contributor

terjeio commented Apr 23, 2021

Oops, likely typo on my part. WIll commit a fix.

It will be great if you can verify that setting the current works as I do not have a MKS board for testing.

@Lopezno68
Copy link
Author

According to the MKS SBASE board schematic, it would also be more accurate if the current setting factor was 100.45f instead of 113.0f.

cmd [1] = (uint8_t) min (255.0f, roundf (current * 100.45f));

However, the current adjustment functionality works correctly. Nice work with the software, Terjeio

@terjeio
Copy link
Contributor

terjeio commented Apr 30, 2021

The Marlin driver uses 106.7 as the factor (AFAICT). The schematic I have specifies two different values for Rsense depending on the driver version (DRV8824 vs DRV8825) and R11 = 20K (with an asterix meaning that this might be different on the board?) in the BOM so for me it it is impossible to tell what is correct. So I'll change it to 100.45. I must say I am a bit curious about how you arrived at that factor though.

@Lopezno68
Copy link
Author

Yes, the R11 in my board (DRV8825) is exacty 20K. The Vref impedance in the DRV8825 is superior at 1M1 ohms, then, the Vpot drain current (at the cursor) is negligible. There are 4 50K potenciometers in parallel and with the R1 they are forming a voltage divisor to obtain 1.269 volts as reference for the 4 potenciometers. Applying electronic mathematics, the value for the potenciometer is Value=100.45 *Imotor.

Imotor calcs

I have measured it on my board with a voltmeter and the theory exactly matches the result.

@Lopezno68
Copy link
Author

it's good to be curious ...

@Lopezno68
Copy link
Author

An other correction. Sorry
20210501_173857

@terjeio
Copy link
Contributor

terjeio commented May 2, 2021

An other correction. Sorry

No problem.

I wonder if the factor should be multiplied with sqrt(2) to set the RMS value as it looks like the current from Equation 1 (in chapter 8.3.2) in the datasheet is the peak current. The Trinamic driver code I've seen does that. However, the Marlin documentation for digipots does not help in making that clear, not even for the Trinamic setting which I assume is the RMS current...

@terjeio
Copy link
Contributor

terjeio commented May 5, 2021

Fix committed with your factor.

@terjeio terjeio closed this as completed Jan 20, 2022
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

No branches or pull requests

2 participants