Commit Graph

106 Commits

Author SHA1 Message Date
EmanuelFeru f2d86f3b30 Added functionality: Electric Brake, Standstill hold
- For TORQUE mode, by enabling `ELECTRIC_BRAKE_ENABLE` in `config.h`, the freewheeling amount can be adjusted using the `ELECTRIC_BRAKE_MAX` parameter.
- For VOLTAGE and TORQUE mode, the standstill hold functionality can be forced by enabling `STANDSTILL_HOLD_ENABLE` in `config.h`.

Known (minor) issue: There is a small "tick" noise when Stanstill is engaged/disengaged, due to the switching to SPEED mode. To be solved by an improved mode switching strategy in the future.
2020-07-19 11:24:37 +02:00
EmanuelFeru 22984a7fd6 Fixed PPM, PWM timeout
- fixed the general timeout handling: there is no need to disable the MOSFETs timer because it will confuse the BLDC_controller, making him consider the timeout as a false MOSFET defective error.
- renamed `timeout` to `timeoutCnt` for consistency and to ease the search
#61
2020-07-01 19:50:32 +02:00
EmanuelFeru 68776699e1 Updated Mid resting poti scaling
Issue #74
2020-06-30 18:09:37 +02:00
EmanuelFeru 17e127a8b7 PWM/PPM Left/Right, UART update
- created possiblity to use PWM, PPM input also on both LEFT and RIGHT cable (RIGHT cable is 5V tolerant)
- updated UART: disabled the Rx errors to avoid DMA stop and additional need to manage the UART error handler
- added Button support LEFT/RIGHT
2020-06-25 20:17:55 +02:00
EmanuelFeru 526cee4c0f Lowered pwm_margin by 10
- to avoid virbation at maximum PWM = 1000, due to reduced Phase current accuracy, the pwm margin is lowered by 10.
Fixed #69
2020-06-23 20:13:05 +02:00
EmanuelFeru 5f2eb196af Improved UART error recovery
- In case of an Rx error instead of stopping the complete UART, only the Rx DMA is aborted and restarted.
2020-06-23 19:58:36 +02:00
EmanuelFeru ac90ed1b6b Fixed initial condition bug
- the initial condition for the Battery and Board temperature was wrongly set
- the filter is fixdt(1,32,16), so the shift should be by 16 bits.
2020-06-22 20:21:18 +02:00
EmanuelFeru b8d9c8c8bc Re-arranged variables
- no functionality change
2020-06-22 09:17:42 +02:00
EmanuelFeru e46dff590f Major UART communication improvement
- the UART communication is improved based on UART Idle line detection interrupt
- an Rx ring buffer is used to manage the UART incoming data
- both Tx and Rx are efficiently handled using DMA

#45 #64 #65

