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

ADC variant does not work...troubleshooting? #136

Closed
epikao opened this issue Jan 29, 2021 · 27 comments
Closed

ADC variant does not work...troubleshooting? #136

epikao opened this issue Jan 29, 2021 · 27 comments

Comments

@epikao
Copy link

epikao commented Jan 29, 2021

Hello,

I ordered two hover electronics boards as shown on the Emanuel front page via Aliexpress + a Nunchuck controller.

With the Nunchuck controller, reverse and forward does not work cleanly. If I push the joystick backwards or forwards, the motor (both) turns mostly in the right direction but not always, and that only one motor turns somehow does not work with the joystick.

I have now programmed the board with the ADC variant, but unfortunately here nothing works.
Interestingly, I have both variants no sound from the buzzer, is that normal?

I just do not know where to look for the error? The board can be switched on, at least an LED lights up.

Or are these Aliexpress boards defective?

Would appreciate any hints.

Many thanks

@Candas1
Copy link
Collaborator

Candas1 commented Jan 29, 2021

Do you have a picture or link of the board just in case ?
Not having sound is weird... Could be that the board is little different.

There are little instructions in the wiki

@epikao
Copy link
Author

epikao commented Jan 29, 2021

thanks for your reply. See attached pictures.
20210129_191654
20210129_191713
20210129_191722

I'm meaning the below board

@epikao
Copy link
Author

epikao commented Jan 29, 2021

@epikao
Copy link
Author

epikao commented Jan 29, 2021

I uploaded the generated firmware.bin file via ST-Link software. The build I done with vscode/plio

I used following programmer (connecting all 4 wires, 3.3V, GND, SWDIO, SWDCLK, no additional supply needed)
https://m.de.aliexpress.com/item/32887597480.html?spm=a2g0n.productlist.0.0.545b1d9eFaVGJt&browser_id=7202ab4dfa5f49118f96b418094abfb2&aff_trace_key=&aff_platform=msite&m_page_id=00cbgdl5n3ycavtj1774f6b6a9b888f434b1012216&gclid=&_imgsrc_=ae01.alicdn.com%2Fkf%2FH5745ef2282db4fa68c54ef489caa9657n.jpg_640x640Q90.jpg_.webp

@EFeru
Copy link
Owner

EFeru commented Jan 29, 2021

@epikao Seems like you have a slightly different board version, at least at this middle location:
yours:
image
vs. mine:
image

The coil is a different location. And I am sure because you don't hear the beep and melody, some pins are also changed.
With a multimeter can you identify if your pins are corresponding to defines.h?

If not, then you need to do a small exercise to update the pins similar to here (but with your pins of course).

@Candas1
Copy link
Collaborator

Candas1 commented Jan 29, 2021

OK I was too slow and Emanuel replied ah ah
Yes we expect PA4, on some boards it's mapped to PC13, but those boards had other differences as well.

You can also program directly from vscode/platformio.
To debug ADC you can use serial debug

@EFeru
Copy link
Owner

EFeru commented Jan 29, 2021

Luckily, I was around this time :P

@epikao
Copy link
Author

epikao commented Jan 29, 2021

many thanks, I'm checking all that now. But some more questions:

Does the controller send always some data over the serial? Till now I didn't had success to receive anything.. I'm also not sure if I need the battery power for that, or if only supply over my programmer is enough. With supply of programmer and no battery power the LED switches directly on, so the on/off switch has no function.
The buzzer is connected via transistor Q6 and Resistor R56 to PA4, so this connection should be according default code, but still no sound. I think the buzzer only works with battery supply because of VSW = 15V? Anyway also with battery supply no sound. Looks I must measure the signal output of PA4....

Edit:
I got now following from serial debug:

a normal pota normal potin1:414 in2:44 cmdL:1 cmdR:-1 BatADC:93 BatV:3538 TempADC:1685 Temp:300
in1:413 in2:45 cmdL:55 cmdR:-37 BatADC:93 BatV:3440 TempADC:1685 Temp:300
in1:412 in2:43 cmdL:59 cmdR:-41 BatADC:93 BatV:3376 TempADC:1685 Temp:300
-- Motors disabled --

