RoboDurden / Hoverboard-Firmware-Hack-Gen2.x

with different defines_2-x.h for different board layouts :-) Compiles with Keil version 6
GNU General Public License v3.0
81 stars 27 forks source link

Gen2.1.20 : ClassyWalk: Motor does not spin, can't detect SELF_HOLD, BUTTON, and hall order #90

Open hoverboardhavoc opened 3 weeks ago

hoverboardhavoc commented 3 weeks ago

This board from Classy Walk hoverboard and has a GD32F130, FORTIOR FD6287T GA1015 and a NCE01P13K 1PKL2. It's marked with OLSZ 0L20190703-V4.1

Master

P_20240825_205058 P_20240825_204702

Slave

P_20240825_230627 P_20240825_230609

Config

The hall order was not detected by autoconfig (see below). Every combination of HALL_A, HALL_B and HALL_C have been tested with every combination of the detected hall pins, PA1, PC13 and PC14. None of them make the motor turn forwards and backwards using REMOTE_DUMMY.

#ifndef DEFINES_2_x_H
#define DEFINES_2_x_H

//#define SINGLE
//#define MASTER_OR_SINGLE

#ifdef MASTER_OR_SINGLE     // layout 2.2 and 2.7 have buzzer on the slave board.
    #define HAS_BUZZER
#endif

// add autodetect #defines below and rename to defines_2-xy.h
// then add another
//  #elif LAYOUT == xy
//      #include "defines_2-xy.h"       // https://github.com/RoboDurden/Hoverboard-Firmware-Hack-Gen2.x/issues/40
// to defines.h and set #define LAYOUT xy in config.h in your chosen GD32E230/MM32SPIN05/GD32F103/GD32F130 target section

// autodetect 2.13 as example only !!!!!!!!!!!!!!!!!!!!!!! begin

// PC13, PC14, PA1
// PC13, PA1, PC14 // Spins smooth one way
// PC14, PC13, PA1
// PC14, PA1, PC13
// PA1, PC13, PC14
// PA1, PC14, PC13

#define HALL_A          PC13
#define HALL_B          PA1
#define HALL_C          PC14

//#define PHASE_A       PB0 // This was detected
//#define PHASE_B       PB1 // This was not detected
//#define PHASE_C       P_UNKOWN

#define LED_RED         PB4
//#define LED_ORANGE            P??
#define LED_GREEN               PB3
#define UPPER_LED               PB2
#define LOWER_LED               PB5
//#define ONBOARD_LED           P??
#define BUZZER          PB9

#define VBATT           PA4
#define CURRENT_DC              PA0 
//#define SELF_HOLD     PB2
//#define BUTTON        PC15
// autodetect 2.13 as example only !!!!!!!!!!!!!!!!!!!!!!! end

// Brushless Control DC (BLDC) defines
#define BLDC_GH PA10        // green    , Tommyboi2001 all bldc pins same as 2.0
#define BLDC_GL PB15        
#define BLDC_BH PA9         // blue
#define BLDC_BL PB14        
#define BLDC_YH PA8         // yellow
#define BLDC_YL PB13        
#define TIMER_BLDC_PULLUP   GPIO_PUPD_NONE  // robo: not sure if some boards indeed nned GPIO_PUPD_PULLUP like 2.2 or 2.3

// Timer BLDC short circuit emergency shutoff define
//#define TIMER_BLDC_EMERGENCY_SHUTDOWN P_UNKOWN

// choose the serial ports available (and set them to Remote or MasterSlave below)

//#define HAS_USART0    // tx=PB6,rx=PB7    uncomment to connect via 19200 baud serial
// GD32F130 USART0 TX/RX:   (PA9/PA10)AF1   , (PB6/PB7)AF0 ,    (PA2/PA3)AF1 , (PA14/PA15)AF1 GD32F130x4 only!
#ifdef HAS_USART0
    #define USART0_TX   PB6
    #define USART0_RX   PB7

    //#define USART0_MASTERSLAVE        // uncomment if this usart is used for master-slave communication
    #define USART0_REMOTE                       // uncomment if this usart is used for optional remote control
