EFeru / hoverboard-sideboard-hack-GD

Hoverboard sideboard hack for GD32 boards
GNU General Public License v3.0
110 stars 82 forks source link

Zero value and IMU failed #12

Open GMahmoud opened 3 years ago

GMahmoud commented 3 years ago

Hey @EmanuelFeru, I followed all the steps to get sideboard data (GD32F130C6T6 with MPU-6050A). I unlocked the board and got it flashed. However, when I monitored Euler value I got only zeros.

Command = e
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0

When I run a self-test, I get this result

accel: 319802219 -323885 134236467
gyro: -1743067344 1087314292 -1256236507
Gyro failed
Accel failed
Compass failed

Any idea what's causing this ? Thanks for your help Cheers πŸ˜ƒ

PS: After the flash, I have a steady green LED light.

EFeru commented 3 years ago

Strage, so you have gyro and accel but not DMP data. We need to debug further a bit, can you display the DEBUG output when you first power on the sideboard. It should say Configuring...writing DMP.. Ok And maybe place some printf(..) in the Euler angle calculation to see what happens.

GMahmoud commented 3 years ago

Hello @EmanuelFeru, Thanks for your answer

I confirm I am getting the Ok message after the configuration (see attached logs)

However, I looked a bit in your code to add some printfs. I did not focus on euler angle only as these are computed from quaternions which are zeros as well. I added some log to dmp_read_fifo function that computes quaternions and it's returning -1 because of mpu_read_fifo_stream. In this function I found that variable fifo_count is usually equal to 0 as well as tmp array (see debug printf in the logs)

Could you help me please to debug i2c_read function ?

--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Configuring MPU6050...  writing DMP...  OK
=== HELP ===
h: Print Help
x: Print Serial AUX
8: Set Accelerometer on/off
9: Set Gyroscope on/off
r: Print Registers
a: Print Accelerometer
g: Print Gyroscope
q: Print Quaternion
e: Print Euler angles in deg*100
t: Print Temperature in degC*100
p: Print Pedometer
0: Reset Pedometer
1: Set DMP/MPU freq 10 Hz
2: Set DMP/MPU freq 50 Hz
3: Set DMP/MPU freq 100 Hz
,: Set DMP interrupt to gesture
.: Set DMP interrupt to continuous
f: Set DMP on/off
v: Set Quaternion on/off
w: Test low-power accel mode
s: Run self-test (device must be facing up or down)
============
DEBUG: fifo_count: 0, length: 32, tmp[0]: 0, tmp[1]: 0
Command = e
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Roll:0 Pitch:0 Yaw:0
Command = e
Command = q
qW:0 qX:0 qY:0 qZ:0
qW:0 qX:0 qY:0 qZ:0
qW:0 qX:0 qY:0 qZ:0
qW:0 qX:0 qY:0 qZ:0
qW:0 qX:0 qY:0 qZ:0
qW:0 qX:0 qY:0 qZ:0
qW:0 qX:0 qY:0 qZ:0
qW:0 qX:0 qY:0 qZ:0
qW:0 qX:0 qY:0 qZ:0
qW:0 qX:0 qY:0 qZ:0
Command = q

Cheers

GMahmoud commented 3 years ago

Other question: Do you have any idea what the difference between MPU-6050 and MPU-6050A is ?

EFeru commented 3 years ago

Not sure about the difference, but it could be a reason why is the DMP and angles not working. Because the quaternion is zero for you. I am thinking.. could it be that the DMP firmware is different. I think we need to investigate it.

2com68 commented 3 years ago

Hello. I have a question about the hoverboard-sideboard-hack-GD project. I plan to use your firmware to upgrade a small electric car. With wheels and a gyro-scooter motherboard. To run two wheels, do I have to install the firmware on the two side boards? Or do you need to connect one side board from both sides to the motherboard? I need the central motherboard to be able to be controlled by an adult via a car model receiver. And to be able to control the pedal with a hall sensor. Will this firmware be able to implement such management?

EFeru commented 3 years ago

Are you sure you have the same sideboards? Because I have a feeling that you have gen2 boards. If yes, it will not work with this firmware you have to use https://github.com/flo199213/Hoverboard-Firmware-Hack-Gen2 This firmware is for the sideboards of gen1 boards, where the 2 motors are driven from one mainboard

2com68 commented 3 years ago