Edit2:

below serial debug log with battery power, but no motor/ hall sensor connected:

a normal pota normal potin1:2087 in2:2047 cmdL:3 cmdR:1 BatADC:1461 BatV:3985 TempADC:1711 Temp:249
in1:2092 in2:2046 cmdL:626 cmdR:204 BatADC:1448 BatV:3983 TempADC:1711 Temp:249
in1:2089 in2:2041 cmdL:743 cmdR:240 BatADC:1461 BatV:3980 TempADC:1711 Temp:249
in1:2086 in2:2043 cmdL:752 cmdR:243 BatADC:1461 BatV:3977 TempADC:1711 Temp:249
in1:2089 in2:2043 cmdL:752 cmdR:243 BatADC:1461 BatV:3975 TempADC:1711 Temp:249
in1:2089 in2:2045 cmdL:752 cmdR:243 BatADC:1461 BatV:3972 TempADC:1711 Temp:249
in1:2093 in2:2044 cmdL:752 cmdR:243 BatADC:1461 BatV:3972 TempADC:1711 Temp:249
in1:2090 in2:2047 cmdL:753 cmdR:243 BatADC:1461 BatV:3970 TempADC:1711 Temp:249
in1:2091 in2:2046 cmdL:752 cmdR:243 BatADC:1460 BatV:3967 TempADC:1710 Temp:251
in1:2088 in2:2047 cmdL:752 cmdR:243 BatADC:1460 BatV:3964 TempADC:1710 Temp:251
in1:2090 in2:2040 cmdL:752 cmdR:243 BatADC:1434 BatV:3962 TempADC:1710 Temp:251
in1:2090 in2:2042 cmdL:753 cmdR:243 BatADC:1460 BatV:3962 TempADC:1709 Temp:253
in1:2091 in2:2046 cmdL:753 cmdR:244 BatADC:1461 BatV:3959 TempADC:1709 Temp:253
in1:2089 in2:2041 cmdL:752 cmdR:243 BatADC:1461 BatV:3956 TempADC:1709 Temp:253
in1:2091 in2:2048 cmdL:752 cmdR:243 BatADC:1461 BatV:3954 TempADC:1709 Temp:253
in1:2088 in2:2047 cmdL:753 cmdR:243 BatADC:1461 BatV:3954 TempADC:1708 Temp:255
in1:2091 in2:2047 cmdL:752 cmdR:243 BatADC:1461 BatV:3951 TempADC:1708 Temp:255
in1:2089 in2:2047 cmdL:752 cmdR:243 BatADC:1460 BatV:3948 TempADC:1708 Temp:255
in1:2089 in2:2040 cmdL:752 cmdR:243 BatADC:1460 BatV:3948 TempADC:1708 Temp:255
in1:2094 in2:2042 cmdL:752 cmdR:243 BatADC:1439 BatV:3946 TempADC:1708 Temp:255
in1:2095 in2:2044 cmdL:752 cmdR:243 BatADC:1439 BatV:3943 TempADC:1708 Temp:255
in1:2090 in2:2044 cmdL:753 cmdR:244 BatADC:1461 BatV:3943 TempADC:1707 Temp:257
in1:2092 in2:2041 cmdL:753 cmdR:243 BatADC:1461 BatV:3940 TempADC:1707 Temp:257
in1:2092 in2:2047 cmdL:752 cmdR:243 BatADC:1461 BatV:3940 TempADC:1707 Temp:257
in1:2090 in2:2043 cmdL:752 cmdR:243 BatADC:1460 BatV:3938 TempADC:1707 Temp:257
in1:2090 in2:2045 cmdL:752 cmdR:243 BatADC:1461 BatV:3938 TempADC:1707 Temp:257
in1:2090 in2:2044 cmdL:752 cmdR:243 BatADC:1460 BatV:3935 TempADC:1707 Temp:257
in1:2093 in2:2045 cmdL:752 cmdR:243 BatADC:1460 BatV:3935 TempADC:1707 Temp:257
in1:2095 in2:2046 cmdL:752 cmdR:243 BatADC:1440 BatV:3932 TempADC:1707 Temp:257
-- Motors disabled --