Other:
- minor visual improvements
2020-06-21 23:14:46 +02:00
EmanuelFeru 205c054235 PWM Variant update
- made the 2 channels to operate independently #61
- added defines to enable/disable motors, if one motor is not needed #63
2020-06-13 10:57:54 +02:00
EmanuelFeru 8ddfc82882 Updated PWM Variant
- PWM Variant should now support that the PWM for the 2 channels (steering, throttle) can happen:
• in the same time (ussually the case if Servo library from Arduino is used)
•or offseted (ussually if commercial RC PWM received is used)
- made the PWM timeout for the 2 channels independent to be able to use only one channel if desired.
2020-06-13 00:08:34 +02:00
EmanuelFeru 558759b2c5
Merge pull request #57 from benjaf/master
PWM Steering fixed
2020-06-02 14:46:07 +02:00
EmanuelFeru 22411e1851 update PWM timeout
- updated the `pwm_timeout` and uncommented `pwm_captured_ch1_value` as discussed with @benjaf
2020-06-02 14:42:14 +02:00
EmanuelFeru b95307f260 Update control.c
- removed the `PWM_signal_Correct(..)` function, because it is already existing here 34c6e4d610/Src/util.c (L844-L862)
- added (void) to the functions
- limited `pwm_timeout` to 500 instead of 0, ottherwise the timeout won't work properly, because it will will reset every time.
2020-06-02 13:04:10 +02:00
Benjamin 21a8f757d0 PWM Steering fixed 2020-06-02 11:53:59 +02:00
EmanuelFeru 34c6e4d610 Improved UART Timeout
Apparently, the UART data Rx/Tx is quite unreliable (especially under motor load) leading to very often out-of-sync issues. This change allows to reset the DMA more often, leading to a faster re-sync of the UART transmission and thus avoiding UART timeout.
2020-06-01 20:08:47 +02:00
EmanuelFeru 32f4a2c03e Fixed missing define for Serial feedback 2020-05-26 23:39:56 +02:00
EmanuelFeru 736f2b9419 Minor updates
- updated ReadMe: added higher resolution mainboard picture, added links with projects, online compiler, Telegram link
- setup.c : fixed the Charger GPIO pin to PULLUP, otherwise the Charger won't be recognized when connected
- config.h : increased the default ADC protection Timeout from 30 to 100 for more robustness.
2020-05-26 22:17:40 +02:00
EmanuelFeru 95c10c9ba7 Update util.c 2020-03-24 21:31:30 +01:00
EmanuelFeru 38574153f0 Added deadband for PPM signal
Issue #29
2020-03-24 20:36:19 +01:00
EmanuelFeru 39e4fdc869 Variant_PWM implemented 2020-03-24 19:57:08 +01:00
EmanuelFeru c099bec824 RC pwm signal read fixes
Re-work on the RC pwm input signal timeout
2020-03-23 21:09:17 +01:00
EmanuelFeru 7d80e564f0 First commit pwm
- buttons not yet support
2020-03-21 19:24:29 +01:00
EmanuelFeru 9d6cec8889 Hovercar minor update
- put by default TORQUE mode. Hovercar works best in Torque mode
- made the brake pedal more aggressive. Gives a better braking feel.
2020-03-17 15:38:35 +01:00
EmanuelFeru 72e6b30033 UART with sideboards works + major refactoring
► the mainboard can now send and receive Serial data from the sideboards
► heavy refactored the `main.c`. It was becoming too large to manage... Therefore, `util.c` and `util.h` was created
► added new functionality for `VARIANT_HOVERCAR` and variants with `CONTROL_ADC` in general:
- ADC limits auto-calibration mode (long press of the power button) - calibration will not be lost at power-off
- Max Current and Max Speed adjustment mode (long press followed by a short press of the power button) - calibration will not be lost at power-off
- added one sideboard functionality:
         - LEDs are used to display battery level,  Motor Enable, Errors, Reverse driving, Braking.
         - Photo sensors are used as push buttons: One for changing Control Mode, One for Activating/Deactivating the Field Weakening on the fly
2020-03-01 10:00:26 +01:00
EmanuelFeru 872d86f021 Added Keil project
Project can now be built and flashed with Keil uVision as well.
2020-02-16 21:58:15 +01:00
EmanuelFeru 2d178a399c Improved Serial Timeout
- added condition to avoid restarting DMA repeatedly if no data is received
- enabled DEBUG_SERIAL_ASCII for all Variants except VARIANT_TRANSPOTTER
2020-02-06 21:53:38 +01:00
kai e1aa42bad0 space removal 2020-01-18 01:15:45 +01:00
kai cd01b73451 corrected nunchuck to nunchuk 2020-01-18 01:05:06 +01:00
EmanuelFeru d2c846cda9 Updated IBUS variant
- separated the implementation from USART implementation for more clarity
- fixed warnings
- minor visual updates
2020-01-08 19:16:34 +01:00
Candas1 c3a40f6454
Replacing #elif by #else 2020-01-07 22:06:31 +01:00
Candas1 4f8aafe3f0 Use defined macros for min max values 2020-01-07 21:13:22 +01:00
Candas1 faca885c9a Add FLYSKY IBUS support 2020-01-07 21:01:17 +01:00
EmanuelFeru a3b6e40fa2 Minor updates
- fixed all warnings for VARIANT_NUNCHUCK and VARIANT_PPM
- changed the variant order: the basic Variants on top, more application specific in the bottom
2020-01-07 18:09:19 +01:00
kai ec2f6a1eb6 - removed default / fallback variant; you are forced to define the variant of your choice now or build will stop with an error
- added condition in config.h to either take setting from platform.ini or config.h
- homogenized default_envs naming; all variants now have VARIANT_ as prefix
- added nunchuck variant in platform.ini and config.h
- added PPM variant in platform.ini and config.h
- README: added jan's nunchuck breakout board repo
2020-01-04 00:09:57 +01:00
EmanuelFeru b4b23bbe9b Implemented HOVERCAR variant
Major:
- created HOVERCAR variant (selectable via platformio.ini) for driving via 2 pedals: Brake (on cmd1) and Throttle (on cmd2)
- implemented "Double tapping" on Brake pedal to engage Reverse driving
- implemented that Brake pedal stops the vehicle but does not go to Reverse, to prevend unintended Reverse driving
- implemented ADC Protection when GND and Vcc wire are disconnected. The functionality can be enabled/disabled via #define ADC_PROTECT_ENA
- updated error handling: in case of major error the motors will be disabled for improved safety

