Skip to content

Commit 5da9966

Browse files
committed
various new ideas in README.md. Making hoverserial start from zero speed and highlighting that it will trigger backward beeps.
1 parent cf7b1d0 commit 5da9966

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

Arduino/hoverserial/hoverserial.ino

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
// it is recommended to use the built-in Serial interface for full speed perfomace.
1212
// • The data packaging includes a Start Frame, checksum, and re-syncronization capability for reliable communication
1313
//
14+
// The code starts with zero speed and moves towards +
15+
//
1416
// CONFIGURATION on the hoverboard side in config.h:
1517
// • Option 1: Serial on Right Sensor cable (short wired cable) - recommended, since the USART3 pins are 5V tolerant.
1618
// #define CONTROL_SERIAL_USART3
@@ -28,6 +30,7 @@
2830
#define START_FRAME 0xABCD // [-] Start frme definition for reliable serial communication
2931
#define TIME_SEND 100 // [ms] Sending time interval
3032
#define SPEED_MAX_TEST 300 // [-] Maximum speed for testing
33+
#define SPEED_STEP 20 // [-] Speed step
3134
// #define DEBUG_RX // [-] Debug received data. Prints all bytes to serial (comment-out to disable)
3235

3336
#include <SoftwareSerial.h>
@@ -146,8 +149,8 @@ void Receive()
146149
// ########################## LOOP ##########################
147150

148151
unsigned long iTimeSend = 0;
149-
int iTestMax = SPEED_MAX_TEST;
150152
int iTest = 0;
153+
int iStep = SPEED_STEP;
151154

152155
void loop(void)
153156
{
@@ -159,11 +162,14 @@ void loop(void)
159162
// Send commands
160163
if (iTimeSend > timeNow) return;
161164
iTimeSend = timeNow + TIME_SEND;
162-
Send(0, SPEED_MAX_TEST - 2*abs(iTest));
165+
Send(0, iTest);
163166

164167
// Calculate test command signal
165-
iTest += 10;
166-
if (iTest > iTestMax) iTest = -iTestMax;
168+
iTest += iStep;
169+
170+
// invert step if reaching limit
171+
if (iTest >= SPEED_MAX_TEST || iTest <= -SPEED_MAX_TEST)
172+
iStep = -iStep;
167173

168174
// Blink the LED
169175
digitalWrite(LED_BUILTIN, (timeNow%2000)<1000);

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ With slight modifications in config.h, other dual-inputs combinations can be rea
144144
---
145145
## Flashing
146146

147-
Right to the STM32, there is a debugging header with GND, 3V3, SWDIO and SWCLK. Connect GND, SWDIO and SWCLK to your SWD programmer, like the ST-Link found on many STM devboards.
147+
Right to the STM32, there is a debugging header with GND, 3V3, SWDIO and SWCLK. Connect GND, SWDIO and SWCLK to your SWD programmer (don't connect 3V3 pin with ST-Link), like the ST-Link found on many STM devboards.
148+
149+
In case you connected the pins and you get connection errors, make sure your ST-Link dongle pins are real, by sliding the plastic cover and checking on the ST-Link board itself. An example can be seen here https://youtu.be/XWh8yJ_p0HA?t=60.
148150

149151
If you have never flashed your sideboard before, the MCU is probably locked. To unlock the flash, check-out the wiki page [How to Unlock MCU flash](https://github.com/EFeru/hoverboard-firmware-hack-FOC/wiki/How-to-Unlock-MCU-flash).
150152

@@ -251,8 +253,14 @@ The errors reported by the board are in the form of audible beeps:
251253
- **1 beep fast (medium pitch)**: Low battery voltage < 35V
252254
- **1 beep fast (high pitch)**: Backward spinning motors
253255

256+
Please also note that with BEEPS_BACKWARD=1 (default setting) the board also makes a beep when the motors go backwards. If running hoverserial.ino from Arduino the backward beeps are normal, unless you intentionally disable them.
257+
254258
For a more detailed troubleshooting connect an [FTDI Serial adapter](https://s.click.aliexpress.com/e/_AqPOBr) or a [Bluetooth module](https://s.click.aliexpress.com/e/_A4gkMD) to the DEBUG_SERIAL cable (Left or Right) and monitor the output data using the [Hoverboard Web Serial Control](https://candas1.github.io/Hoverboard-Web-Serial-Control/) tool developed by [Candas](https://github.com/Candas1/).
255259

260+
HC-05 (https://www.aliexpress.com/af/HC-06.html) works, connected to USART2 at 9600 bauds (define DEBUG_SERIAL_USART2 and USART2_BAUD=9600).
261+
262+
In main.c you can see at [lines 440](https://github.com/EFeru/hoverboard-firmware-hack-FOC/blob/cf7b1d0de1da34612b056c316480f47702a15cbe/Src/main.c#L440) and [line 224][https://github.com/EFeru/hoverboard-firmware-hack-FOC/blob/cf7b1d0de1da34612b056c316480f47702a15cbe/Src/main.c#L225] printf statements, wrapped in ```#if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3)```. Feel free to add more printf statements with same wrapping, in main.c, in places you want to see what happens.
263+
256264
---
257265
## Projects and Links
258266

0 commit comments

Comments
 (0)