various new ideas in README.md. Making hoverserial start from zero speed and highlighting that it will trigger backward beeps.

This commit is contained in:
John Lazar
2021-12-29 19:01:30 +02:00
parent cf7b1d0de1
commit 5da9966f8c
2 changed files with 19 additions and 5 deletions

View File

@ -11,6 +11,8 @@
// it is recommended to use the built-in Serial interface for full speed perfomace.
// • The data packaging includes a Start Frame, checksum, and re-syncronization capability for reliable communication
//
// The code starts with zero speed and moves towards +
//
// CONFIGURATION on the hoverboard side in config.h:
// • Option 1: Serial on Right Sensor cable (short wired cable) - recommended, since the USART3 pins are 5V tolerant.
// #define CONTROL_SERIAL_USART3
@ -28,6 +30,7 @@
#define START_FRAME 0xABCD // [-] Start frme definition for reliable serial communication
#define TIME_SEND 100 // [ms] Sending time interval
#define SPEED_MAX_TEST 300 // [-] Maximum speed for testing
#define SPEED_STEP 20 // [-] Speed step
// #define DEBUG_RX // [-] Debug received data. Prints all bytes to serial (comment-out to disable)
#include <SoftwareSerial.h>
@ -146,8 +149,8 @@ void Receive()
// ########################## LOOP ##########################
unsigned long iTimeSend = 0;
int iTestMax = SPEED_MAX_TEST;
int iTest = 0;
int iStep = SPEED_STEP;
void loop(void)
{
@ -159,11 +162,14 @@ void loop(void)
// Send commands
if (iTimeSend > timeNow) return;
iTimeSend = timeNow + TIME_SEND;
Send(0, SPEED_MAX_TEST - 2*abs(iTest));
Send(0, iTest);
// Calculate test command signal
iTest += 10;
if (iTest > iTestMax) iTest = -iTestMax;
iTest += iStep;
// invert step if reaching limit
if (iTest >= SPEED_MAX_TEST || iTest <= -SPEED_MAX_TEST)
iStep = -iStep;
// Blink the LED
digitalWrite(LED_BUILTIN, (timeNow%2000)<1000);

View File

@ -144,7 +144,9 @@ With slight modifications in config.h, other dual-inputs combinations can be rea
---
## Flashing
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.
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.
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.
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).
@ -251,8 +253,14 @@ The errors reported by the board are in the form of audible beeps:
- **1 beep fast (medium pitch)**: Low battery voltage < 35V
- **1 beep fast (high pitch)**: Backward spinning motors
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.
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/).
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).
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.
---
## Projects and Links