#endif

#define HAS_USART1  // tx=PA2,rx=PA3    uncomment to connect via 19200 baud serial
// GD32F130 USART1 GD32F130 TX/RX: (PA14/PA15)AF1 , (PA2,PA3)AF1    , (PA8/PB0)AlternateFunction4
#ifdef HAS_USART1
    #define USART1_TX       PA2
    #define USART1_RX       PA3

    #define USART1_MASTERSLAVE      // uncomment if this usart is used for master-slave communication
    //#define USART1_REMOTE             // uncomment if this usart is used for optional remote control
#endif

#endif

Hold detection

https://github.com/user-attachments/assets/07c28e3b-4ee3-4a48-b20d-48aaa9bedfdd

Hold detection freezes after the release OnOff button stage. When the power button is released, the board just turns off.

0 now A5 : 1106
0 now A6 : 1106
0 now A7 : 1106
0 now B0 : 1106
0 now B1 : 1106
0 now B2 : 1106
0 now B10 : 1106
0 now A1 : 1106
0 now B12 : 1106
0 now A11 : 1107
0 now F6 : 1106
0 now F7 : 1107
0 now A12 : 1106
0 now A15 : 1107
0 now B3 : 1106
0 now B4 : 1107
0 now B5 : 1106
0 now B6 : 1106
0 now B7 : 1105
0 now B8 : 1107
0 now B9 : 1106
release OnOff button
ENTER to begin, 's' for next stage, 'q' for menu

Hall / Hall order detection

https://github.com/user-attachments/assets/b025cb2a-ecb6-43c4-bc1f-d2cba355bd90

The hall detection works but the hall order detection does not detect the order.

hit ENTER:
:-)

:-)
:-)
:-)
:-)
:-)
:-)
:-)autodetect menu:
0: do all
1: VBatt
2: Hold
4: Led
5: Hall
8: Results

hall and phase currents: 'r'=restart    's'=save
try 0 = C13 HALL
try 1 = C14 HALL
try 2 = C15 
try 3 = F0  
try 4 = F1  
try 5 = A0  
try 6 = B11 
try 7 = A4  
try 8 = A5  
try 9 = A6  

Slave board

The slave board flashes but does not appear to turn on. There is obviously no switch to bridge.

Questions

Flashing

The master board can't be flashed when being powered via the bench power supply but can be flashed when powered via the 3.3V line on the ST-LINK flasher. I read elsewhere that this is bad and the ST-LINK does sometimes behave strangely. (Maybe too much current is being drawn?) Any idea why it does not flash while being powered by the bench power supply and are there any workarounds? Maybe it would be better to have an external 3.3V power supply rather than using the 25.9V bench power supply?

Version number

Any idea how this board would fit into the existing version number scheme? It says 0L20190703-V4.1 on it.

I-hate-2FA commented 2 weeks ago

it is 2024 we should always use the same uartbus protocol

hoverboardhavoc commented 2 weeks ago

I think there are pads for another USART but no connector. Maybe I'll need to solder something on if I want to connect the board to a micro controller and a slave

Yes, the second uart port (usually PB6 and PB7 ) would be good to have master-slave communication. But i added the RemoteUartBus with which you can control two or more single boards directly from ESP32 (or likewise).

What empty uart header are you reffering to ? Please show it on a photo. I see some bluetooth modules on your photos. Sometimes they only offer a TX or RX line and not both..

I put a red ring around what I thought might be a UART 361253441-dbd785fd-9302-46f1-a9fa-1bd0f99777ba

RoboDurden commented 2 weeks ago

but i see three little smd transistors above this 4pin header, that is why we think it is another led driver port.

Try to trace the PB6 and PB7 of the mcu. I guess at least one of those will lead to the bluetooth module. If you are lucky, both rx and tx will end there. Then you have the second uart.

I-hate-2FA commented 2 weeks ago

there is 3 pin connector near antenna its highly likely