Updated Variant USART (markdown)

Candas1
2022-04-21 09:55:52 +02:00
parent 3fbdff4bcf
commit 7857a25caa

@@ -4,13 +4,13 @@ The example [Arduino sketch](https://github.com/EmanuelFeru/hoverboard-firmware-
You can also test this variant with following [Web Tool](https://github.com/Candas1/Hoverboard-Web-Serial-Control), it let's you control the board and trace feedback values.<br> You can also test this variant with following [Web Tool](https://github.com/Candas1/Hoverboard-Web-Serial-Control), it let's you control the board and trace feedback values.<br>
This [Python code](https://github.com/kosni68/HoverSerial) inspired by the code shared in this [issue](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/issues/157) can also be used to control the firmware. This [Python code](https://github.com/kosni68/HoverSerial) inspired by the code shared in this [issue](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/issues/157) can also be used to control the firmware.
## Configuration/Parameters ## :gear: Configuration/Parameters
Use CONTROL_SERIAL_USART2 and FEEDBACK_SERIAL_USART2 for left sensor cable(default).<br> CONTROL_SERIAL_USART3 and FEEDBACK_SERIAL_USART3 for the right sensor cable(5v tolerant).<br> Use CONTROL_SERIAL_USART2 and FEEDBACK_SERIAL_USART2 for left sensor cable(default).<br> CONTROL_SERIAL_USART3 and FEEDBACK_SERIAL_USART3 for the right sensor cable(5v tolerant).<br>
SIDEBOARD_SERIAL_USART2 or SIDEBOARD_SERIAL_USART3 parameters can be used instead of CONTROL_SERIAL_USART2 or CONTROL_SERIAL_USART3 to enable a different [protocol](https://github.com/EFeru/hoverboard-firmware-hack-FOC/issues/143) implemented on the [sideboard firmware](https://github.com/EFeru/hoverboard-sideboard-hack-GD). It can also be used with the [Web tool](https://github.com/Candas1/Hoverboard-Web-Serial-Control#protocol---hovercar) for testing the different control modes/types.<br> SIDEBOARD_SERIAL_USART2 or SIDEBOARD_SERIAL_USART3 parameters can be used instead of CONTROL_SERIAL_USART2 or CONTROL_SERIAL_USART3 to enable a different [protocol](https://github.com/EFeru/hoverboard-firmware-hack-FOC/issues/143) implemented on the [sideboard firmware](https://github.com/EFeru/hoverboard-sideboard-hack-GD). It can also be used with the [Web tool](https://github.com/Candas1/Hoverboard-Web-Serial-Control#protocol---hovercar) for testing the different control modes/types.<br>
You can adjust USART2_BAUD or USART3_BAUD parameters if you need different baud speed. You can adjust USART2_BAUD or USART3_BAUD parameters if you need different baud speed.
## Wiring: ## :electric_plug: Wiring:
* Connect blue wire to RX, green wire to TX and black wire to GND of Arduino on right sensor cable(shorter) * Connect blue wire to RX, green wire to TX and black wire to GND of Arduino on right sensor cable(shorter)
* Only USART3(right sensor cable) is 5v tolerant * Only USART3(right sensor cable) is 5v tolerant
@@ -20,7 +20,7 @@ You can adjust USART2_BAUD or USART3_BAUD parameters if you need different baud
## Usart configuration: ## Usart configuration:
By default, USART is configured with 115200 baud, 8 data bits, no parity, one stop bit. By default, USART is configured with 115200 baud, 8 data bits, no parity, one stop bit.
## Input Command Structure: ## :joystick: Input Command Structure:
Commands are send as binary frames with following structure:<br /> Commands are send as binary frames with following structure:<br />
- Start frame(unsigned int16) : 0xABCD - Start frame(unsigned int16) : 0xABCD
- Steer(signed int16) : Steer with range -1000 to 1000 - Steer(signed int16) : Steer with range -1000 to 1000
@@ -29,7 +29,7 @@ Commands are send as binary frames with following structure:<br />
The least significant byte comes first (little endian).<br> The least significant byte comes first (little endian).<br>
## Error rejection ## :no_entry: Error rejection
The FOC firmware will discard frames if: The FOC firmware will discard frames if:
- Command length is not correct - Command length is not correct
@@ -39,11 +39,11 @@ The FOC firmware will discard frames if:
A timeout will be triggered if no correct frame is received during the time specified with parameter SERIAL_TIMEOUT in config.h (160ms by default).<br /> A timeout will be triggered if no correct frame is received during the time specified with parameter SERIAL_TIMEOUT in config.h (160ms by default).<br />
## Calibration: ## :control_knobs: Calibration:
[Calibration](https://github.com/EFeru/hoverboard-firmware-hack-FOC/wiki/Input-Calibration) is not required with USART control, but can be done if you use an input devices(e.g. Joystick or Throttle handle) on the Arduino and are not taking care of calibrating center value and min/max range there. [Calibration](https://github.com/EFeru/hoverboard-firmware-hack-FOC/wiki/Input-Calibration) is not required with USART control, but can be done if you use an input devices(e.g. Joystick or Throttle handle) on the Arduino and are not taking care of calibrating center value and min/max range there.
## Feedback: ## :speech_balloon: Feedback:
Following feedback is sent every 10ms: Following feedback is sent every 10ms:
- Start frame(unsigned int16) : 0xABCD - Start frame(unsigned int16) : 0xABCD
- Cmd1(signed int16) : Steer or Brake(hovercar) after normalizing and mixing - Cmd1(signed int16) : Steer or Brake(hovercar) after normalizing and mixing
@@ -57,7 +57,7 @@ Following feedback is sent every 10ms:
The least significant byte comes first (little endian). The least significant byte comes first (little endian).
## Troubleshooting: ## :toolbox: Troubleshooting:
If the board is [beeping](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/wiki/Diagnostics) If the board is [beeping](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/wiki/Diagnostics)
* Make sure the baud rate is 115200 * Make sure the baud rate is 115200