Minor:
- fixed bug on low-pass filter for not reaching exact "0" value
- calibrated the ADC Battery voltage reading
- other minor visual updates
2019-12-31 13:35:01 +01:00
EmanuelFeru 814af15adc Made beep functions available also for other variants
Beep function "short" and "long" can be used also for other variants than TRASNPOTTER
2019-12-23 10:11:48 +01:00
Julian Metzler f253e6e29a Added second beep with varying pitch on follow distance change 2019-12-22 15:34:32 +01:00
EmanuelFeru 2c939cad1c Update setup.c 2019-12-14 13:57:40 +01:00
EmanuelFeru 0344a9c225 Merge branch 'master' into pr/9 2019-12-14 13:51:37 +01:00
EmanuelFeru 31d42b4a17 Major improvements
- reduced FOC computational complexity by up to 20%, from 85% (old) to 65% (new)
- updated Field Weakening by allowing more freedom set-up: field weakening blended in the input fully, partially blended, or fully outside the input range
- major improvemets on current and speed limitations. It allows seemless limitation protection -> very happy with the result
2019-12-12 23:44:33 +01:00
EmanuelFeru 9fdb6d75f5 Fixed checksum
Fixed a bug when requesting negative speed in the checksum calculation due to data type.
2019-12-01 17:38:36 +01:00
EmanuelFeru 6c8b7f001d Added Sinusoidal Control Type
Sinusoidal Control Type is now available is this branch. To select it go in config.h and change CTRL_TYP_SEL to 1. By default FOC control type is selcted.
Note: SPEED and TORQUE modes are not available for Sinusoidal control type.
2019-11-30 11:30:12 +01:00
EmanuelFeru 5d195696a2 Implemented reliable Serial Rx/Tx
► Reliable Serial Communication implemented featuring:
- start frame
- checksum
- out-of-sync handling
- timeout and disconnected line detection
► Arduino example code added
► Fixed ConsoleLog Item #5
2019-11-29 17:31:53 +01:00
Julian Metzler f98f531f3e Implemented TranspOtter modifications 2019-11-26 23:58:20 +01:00
EmanuelFeru 9a9eed7d10 Updated current limit
The firmware allows now to set higher currents than 15 A/motor.
NOTE: You can change this limit at your own risk. I do not take any responsability if your boards gets damaged.
2019-11-03 12:45:13 +01:00
EmanuelFeru 01a08d5f6d Fixed ADC calculation
Fix done as suggested in Issue #8 .
2019-11-03 09:54:37 +01:00
EmanuelFeru 62873aad57 PI controller update and fixes
Major:
• all PI controllers with Back-calculation replaced with PI controllers with Clamping to reduce the number of parameters and simplify calculations

Minor:
• fixed the ADC calibration for potetiometer input when ADCx_MIN > 0
• fixed bug: small shock at initialization when current limit I_MOT_MAX is set very small e.g. 1 A
2019-10-31 22:07:52 +01:00
EmanuelFeru 1376793710 Improvements and Issues implementation
Major:
- Issue #3: added raw ADC1, ADC2 values to the setScopeChannel
- Issue #4: added functionality for joystick control. Middle resting potis are now supported (by default it is enabled)
- Issue #6: implemented that board does not power-off after a software reset due to flashing
- added Rate constraints for Input target for smoother response

Minor:
- added 2 beep sound when motors get enabled
- minor bugfixes
2019-10-27 18:21:04 +01:00
EmanuelFeru 1cc8b3475f Visual updates 2019-10-22 21:45:47 +02:00
EmanuelFeru af14b3c4b1 Improved Field Weakening
The performance of the Field Weakening is improved by reducing noise at higher speeds.
2019-10-21 17:51:09 +02:00
EmanuelFeru f991751f68 Added overflow protection
- added aditional protection for fixed-point overflow
- no other functional change
2019-10-20 19:59:16 +02:00
EmanuelFeru 8771742558 Floating-point converted to fixed-point
The follwing were converted to fixed-point
- battery voltage
- board temperature
- filters for steer and speed
- mixer calculation

Starting from this moment, the firmware is floating point free, meaning it runs more efficiently.
2019-10-20 13:31:47 +02:00
EmanuelFeru f6fc825e5f DC Link converted to fixed-point 2019-10-12 19:51:31 +02:00
EmanuelFeru 0527bd770c Added fixed-point low pass filter functions
Preparation of the low pass filter functions. They will be used to replace floating point filters.
2019-10-06 22:43:08 +02:00
EmanuelFeru 5b0b6fecf2 Initial commit 2019-10-06 15:09:15 +02:00