Π’Ρ‹ ΡƒΠ²Π΅Ρ€Π΅Π½Ρ‹, Ρ‡Ρ‚ΠΎ Ρƒ вас Ρ‚Π°ΠΊΠΈΠ΅ ΠΆΠ΅ сСрванты? ΠŸΠΎΡ‚ΠΎΠΌΡƒ Ρ‡Ρ‚ΠΎ Ρƒ мСня Ρ‚Π°ΠΊΠΎΠ΅ ΠΎΡ‰ΡƒΡ‰Π΅Π½ΠΈΠ΅, Ρ‡Ρ‚ΠΎ Ρƒ вас ΠΏΠ»Π°Ρ‚Ρ‹ Gen2. Если Π΄Π°, ΠΎΠ½Π° Π½Π΅ Π±ΡƒΠ΄Π΅Ρ‚ Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ с этой ΠΏΡ€ΠΎΡˆΠΈΠ²ΠΊΠΎΠΉ, Π²Ρ‹ Π΄ΠΎΠ»ΠΆΠ½Ρ‹ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ https://github.com/flo199213/Hoverboard-Firmware-Hack-Gen2 Π­Ρ‚Π° ΠΏΡ€ΠΎΡˆΠΈΠ²ΠΊΠ° ΠΏΡ€Π΅Π΄Π½Π°Π·Π½Π°Ρ‡Π΅Π½Π° для Π±ΠΎΠΊΠΎΠ²Ρ‹Ρ… ΠΏΠ°Π½Π΅Π»Π΅ΠΉ ΠΏΠ»Π°Ρ‚ Gen1, Π³Π΄Π΅ 2 двигатСля приводятся Π² дСйствиС с ΠΎΠ΄Π½ΠΎΠΉ матСринской ΠΏΠ»Π°Ρ‚Ρ‹.

Hello. I have a Gen1 (photo attached) where two motors are powered by a single motherboard. For my purpose, I need control via the receiver and the RC remote control (photo attached). And also to be able to switch to the control from the pedal (photo attached). Pedal with hall sensor. ЗдравствуйтС. Π£ мСня Gen1 (Ρ„ΠΎΡ‚ΠΎ ΠΏΡ€ΠΈΠΊΡ€Π΅ΠΏΠΈΠ»), Π³Π΄Π΅ Π΄Π²Π° двигатСля приводятся Π² дСйствиС ΠΎΠ΄Π½ΠΎΠΉ матСринской ΠΏΠ»Π°Ρ‚ΠΎΠΉ. Для ΠΌΠΎΠ΅ΠΉ Ρ†Π΅Π»ΠΈ Π½ΡƒΠΆΠ½ΠΎ ΡƒΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ Ρ‡Π΅Ρ€Π΅Π· ΠΏΡ€ΠΈΠ΅ΠΌΠ½ΠΈΠΊ ΠΈ ΠΏΡƒΠ»ΡŒΡ‚ RC (Ρ„ΠΎΡ‚ΠΎ ΠΏΡ€ΠΈΠΊΡ€Π΅ΠΏΠΈΠ»). А Ρ‚Π°ΠΊ ΠΆΠ΅ Ρ‡Ρ‚ΠΎ Π±Ρ‹ Π±Ρ‹Π»Π° Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π°Ρ‚ΡŒΡΡ Π½Π° ΡƒΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ с ΠΏΠ΅Π΄Π°Π»ΠΈ (Ρ„ΠΎΡ‚ΠΎ ΠΏΡ€ΠΈΠΊΡ€Π΅ΠΏΠΈΠ»). ПСдаль с Π΄Π°Ρ‚Ρ‡ΠΈΠΊΠΎΠΌ Ρ…ΠΎΠ»Π»Π°.

the pedal 20210113_162008 20210113_162036 Gyro scooter

2com68 commented 3 years ago

