Firmware: Shield
electronics-shield
This is software for microprocessor onData frames in HEX
Prefix | Body | Postfix | Description |
---|---|---|---|
00 |
00 00 00 00 |
0d0a |
Returns name of the robot |
01 |
00 00 00 00 |
0d0a |
Returns version of firmware |
10 |
00 00 00 00 : 7f 7f 7f 7f 80 80 80 80 : ff ff ff ff |
0d0a |
Motors speed set simultaneously for all wheels. The first range is for moving forward, the second - backward, accordingly. |
30 |
00 00 00 00 |
0d0a |
deprecated Returns battery voltage, used in format for TCS |
30 |
00 00 00 00 |
0d0a |
Returns battery voltage in float, 4 bytes little endian |
41 |
slave_addres << 1 data_1 data_2 data_3 |
0d0a |
Send data to I2C connector. |
42 |
slave_addres << 1 size_of_data 00 00 |
0d0a |
Recieve data from I2C connector. |
43 |
slave_addres << 1 memory_addres size_of_memory data |
0d0a |
Write to register. |
44 |
slave_addres << 1 memory_addres size_of_memory 00 |
0d0a |
Read from register. |
81 |
(duty >> 8) & 0xff duty & 0xff 00 00 |
0d0a |
Set servo 1 duty |
82 |
(duty >> 8) & 0xff duty & 0xff 00 00 |
0d0a |
Set servo 2 duty |
83 |
(duty >> 8) & 0xff duty & 0xff 00 00 |
0d0a |
Set servo 3 duty (redundant with 94) |
84 |
(axis_1 >> 8) & 0xff axis_1 & 0xff (axis_2 >> 8) & 0xFF axis_2 & 0xff |
0d0a |
deprecated Set manipulator orientation (only axis without gripper) - 2 bytes MSB first. |
94 |
(gripperPosition >> 8) & 0xFF gripperPosition & 0xFF |
0d0a |
deprecated Set gripper value. |
FF |
01 or 00 00 00 00 |
0d0a |
Enable / disable watchdog. 0x01 is default setting |
Notice: All messages from microcontroller ends with \r\n character
Example frame
Prefix | Data | Data | Data | Data | Postfix | Postfix |
---|---|---|---|---|---|---|
0x10 | 0x50 | 0x50 | 0x50 | 0x50 | 0x0d | 0x0a |
Servo duty range
Manipulator
Duty can be set in range from 500 to 6000
Gripper
Duty can be set in range from 1000 to 5000
Install toolchain
Below steps for Unix systems:
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get install gcc-arm-embedded
Code editing
Install System Workbench for STM32.
Import project to workspace.
Check your linker flags (project properties > C/C++ Build > Setings > Tool Settings (TAB) > MCU GCC Linker > Miscellaneous > Linker flags), if you are using nanolib “-specs=nano.specs” you need to add “-u _printf_float” to enable float printf.