Edit3:
range of in1 and in2 is between 0 and 4095, so I think the Poti detection should work correctly.

@epikao
Copy link
Author

epikao commented Jan 29, 2021

oh Buzzer looks is connected at PA6 not PA4, is that a problem?

crazy :-( , I changed to PIN_6, and still no sound....

image

@Candas1
Copy link
Collaborator

Candas1 commented Jan 29, 2021

Motors are not spinning for safety reasons at startup if cmdL and cmdR are not within -50 to +50 range.
You have to do input calibration .

@epikao
Copy link
Author

epikao commented Jan 29, 2021

Motors are not spinning for safety reasons at startup if cmdL and cmdR are not within -50 to +50 range.
You have to do input calibration .

ok, I will test this later, now I first want make work this buzzer.
I took my second board, here I found out that with original firmware, the buzzer works fine, and also with programmer supply only. That is strange, because according schematic the buzzer should be connected to VSW, and this is also the case on my board.
After uploading with the Firmware from this side, no more sound... hmm maybe something with the frequency.

Edit:

with the second board the buzzer works now, but at PA4

@Candas1
Copy link
Collaborator

Candas1 commented Jan 29, 2021

Hmm weird, is it a problem on the first board.

@epikao
Copy link
Author

epikao commented Jan 29, 2021

so yes, something at the buzzer is defective on my first board.

With the second board buzzer works, and motor are spinning, but both motor spins always together. I couldn't find a position where the one motor stops and the other one is spinning... why that?

And I also not understand that even buzzer is connected at PA6 it works if Software is set at default PA4...

@Candas1
Copy link
Collaborator

Candas1 commented Jan 29, 2021

It's not a "tank" style mixing.

image

@epikao
Copy link
Author

epikao commented Jan 29, 2021

ok, but I also couldn't find a position where both motor are spinning in the same direction, always spinning in opposite... but will check tomorrow again more carefully. Thanks for your great support.

@EFeru
Copy link
Owner

EFeru commented Jan 30, 2021

Making the buzzer work is a confirmation that the interrupt for motor control is working correctly. So it's a good idea to fix the issue.

Are you sure the buzzer pin is correct? And what chip do you have?
Check buzzer for continuity? Did the board work with factory firmware before you flashed the chip? I always do one check with new boards just to avoid surprises.

@epikao
Copy link
Author

epikao commented Jan 30, 2021

Making the buzzer work is a confirmation that the interrupt for motor control is working correctly. So it's a good idea to fix the issue.

Are you sure the buzzer pin is correct? And what chip do you have?
Check buzzer for continuity? Did the board work with factory firmware before you flashed the chip? I always do one check with new boards just to avoid surprises.

Thanks! First board with original firmware I can not remember that there was sound from the buzzer, but with my second board. So the buzzer electronics on the first board must have a defect somewhere. The confusion regarding PA4, PA6, was because I checked the wrong controller datasheet.

Unfortunately, I still don't fully understand the spinning behavior of the motors in combination with the states of the ADC inputs:

Following my setup and findings. I never had a state where both motors are spinning in the same direction... also I not understand why some input states make motor not spinning very smoth or very slow, or beep, and sometimes stopping...

image
image
image

@vamfun
Copy link

vamfun commented Jan 30, 2021

That is a mystery... Best thing to do is uart print cmd1 and cmd2 to see if they agree with your motor movement. I think your setup will introduce a lot of noise into the ADC which may account for some of the roughness. Try grounding all inputs as close to the input plug as possible then run a debug with that input. Also what steer/speed blending are you using?
How did you specify the type of input...1,2 or 3? Did you enter autocal?
Maybe use the new repository , comment out auto cal enable , then start with a full erase to make sure auto cal values are not affecting your inputs. Set your type as 2 and see what you get.

@epikao
Copy link
Author

epikao commented Jan 30, 2021

Also what steer/speed blending are you using?
How did you specify the type of input...1,2 or 3? Did you enter autocal?

I did the autocal, but not more, I also not study the other setups, just download the newest code from this respository, build ADC variant and upload... so all other setups should be still default. I was hopping that default should work, but it looks I must study now your mentioned other parameter, and I will record the UART output and maybe do again an autocal...

@epikao
Copy link
Author

epikao commented Jan 30, 2021

Also what steer/speed blending are you using?

And what do you mean with that? I'm using 0V, 3.3V and two 33K resistors to each input do genarate 1.65 V (MID), see setup above.

But yes, maybe my wirings are too long, especially the 3.3V...

@vamfun
Copy link

vamfun commented Jan 30, 2021

As I understand it, the default blend is x.5 on steering (blue adc1) and x1 on speed (green adc2) so if green is 1 or -1 the blue cannot cause a reversal until green is at mid. But this doesn't explain your table. The shutdowns were probably caused by emergency shutdown due to exceeding the ADC timeout count (indicated by beeps) due to high level of noise.
I would also guess that you may need to reverse a hall sensor lead (or change direction in sw) to get motors running in same direction.

@EFeru
Copy link
Owner

EFeru commented Jan 30, 2021

@epikao, for testing purposes I think is easier to use 2 potentiometers and remove the 33k resistors. Because auto-calibration requires that you move the potis thorough the whole range.

And if your motors act roughly it could be that 2 of the motors phases are swapped. Sometimes the colors don't match. Swap the phases and give a try with low input.

Overall to get the ADC variant running it should be:

  • prepare your hardware, connect potis, etc.
  • full chip erase
  • flash ADC variant
  • run auto calibration
  • the motors should run

@epikao
Copy link
Author

epikao commented Feb 1, 2021

I would also guess that you may need to reverse a hall sensor lead (or change direction in sw) to get motors running in same direction.

besides EMC, I think this is the main problem.
I have currently already tried different motor phase connection combinations - unfortunately still without success.

Do I have to try the Hall connections as well? Can I not either or? So Hall or motor phases ? It is easier to change the motor phases. Maybe I should also check if the Hall-Sensors are not connected on other pins... but I think then the motor would not spins...

What is the easiest way to find the right combination? Try and error? I could also open the motor cover....

@EFeru
Copy link
Owner

EFeru commented Feb 2, 2021

I think try and error is the easiest. The other way is to use an oscilloscope and log back-emf voltage with Hall sensors. The should match the motor mapping.
However, from what I heard until now just inter-changing motor phases to find the right combination was sufficient. I didn't hear yet that Hall sensors need to be inter-changed... but I don't exclude it.

@epikao
Copy link
Author

epikao commented Feb 5, 2021

ok thanks, I couldn't find a combination that works...(I tested with the Nunchuck Variant, with 15V to 3.3V regulator between). At some combination the motor started without touching the Nunchuck, often with very strong shaking. Crazy. Could it be that the mosfetdriver maybe are some on the wrong GPIO's ? I fear that I must now check the whole PIN assignment...

@epikao
Copy link
Author

epikao commented Feb 7, 2021

I think, I've found the problem. The hall wires Left, are connected to motor phase Left Hi, and so one, so something is swapped and not according pin assignment....

Edit: Unfortunately, the pin assignment is correct, I did a mistake by counting the pin's. So now I'm lost what the failure could be... (always also erased the IC with STLink)

@Candas1
Copy link
Collaborator

Candas1 commented Feb 15, 2021

Can you record a video of how it behaves ?

@EFeru EFeru closed this as completed Jul 24, 2021
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