ЗдравствуйтС. Π£ мСня Π΅ΡΡ‚ΡŒ Gen1 (Ρ„ΠΎΡ‚ΠΎ прилагаСтся), Π³Π΄Π΅ Π΄Π²Π° двигатСля ΠΏΠΈΡ‚Π°ΡŽΡ‚ΡΡ ΠΎΡ‚ ΠΎΠ΄Π½ΠΎΠΉ матСринской ΠΏΠ»Π°Ρ‚Ρ‹. Для ΠΌΠΎΠΈΡ… Ρ†Π΅Π»Π΅ΠΉ ΠΌΠ½Π΅ Π½ΡƒΠΆΠ½ΠΎ ΡƒΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ Ρ‡Π΅Ρ€Π΅Π· рСсивСр ΠΈ ΠΏΡƒΠ»ΡŒΡ‚ дистанционного управлСния (Ρ„ΠΎΡ‚ΠΎ прилагаСтся). А Ρ‚Π°ΠΊΠΆΠ΅ ΠΈΠΌΠ΅Ρ‚ΡŒ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π°Ρ‚ΡŒΡΡ Π½Π° ΡƒΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ с ΠΏΠ΅Π΄Π°Π»ΠΈ (Ρ„ΠΎΡ‚ΠΎ прилагаСтся). ПСдаль с Π΄Π°Ρ‚Ρ‡ΠΈΠΊΠΎΠΌ Ρ…ΠΎΠ»Π»Π°. ЗдравствуйтС. Π£ мСня Gen1 (Ρ„ΠΎΡ‚ΠΎ ΠΏΡ€ΠΈΠΊΡ€Π΅ΠΏΠΈΠ»), Π³Π΄Π΅ Π΄Π²Π° двигатСля приводятся Π² дСйствиС ΠΎΠ΄Π½ΠΎΠΉ матСринской ΠΏΠ»Π°Ρ‚ΠΎΠΉ. Для ΠΌΠΎΠ΅ΠΉ Ρ†Π΅Π»ΠΈ Π½ΡƒΠΆΠ½ΠΎ ΡƒΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ Ρ‡Π΅Ρ€Π΅Π· ΠΏΡ€ΠΈΠ΅ΠΌΠ½ΠΈΠΊ ΠΈ ΠΏΡƒΠ»ΡŒΡ‚ RC (Ρ„ΠΎΡ‚ΠΎ ΠΏΡ€ΠΈΠΊΡ€Π΅ΠΏΠΈΠ»). А Ρ‚Π°ΠΊ ΠΆΠ΅ Ρ‡Ρ‚ΠΎ Π±Ρ‹ Π±Ρ‹Π»Π° Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π°Ρ‚ΡŒΡΡ Π½Π° ΡƒΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ с ΠΏΠ΅Π΄Π°Π»ΠΈ (Ρ„ΠΎΡ‚ΠΎ ΠΏΡ€ΠΈΠΊΡ€Π΅ΠΏΠΈΠ»). ПСдаль с Π΄Π°Ρ‚Ρ‡ΠΈΠΊΠΎΠΌ Ρ…ΠΎΠ»Π»Π°.

ΠŸΠΎΠ΄ΡΠΊΠ°ΠΆΠΈΡ‚Π΅, ΠΊΠ°ΠΊΠΈΠ΅ я Π΄ΠΎΠ»ΠΆΠ΅Π½ ΡΠΎΠ²ΠΌΠ΅ΡΡ‚ΠΈΡ‚ΡŒ ΠΏΡ€ΠΎΡˆΠΈΠ²ΠΊΠΈ для получСния Ρ‚Π°ΠΊΠΎΠ³ΠΎ управлСния? Π― Π½Π΅ Π³ΠΎΠ²ΠΎΡ€ΡŽ Π½Π° английском, ΠΏΠ΅Ρ€Π΅Π²ΠΎΠΆΡƒ Ρ‡Π΅Ρ€Π΅Π· Google c Русского Π½Π° Английский. ΠŸΠ΅Ρ€Π΅Π²ΠΎΠ΄ ΠΌΠΎΠΆΠ΅Ρ‚ Π½Π΅ΠΊΠΎΡ€Ρ€Π΅ΠΊΡ‚Π½Ρ‹ΠΌ. Π‘ΠΊΠ°ΠΆΠΈΡ‚Π΅ Ссли Ρ‡Ρ‚ΠΎ-Ρ‚ΠΎ Π±ΡƒΠ΄Π΅Ρ‚ Π½Π΅ понятно Π² вопросС. ΠŸΠΎΠΏΡ€ΠΎΠ±ΡƒΡŽ ΡΡ„ΠΎΡ€ΠΌΡƒΠ»ΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ ΠΈΠ½Π°Ρ‡Π΅ ΠΈ Π΄ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ ΠΊΠ°Ρ€Ρ‚ΠΈΠ½ΠΎΠΊ. Tell me, what should I combine the firmware to get such control? I do not speak English, I translate through Google from Russian to English. The translation may be incorrect. Tell me if something is unclear in the question. I will try to formulate it differently and add pictures.

EFeru commented 3 years ago

@2com68 seems like you have the normal supported board. From what I understand you need the Hovercar variant. This works with using the mainboard and one sideboard connected to the Right (short cable). Schematic:

Mainboard firmware:

Sideboard firmware:

2com68 commented 3 years ago

Hello. Thank you for the information. I will study it. I hope I'll figure it out by the summer. Just got a question. The process of turning on the reverse can only be done by double pressing the brake pedal? Or can I turn off the brake pedal? Do the reverse through the switch?

EFeru commented 3 years ago

I didn't test myself, but theory says the reverse should engage with a switch by double pressing as replacement to Brake pedal. However, if you want to be sure you can implement a very easy if else based on the switch.

2com68 commented 3 years ago

