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

Automatic Motor Configuration #1

Open
TomTinkering opened this issue Jun 26, 2019 · 6 comments
Open

Automatic Motor Configuration #1

TomTinkering opened this issue Jun 26, 2019 · 6 comments

Comments

@TomTinkering
Copy link

TomTinkering commented Jun 26, 2019

This should be a pull request, but I can't figure out how to make one when I already have a heavily modified fork of the base repo (NiklasFauth). Guess I should make a branch?

Anyway:
I am using some old unknown motors with the new YST AT32 mainboard. The cabling colors and hall connectors don't match. In order to find the right configuration for the motors without having to change the wiring, I added CONTROL_DETECT_HALL and CONTROL_MOTOR_TEST control modes to the code (see this patch)

The way it works:

  1. Enable only the CONTROL_DETECT_HALL control mode definition in config.h
  2. Build/Flash/Run on the board. The board will step through all 6 possible hall configurations. You will hear a number of beeps, then the motors will spin or stall (see this video).
  3. For each motor, listen to the number of beeps (1-6), if after the beeps one or both of the motors start spinning smoothly (no noise), write down the number of beeps for this motor.
  4. Set the HALL_IDX_LEFT and HALL_IDX_RIGHT definitions in config.h to the number of beeps that showed smooth operation for the respective motor.
  5. Enable the CONTROL_MOTOR_TEST control mode definition in config.h
  6. Build/Flash/Run on the board. The board will spin the motors at a slow constant speed, as shown in this video.
  7. If motors are spinning in the wrong direction for your liking, set the respective INVERT_L_DIRECTION and INVERT_R_DIRECTION to get the motors to spin in the direction you want for positive control values. This video shows both motors spinning in the same direction.
  8. Build/Flash/Run on the board. The motors should now spin slowly in the desired directions.

Congratulations! You now know that your board works and that the motors are configured properly. From here you can start to implement/enable your control methods.

@cloidnerux
Copy link
Owner

I think there are not so many files and code that it is possible to manually merge them and continue from the same repo.

@EFeru
Copy link

EFeru commented Jun 28, 2019

Nice work!

@sjamthe
Copy link

sjamthe commented Jul 2, 2019

Hi Tom,

I am trying to use CONTROL_DETECT_HALL to test my motor connections but I hear no beeps and no motors are turning.
I have setup the #define CONTROL_DETECT_HALL in config.h

An I supposed to setup some non-zero values here to get this going?

motor_test_admin tst_admin = {0,0,1000/DELAY_IN_MAIN_LOOP,5,0,0};

thanks

@TomTinkering
Copy link
Author

Hey sjamte, you should not have to change the tst_admin settings. Are you hearing beeps when you start the board? This should happen whenever you power on, regardless of what control method you are using.

Two things that gave me some issues:

  • Power button was not wired -> this causes the board to shutdown immediately
  • DC current measurement was not on my board -> this overrides the PWM outputs

@sjamthe
Copy link

sjamthe commented Jul 2, 2019 via email

@sjamthe
Copy link

sjamthe commented Jul 3, 2019

Ignore above, My motors are moving with ADC control. So the above may just be some error I did while patching.

I was able to get AT32 chip working by patching openocd so it recognize the chip just like ST32. I didn't have J-link but it worked with ST-link by simply writing the hover.hex file.

Thanks all. Will post my code to my fork soon.

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

4 participants