Skip to content

Commit 5dbc94c

Browse files
committed
FW 3.7
1 parent e027ad4 commit 5dbc94c

File tree

827 files changed

+3769
-104649
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

827 files changed

+3769
-104649
lines changed

CHANGELOG

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
=== FW 3.7 ===
2+
* Delay after app and motor conf write.
3+
- Fixes NRF bug.
4+
- Fixes glitches if throttle is given while updating the configurations.
5+
* Lock mc_interface while storing configuration.
6+
* Nunchuk app local timeout.
7+
- Prevents the output thread from blocking other outputs after being used before.
8+
* Lock MC interface while storing configurations to flash.
9+
10+
=== FW 3.6 ===
11+
* spi_sw for NRF stop bug fix.
12+
13+
=== FW 3.5 ===
14+
* App NRF pairing.
15+
* App nunchuk chuk error restore bug fix.
16+
17+
=== FW 3.4 ===
18+
* HW version built into firmware.
19+
- Allows VESC Tool to only list firmwares compatible with the hardware.
20+
21+
=== FW 3.2 ===
22+
* hw_60 support.
23+
* hw_das support.
24+
* DRV8301 support.
25+
- SPI implementation.
26+
- Some terminal commands.
27+
* DRV8313 support.
28+
* 3 shunt support.
29+
* Phase shunt support.
30+
* Global RPM limit for both BLDC and FOC.
31+
* Hall sensor software filtering.
32+
* SPI software filtering.
33+
* The software filters remove the need for hardware filtering on the sensor port, making it work for all different sensors without modification.
34+
* Handbrake function for FOC (open loop braking).
35+
* FOC updates and fixes.
36+
- Current control signs.
37+
- Control loop integrator fixes.
38+
- Phase delay compensation and minimization.
39+
- More consistent flux linkage detection.
40+
- Resistance and inductance measurement bug fix that could cause a reboot.
41+
- Timer sampling improvement and cleanup.
42+
- Support for sampling in V0 and V7 when using phase shunts.
43+
* Fix reboot on over temperature fault code.
44+
* Motor temperature measurement and soft backoff.
45+
* Terminal command for rotating magnet field generation (ACIM experimentation).
46+
* Prevent motor start command during initialization.
47+
* Hardware specific default configuration support.
48+
* Stop functionality for apps so that reboots are not required anymore when changing app.
49+
* EEPROM emulation bug fix: https://github.com/vedderb/bldc/issues/27
50+