Π― Π½Π΅ провСрял сСбя, Π½ΠΎ тСория гласит, Ρ‡Ρ‚ΠΎ Π·Π°Π΄Π½ΠΈΠΉ Ρ…ΠΎΠ΄ Π΄ΠΎΠ»ΠΆΠ΅Π½ Π²ΠΊΠ»ΡŽΡ‡Π°Ρ‚ΡŒΡΡ ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π°Ρ‚Π΅Π»Π΅ΠΌ Π΄Π²ΠΎΠΉΠ½Ρ‹ΠΌ Π½Π°ΠΆΠ°Ρ‚ΠΈΠ΅ΠΌ вмСсто ΠΏΠ΅Π΄Π°Π»ΠΈ Ρ‚ΠΎΡ€ΠΌΠΎΠ·Π°. Однако, Ссли Π²Ρ‹ Ρ…ΠΎΡ‚ΠΈΡ‚Π΅ Π±Ρ‹Ρ‚ΡŒ ΡƒΠ²Π΅Ρ€Π΅Π½Ρ‹, Ρ‡Ρ‚ΠΎ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ Ρ€Π΅Π°Π»ΠΈΠ·ΠΎΠ²Π°Ρ‚ΡŒ ΠΎΡ‡Π΅Π½ΡŒ простой if else Π½Π° основС ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π°Ρ‚Π΅Π»Ρ.

Hello. I didn't quite understand what to do. Tell me please. Need to edit something in the firmware? To implement the reverse through the switch? The photo shows an example of a switch. Or should I plug in a switch instead of a pedal, without changing anything in the firmware? ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π°Ρ‚Π΅Π»ΡŒ 1 ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π°Ρ‚Π΅Π»ΡŒ 2 ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π°Ρ‚Π΅Π»ΡŒ

Candas1 commented 3 years ago

Other question: Do you have any idea what the difference between MPU-6050 and MPU-6050A is ?

Hi, I also have a some boards with mpu6050a, maybe we can collaborate. Have you made any progress in the meantime? We can chat if you are in the telegram group

GMahmoud commented 3 years ago

@Candas1 With pleasure, I was quite busy lately to debug more about this issue. A question: Did you get the same problem with your board ? I am not in the telegram group, but we could chat in it if you could please explain to me how to join 😸

Cheers

Candas1 commented 3 years ago

Yes. All seems OK but I don't get DMP data. If I disable DMP in config.h I can at least see accelerometer and gyro data.

Here is the link to the hoverboard telegram group: https://t.me/joinchat/BHWO_RKu2LT5ZxEkvUB8uw

My nickname is Candas there

2com68 commented 3 years ago

@ 2com68 ΠΏΠΎΡ…ΠΎΠΆΠ΅ Ρƒ вас Π½ΠΎΡ€ΠΌΠ°Π»ΡŒΠ½Π°Ρ поддСрТиваСмая ΠΏΠ»Π°Ρ‚Π°. Насколько я понимаю, Π²Π°ΠΌ Π½ΡƒΠΆΠ΅Π½ Π²Π°Ρ€ΠΈΠ°Π½Ρ‚ Hovercar. Π­Ρ‚ΠΎ Ρ€Π°Π±ΠΎΡ‚Π°Π΅Ρ‚ с использованиСм матСринской ΠΏΠ»Π°Ρ‚Ρ‹ ΠΈ ΠΎΠ΄Π½ΠΎΠΉ Π±ΠΎΠΊΠΎΠ²ΠΎΠΉ ΠΏΠ°Π½Π΅Π»ΠΈ, ΠΏΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π΅Π½Π½ΠΎΠΉ справа (ΠΊΠΎΡ€ΠΎΡ‚ΠΊΠΈΠΉ кабСль). Π‘Ρ…Π΅ΠΌΠ°:

ΠŸΡ€ΠΎΡˆΠΈΠ²ΠΊΠ° матСринской ΠΏΠ»Π°Ρ‚Ρ‹:

  • РаскоммСнтируйтС VARIANT_HOVERCAR Π² platformio.ini, собСритС ΠΈ ΠΏΡ€ΠΎΡˆΠ΅ΠΉΡ‚Π΅

ΠŸΡ€ΠΎΡˆΠΈΠ²ΠΊΠ° сСрванта:

  • РаскоммСнтируйтС VARIANT_HOVERCAR Π² platformio.ini, собСритС ΠΈ ΠΏΡ€ΠΎΡˆΠ΅ΠΉΡ‚Π΅

Hello. I downloaded the firmware from the specified link. As I understand it, the automatic calibration of the handles is disabled by default? Tell me what changes I should make to enable automatic calibration. At what point do I need to make changes to connect the side board and get i-bus control? I built the firmware without making any changes. I installed the firmware in the motherboard and side board. The motherboard is turned on, but you can't turn on auto-calibration mode.