CONTRIBUTING

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
So you want to contribute to the VESC firmware? That's great! Benjamin (the creator of the VESC) welcomes more people to join the development.
2+
3+
But Benjamin is a busy man, and to reduce the workload of reviewing patches, it's important that your code follows the guidelines below. These are meant to make _you_ work a bit harder, so that Benjamin can work a bit less (and use his time to develop the VESC instead of trying to fix your patches :).
4+
5+
6+
=== Process ===
7+
8+
Please discuss your ideas in the forum (http://vedder.se/forums/index.php) so that you don't just dump a large amount of code on Benjamin out of nowhere. Try to reach some kind of consensus with others on the forum about scope and functionality of your contribution.
9+
10+
When Benjamin is prepared for your patch, and you have checked that it follows these guidelines, contribute it through a github pull request.
11+
12+
13+
=== Create clean patches ===
14+
15+
When committing code to your git repo, it's easy to forget stuff: maybe you forget to add a new file, maybe you leave some debug code that you remove with a later commit, maybe you find spelling errors, and of course you will probably find bugs in the new code later, that needs to be fixed. This can all lead to a lot of commits in the style of:
16+
17+
"Fixed code I broke for other hardware"
18+
19+
and
20+
21+
"Fixed typo in new commutation implementation"
22+
23+
These types of commits just mess up the tree, and makes it hard to see what's actually been done to the code. Fortunately, there is a great tool in git that you can use to clean these up: 'git rebase -i <parent-hash>'! It's quite easy to use: once run, you get a list of all commits after <parent-hash>, and have the option to move commits around and also to squash them (make them as one). So you can group the "main" commit for a logical change together with all its "fix-the-code-I-broke" commits, and then squash them together to one, well functioning commit!
24+
25+
Please do this, so that each commit represents a logical, well-functioning change.
26+
27+
See INTERACTIVE MODE in 'man git-rebase' for detailed info. Here is a good article as well:
28+
http://www.siliconfidential.com/articles/15-seconds-to-cleaner-git-history/
29+
30+
31+
=== Describe the changes ===
32+
33+
In the commit messages, describe the technical detail of the change(s) you make.
34+
35+
Be as specific as possible. The WORST descriptions possible include things like "update bldc code", "bug fix for FOC", or "this patch includes updates for the observer. Please apply."
36+
37+
Your commit message(s) will end up in the commit log for the VESC firmware, and someone reading the log a year later should be able to infer what each commit does.
38+
39+
40+
=== Coding Style ===
41+
42+
Make sure your coding style matches the style in the existing code. Among other things, that means:
43+
44+
* Use tabs for indentation (make sure your editor does not replace tabs with spaces). Never use spaces before tabs. Preferably use a tab width of 4.
45+
46+
* Place the opening brace '{' of code blocks on the same line as the preceding text, both after function headers and after control statements:
47+
48+
int main(void) {
49+
50+
and
51+
52+
if (send_func) {
53+
54+
* Always use braces, even for single-line blocks:
55+
56+
if (send_func) {
57+
send_func(data, len);
58+
}
59+
60+
* Write "else" on the same line as both the preceding and the following brace:
61+
62+
} else {
63+
64+
* Use C99-style single-line comments ("// ...", not "/* ... */"):
65+
66+
static mc_configuration mcconf, mcconf_old; // Static to save some stack space
67+
68+
and
69+
70+
// Lock the system and enter an infinite loop. The watchdog will reboot.
71+
72+
* If you write function comments, write them Doxygen-style.
73+
74+
* There is no limit on line length, so long lines in general should not be wrapped.
75+
76+
=== Make sure that all hardware versions and configuration variations work ===
77+
78+
When making updates it is easy to break things for different configurations. In order to make sure that the firmware at least builds for different hardwares and configurations it is a good idea to run the build_all/rebuild_all script and ensure that is finished without warnings and/or errors.
79+
80+
81+
=== Be patient, and don't take criticism personally ===
82+
83+
Be prepared to have to rework your contribution several times before it is considered acceptable. Once code is in, it's difficult to get it reworked for better quality, so it's important that this is done before the code is even accepted. Don't take it personally; instead appreciate that it is this peer review that makes the code great in the end!
84+
85+
86+
87+
Thanks for reading!
88+

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ build/$(PROJECT).bin: build/$(PROJECT).elf
269269

270270
# Program
271271
upload: build/$(PROJECT).bin
272-
#qstlink2 --cli --erase --write build/$(PROJECT).bin
273-
#openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x_stlink.cfg -c "program build/$(PROJECT).elf verify reset" # Older openocd
272+
# qstlink2 --cli --erase --write build/$(PROJECT).bin
273+
# openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x_stlink.cfg -c "program build/$(PROJECT).elf verify reset" # Older openocd
274274
openocd -f board/stm32f4discovery.cfg -c "reset_config trst_only combined" -c "program build/$(PROJECT).elf verify reset exit" # For openocd 0.9
275275

276276
#program with olimex arm-usb-tiny-h and jtag-swd adapter board. needs openocd>=0.9

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
This is the source code for my custom BLDC controller. A complete description and tutorial about how to use it can be found here: http://vedder.se/2015/01/vesc-open-source-esc/
1+
This is the source code for the VESC DC/BLDC/FOC controller. A description and tutorial about how to use it can be found here: http://vedder.se/2015/01/vesc-open-source-esc/

appconf/appconf_custom.h

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/*
22
Copyright 2016 Benjamin Vedder [email protected]
33
4-
This program is free software: you can redistribute it and/or modify
4+
This file is part of the VESC firmware.
5+
6+
The VESC firmware is free software: you can redistribute it and/or modify
57
it under the terms of the GNU General Public License as published by
68
the Free Software Foundation, either version 3 of the License, or
79
(at your option) any later version.
810
9-
This program is distributed in the hope that it will be useful,
11+
The VESC firmware is distributed in the hope that it will be useful,
1012
but WITHOUT ANY WARRANTY; without even the implied warranty of
1113
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1214
GNU General Public License for more details.
@@ -15,13 +17,6 @@
1517
along with this program. If not, see <http://www.gnu.org/licenses/>.
1618
*/
1719

18-
/*
19-
* appconf_example_ppm.h
20-
*
21-
* Created on: 9 sep 2015
22-
* Author: benjamin
23-
*/
24-
2520
#ifndef APPCONF_APPCONF_EXAMPLE_PPM_H_
2621
#define APPCONF_APPCONF_EXAMPLE_PPM_H_
2722

appconf/appconf_default.h

+13-20
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/*
2-
Copyright 2015 Benjamin Vedder [email protected]
2+
Copyright 2016 Benjamin Vedder [email protected]
33
4-
This program is free software: you can redistribute it and/or modify
4+
This file is part of the VESC firmware.
5+
6+
The VESC firmware is free software: you can redistribute it and/or modify
57
it under the terms of the GNU General Public License as published by
68
the Free Software Foundation, either version 3 of the License, or
79
(at your option) any later version.
810
9-
This program is distributed in the hope that it will be useful,
11+
The VESC firmware is distributed in the hope that it will be useful,
1012
but WITHOUT ANY WARRANTY; without even the implied warranty of
1113
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1214
GNU General Public License for more details.
@@ -63,12 +65,6 @@
6365
#ifndef APPCONF_PPM_SAFE_START
6466
#define APPCONF_PPM_SAFE_START true
6567
#endif
66-
#ifndef APPCONF_PPM_RPM_LIM_START
67-
#define APPCONF_PPM_RPM_LIM_START 150000
68-
#endif
69-
#ifndef APPCONF_PPM_RPM_LIM_END
70-
#define APPCONF_PPM_RPM_LIM_END 200000
71-
#endif
7268
#ifndef APPCONF_PPM_MULTI_ESC
7369
#define APPCONF_PPM_MULTI_ESC false
7470
#endif
@@ -92,6 +88,12 @@
9288
#ifndef APPCONF_ADC_VOLTAGE_END
9389
#define APPCONF_ADC_VOLTAGE_END 3.0
9490
#endif
91+
#ifndef APPCONF_ADC_VOLTAGE2_START
92+
#define APPCONF_ADC_VOLTAGE2_START 0.9
93+
#endif
94+
#ifndef APPCONF_ADC_VOLTAGE2_END
95+
#define APPCONF_ADC_VOLTAGE2_END 3.0
96+
#endif
9597
#ifndef APPCONF_ADC_USE_FILTER
9698
#define APPCONF_ADC_USE_FILTER true
9799
#endif
@@ -107,11 +109,8 @@
107109
#ifndef APPCONF_ADC_VOLTAGE_INVERTED
108110
#define APPCONF_ADC_VOLTAGE_INVERTED false
109111
#endif
110-
#ifndef APPCONF_ADC_RPM_LIM_START
111-
#define APPCONF_ADC_RPM_LIM_START 150000.0
112-
#endif
113-
#ifndef APPCONF_ADC_RPM_LIM_END
114-
#define APPCONF_ADC_RPM_LIM_END 200000.0
112+
#ifndef APPCONF_ADC_VOLTAGE2_INVERTED
113+
#define APPCONF_ADC_VOLTAGE2_INVERTED false
115114
#endif
116115
#ifndef APPCONF_ADC_MULTI_ESC
117116
#define APPCONF_ADC_MULTI_ESC false
@@ -138,12 +137,6 @@
138137
#ifndef APPCONF_CHUK_HYST
139138
#define APPCONF_CHUK_HYST 0.15
140139
#endif
141-
#ifndef APPCONF_CHUK_RPM_LIM_START
142-
#define APPCONF_CHUK_RPM_LIM_START 150000.0
143-
#endif
144-
#ifndef APPCONF_CHUK_RPM_LIM_END
145-
#define APPCONF_CHUK_RPM_LIM_END 200000.0
146-
#endif
147140
#ifndef APPCONF_CHUK_RAMP_TIME_POS
148141
#define APPCONF_CHUK_RAMP_TIME_POS 0.9
149142
#endif

appconf/appconf_example_ppm.h

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/*
2-
Copyright 2015 Benjamin Vedder [email protected]
2+
Copyright 2016 Benjamin Vedder [email protected]
33
4-
This program is free software: you can redistribute it and/or modify
4+
This file is part of the VESC firmware.
5+
6+
The VESC firmware is free software: you can redistribute it and/or modify
57
it under the terms of the GNU General Public License as published by
68
the Free Software Foundation, either version 3 of the License, or
79
(at your option) any later version.
810
9-
This program is distributed in the hope that it will be useful,
11+
The VESC firmware is distributed in the hope that it will be useful,
1012
but WITHOUT ANY WARRANTY; without even the implied warranty of
1113
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1214
GNU General Public License for more details.
@@ -15,13 +17,6 @@
1517
along with this program. If not, see <http://www.gnu.org/licenses/>.
1618
*/
1719

18-
/*
19-
* appconf_example_ppm.h
20-
*
21-
* Created on: 9 sep 2015
22-
* Author: benjamin
23-
*/
24-
2520
#ifndef APPCONF_APPCONF_EXAMPLE_PPM_H_
2621
#define APPCONF_APPCONF_EXAMPLE_PPM_H_
2722

applications/app.c

+28-30
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
/*
2-
Copyright 2012-2014 Benjamin Vedder [email protected]
2+
Copyright 2016 Benjamin Vedder [email protected]
33
4-
This program is free software: you can redistribute it and/or modify
4+
This file is part of the VESC firmware.
5+
6+
The VESC firmware is free software: you can redistribute it and/or modify
57
it under the terms of the GNU General Public License as published by
68
the Free Software Foundation, either version 3 of the License, or
79
(at your option) any later version.
810
9-
This program is distributed in the hope that it will be useful,
11+
The VESC firmware is distributed in the hope that it will be useful,
1012
but WITHOUT ANY WARRANTY; without even the implied warranty of
1113
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1214
GNU General Public License for more details.
1315
1416
You should have received a copy of the GNU General Public License
1517
along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
*/
17-
/*
18-
* app.c
19-
*
20-
* Created on: 18 apr 2014
21-
* Author: benjamin
22-
*/
18+
*/
2319

2420
#include "app.h"
2521
#include "ch.h"
@@ -31,12 +27,28 @@
3127
// Private variables
3228
static app_configuration appconf;
3329

34-
void app_init(app_configuration *conf) {
35-
app_set_configuration(conf);
30+
const app_configuration* app_get_configuration(void) {
31+
return &appconf;
32+
}
33+
34+
/**
35+
* Reconfigure and restart all apps. Some apps don't have any configuration options.
36+
*
37+
* @param conf
38+
* The new configuration to use.
39+
*/
40+
void app_set_configuration(app_configuration *conf) {
41+
appconf = *conf;
3642

37-
#ifdef HW_HAS_PERMANENT_NRF
38-
nrf_driver_init();
39-
rfhelp_restart();
43+
app_ppm_stop();
44+
app_adc_stop();
45+
app_uartcomm_stop();
46+
app_nunchuk_stop();
47+
#ifndef HW_HAS_PERMANENT_NRF
48+
nrf_driver_stop();
49+
#endif
50+
#ifdef USE_APP_STEN
51+
app_sten_stop();
4052
#endif
4153

4254
switch (appconf.app_to_use) {
@@ -79,28 +91,14 @@ void app_init(app_configuration *conf) {
7991
case APP_CUSTOM:
8092
#ifdef USE_APP_STEN
8193
hw_stop_i2c();
82-
app_sten_init();
94+
app_sten_start();
8395
#endif
8496
break;
8597

8698
default:
8799
break;
88100
}
89-
}
90-
91-
const app_configuration* app_get_configuration(void) {
92-
return &appconf;
93-
}
94101

95-
/**
96-
* Reconfigure all apps. Note that this will not start apps that are not already running, that
97-
* should be done at boot. Some apps don't have any configuration options.
98-
*
99-
* @param conf
100-
* The new configuration to use.
101-
*/
102-
void app_set_configuration(app_configuration *conf) {
103-
appconf = *conf;
104102
app_ppm_configure(&appconf.app_ppm_conf);
105103
app_adc_configure(&appconf.app_adc_conf);
106104
app_uartcomm_configure(appconf.app_uart_baudrate);

0 commit comments

Comments
 (0)