From 8b0b2607d4c8a014fad3f0d4d92765c23a257a08 Mon Sep 17 00:00:00 2001 From: Jordan Cormack <37104498+jordancormack@users.noreply.github.com> Date: Wed, 23 Aug 2023 12:57:03 +0100 Subject: [PATCH 1/3] Update bldc_driver_6pwm.md changed BLDCDriver6PWM name in code examples from 'motor' to 'driver' for consistency with the rest of the docs. --- .../code/drivers/bldc_driver/bldc_driver_6pwm.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_6pwm.md b/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_6pwm.md index 9ba520d..db47625 100644 --- a/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_6pwm.md +++ b/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_6pwm.md @@ -32,7 +32,7 @@ To create the interface to the BLDC driver you need to specify the 6 `PWM` pin n // - phB_h, phB_l - B phase pwm pin high/low pair // - phB_h, phC_l - C phase pwm pin high/low pair // - enable pin - (optional input) -BLDCDriver6PWM motor = BLDCDriver6PWM(5,6, 9,10, 3,11, 8); +BLDCDriver6PWM driver = BLDCDriver6PWM(5,6, 9,10, 3,11, 8); ```
⚠️ 6 PWM configuration is very hardware specific and please make sure to respect certain guidelines in order for it to work properly! @@ -65,7 +65,7 @@ In hardware 6 PWM mode the user uses only one timer, usually Timer 1 for all the Where `T1Cx` are the Timer 1 channels and `T1CxN` are their complementary channels (inverted channels). Each pair of `T1Cx` and `T1CxN` is used for one pair of the high/low PWM pins. The library will configure the necessary timers and registers if you provide these pins to the constrictor of the `BLDCDriver6PWM` class. For example: ```cpp // BLDCDriver6PWM( int phA_h, int phA_l, int phB_h, int phB_l, int phC_h, int phC_l, int en) -BLDCDriver6PWM motor = BLDCDriver6PWM(PA8, PB13, PA9, PB14, PA10, PB15); +BLDCDriver6PWM driver = BLDCDriver6PWM(PA8, PB13, PA9, PB14, PA10, PB15); ``` #### Software 6 PWM mode @@ -73,7 +73,7 @@ If it is not possible to use the hardware 6 PWM mode with your board Date: Sun, 3 Sep 2023 17:08:21 +0200 Subject: [PATCH 2/3] correct initFOC description for API changes --- .../simplefoc_library/code/motors/bldc_motors.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/simplefoc_library/code/motors/bldc_motors.md b/docs/simplefoc_library/code/motors/bldc_motors.md index 16a1edb..7457495 100644 --- a/docs/simplefoc_library/code/motors/bldc_motors.md +++ b/docs/simplefoc_library/code/motors/bldc_motors.md @@ -258,22 +258,20 @@ The alignment procedure will have to move your motor several times and might not ### Step 6.1 Skip alignment - position sensor -If you are using absolute sensors such as magnetic sensors or hall sensors, once you have done the alignment procedure and once you have the motor's zero electrical offset sensor direction you no longer need the full calibration sequence. Therefore, to the `motor.initFOC()` you can provide the sensor offset `zero_electric_offset` and sensor direction `sensor_direction` to avoid alignment procedure: -```cpp -// align sensor and start FOC -//motor.initFOC(zero_electric_offset, sensor_direction); -motor.initFOC(2.15, Direction::CW); -``` -The same can be done by using the motor parameters: +If you are using absolute sensors such as magnetic sensors or hall sensors, once you have done the alignment procedure and once you have the motor's zero electrical offset sensor direction you no longer need the full calibration sequence. + +In this case you can set the sensor offset `zero_electric_offset` and sensor direction `sensor_direction` in the motor parameters to avoid the alignment procedure: ```cpp -// align sensor and start FOC +// set calibration values motor.zero_electric_offset = 2.15; // rad motor.sensor_direction = Direction::CW; // CW or CCW +// then call initFOC() motor.initFOC(); ``` You can find these values by running the `find_sensor_offset_and_direction.ino` example. -More generally, if you know any of these two values make sure to provide and the `iniFOC` will skip that part of the calibration. For example, for encoder sensors the zero electrical offset changes all the time but the sensor direction will stay the same so you can provide it and skip a large part of the calibration sequence. +If you set either of these two values the `initFOC` will skip that part of the calibration. For example, for encoder sensors the zero electrical offset changes all the time but the sensor direction will stay the same so you can provide it and skip a large part of the calibration sequence. + ### Step 6.2 Skip alignment - current sense For the current sensors it is as well possible to avoid the calibration procedure an that is done by specifying the curren sense flag called `skip_align`: From 2701ebb3f4d05062c70d81c0640bb2b58181172f Mon Sep 17 00:00:00 2001 From: Richard UngerDate: Thu, 21 Sep 2023 20:01:13 +0200 Subject: [PATCH 3/3] update docs for 2.3.1 release --- .../code/current_sense/index.md | 3 ++ .../code/current_sense/inline.md | 1 + .../code/current_sense/low_side.md | 4 +- docs/simplefoc_library/code/drivers/index.md | 1 + docs/simplefoc_library/work_roadmap.md | 6 ++- index.md | 43 ++++++------------- 6 files changed, 26 insertions(+), 32 deletions(-) diff --git a/docs/simplefoc_library/code/current_sense/index.md b/docs/simplefoc_library/code/current_sense/index.md index c73001b..1227c14 100644 --- a/docs/simplefoc_library/code/current_sense/index.md +++ b/docs/simplefoc_library/code/current_sense/index.md @@ -62,6 +62,9 @@ teensy | ✔️ | ❌ | ❌ Raspberry Pi Pico | ✔️ | ❌ | ❌ Portenta H7 | ✔️ | ❌ | ❌ nRF52 | ✔️ | ❌ | ❌ +Renesas (UNO R4) | ❌ | ❌ | ❌ + +Note: current sensing on Renesas MCUs will be added in a future release. ## Digging deeper diff --git a/docs/simplefoc_library/code/current_sense/inline.md b/docs/simplefoc_library/code/current_sense/inline.md index 46a5e92..bf435ef 100644 --- a/docs/simplefoc_library/code/current_sense/inline.md +++ b/docs/simplefoc_library/code/current_sense/inline.md @@ -32,6 +32,7 @@ SAMD51 | ✔️ Teensy | ✔️ Raspberry Pi Pico | ✔️ Portenta H7 | ✔️ +Renesas (UNO R4) | ❌ (TBD) ## Hardware configuration To instantiate the inline current sensor using the SimpleFOClibrary just create an instance of the class `InlineCurrentSense`. diff --git a/docs/simplefoc_library/code/current_sense/low_side.md b/docs/simplefoc_library/code/current_sense/low_side.md index e1f0129..6475031 100644 --- a/docs/simplefoc_library/code/current_sense/low_side.md +++ b/docs/simplefoc_library/code/current_sense/low_side.md @@ -39,6 +39,7 @@ SAMD51 | ❌ Teensy | ❌ Raspberry Pi Pico | ❌ Portenta H7 | ❌ +Renesas (UNO R4) | ❌ (TBD) ### Important hardware considerations @@ -182,7 +183,7 @@ motor.linkCurrentSense(¤t_sense); ### Where to place the `current_sense` configuration in your FOC code? -It is very important that the the current sensing `init` function is called after the `BLDCMotor` and `BLDCDriver` init functions are called. Which will make sure that the driver is enabled when current sense calibration is taking place. Also, it is important that the current sense `init` function is called before starting the foc algorithm with the `initFOC` function. +It is very important that the the current sensing `init` function is called after the `BLDCDriver` init function is called. This will make sure that the driver is enabled when current sense calibration is taking place. Also, it is important that the current sense `init` function is called before initializing the motor and starting the foc algorithm with the `initFOC` function. So the suggested code structure would be: @@ -207,6 +208,7 @@ void setup(){ } ``` Function `initFOC()` will make sure that the `BLDCDriver` and `LowsideCurrentSense` classes are both well aligned, it is very important that the phase `A` of the current sense is exactly the phase `A` of the driver, phase `B` of the current sense exactly pahse `B` of the driver and the same for the phase `C`. To verify this, the `initFOC` will be calling the current sense's function `current_sense.driverAlign(...)`. + ### Alignment with the motor phases `driverAlign(...)` The current sense and the driver alignment inside `initFOC` is done by calling the function: diff --git a/docs/simplefoc_library/code/drivers/index.md b/docs/simplefoc_library/code/drivers/index.md index e50fa63..3040d5c 100644 --- a/docs/simplefoc_library/code/drivers/index.md +++ b/docs/simplefoc_library/code/drivers/index.md @@ -42,5 +42,6 @@ samd21/51 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ teensy | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ Raspberry Pi Pico | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ Portenta H7 | ✔️ | ✔️ | ✔️ | ❌ | ✔️ +Renesas (UNO R4 Minima) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ * For ESP32, the support for 6 PWM depends on the model of ESP32. The models that have a MCPWM peripheral support 6 PWM, the ones that do not only support the other PWM modes. \ No newline at end of file diff --git a/docs/simplefoc_library/work_roadmap.md b/docs/simplefoc_library/work_roadmap.md index 728c904..cec5ffc 100644 --- a/docs/simplefoc_library/work_roadmap.md +++ b/docs/simplefoc_library/work_roadmap.md @@ -49,6 +49,7 @@ For more info about the features of library releases visit the [github releases ## MCU support - [ ] ESP8266 - initial - [ ] Portenta H7 - initial +- [ ] Renesas support - initial - [x] Arduino leonardo - [x] Raspberry pi Pico - [PR #78](https://github.com/simplefoc/Arduino-FOC/pull/78) - [x] SAM - Arduino DUE @@ -56,11 +57,12 @@ For more info about the features of library releases visit the [github releases - [x] Teensy support - [x] ESP32 support - [x] STM32 Nucleo support -- [x] STM32 BLuepill support +- [x] STM32 Bluepill support +- [x] nRF52 support - [x] Hardware specific code separation : easier porting in between devices `hardware_utils.cpp/.h` ## Driver support -- [ ] Driver support: Disable the pahses in 6PWM mode +- [x] Driver support: Disable the phases in 6PWM mode - [x] Driver support: Implement support for MOSFET control low and high pairs - [x] Driver support: DRV8302 borads diff --git a/index.md b/index.md index 2629663..12efb44 100644 --- a/index.md +++ b/index.md @@ -29,36 +29,21 @@ Therefore this is an attempt to: - *Medium-power* BLDC driver (<30Amps): [Arduino SimpleFOCPowerShield ](https://github.com/simplefoc/Arduino-SimpleFOC-PowerShield). --## Arduino SimpleFOClibrary v2.3.0 +## Arduino SimpleFOClibrary v2.3.1 This video demonstrates the Simple FOC library basic usage, electronic connections and shows its capabilities. @@ -79,7 +64,7 @@ This video demonstrates the Simple FOC library basic usage, electronic connectio - **Cross-platform**: - Seamless code transfer from one microcontroller family to another - Supports multiple [MCU architectures](microcontrollers): - - Arduino: UNO, MEGA, DUE, Leonardo .... + - Arduino: UNO, MEGA, DUE, Leonardo, Nano, UNO R4, MKR .... - STM32 - ESP32 - TeensyNEW RELEASE 📢: SimpleFOClibrary v2.3.0 see release
- - Arduino Mega 6pwm more timers supported - - Arduino boards - frequency change support either 32kHz or 4kHz - - Arduino Uno - synched timers in 3pwm and 6pwm mode [#71](https://github.com/simplefoc/Arduino-FOC/issues/71) - - Teensy 3.x initial support for 6pwm - - Teensy 4.x initial support for 6pwm - - Example for v3.1 SimpleFOCShield - - RP2040 compatibility for earlehillpower core [#234](https://github.com/simplefoc/Arduino-FOC/pull/234) [#236](https://github.com/simplefoc/Arduino-FOC/pull/236) - - More flexible monitoring API - - start, end and separator characters - - decimal places (settable through commander) - - Added machine readable verbose mode in `Commander` [#233](https://github.com/simplefoc/Arduino-FOC/pull/233) - - *Simple**FOC**WebController* - Web based user interface for SimpleFOC by [@geekuillaume](https://github.com/geekuillaume) - [webcontroller.simplefoc.com](https://webcontroller.simplefoc.com) - - bugfix - `MagneticSensorPWM` multiple occasions - [#258](https://github.com/simplefoc/Arduino-FOC/pull/258) - - bugfix - current sense align - added offset exchange when exchanging pins - - bugfix - trapezoid 150 fixed - - bugfix - 4pwm on ESP8266 [#224](https://github.com/simplefoc/Arduino-FOC/pull/224) - - Additional `InlineCurrentSense` and `LowsideCurrentSense` constructor using milliVolts per Amp [#253](https://github.com/simplefoc/Arduino-FOC/pull/253) - - STM32L4xx current sense support by [@Triple6](https://github.com/Triple6) (discord) [#257](https://github.com/simplefoc/Arduino-FOC/pull/257) - - phase disable in 6pwm mode - - stm32 - software and hardware 6pwm - - atmega328 - - atmega2560 - - Lag compensation using motor inductance [#246](https://github.com/simplefoc/Arduino-FOC/issues/246) - - current control through voltage torque mode enhancement - - extended `BLDCMotor` and `StepperMotor` constructors to receive the inductance paramerer - - can also be set using `motor.phase_inductance` or through `Commander` +NEW RELEASE 📢: SimpleFOClibrary v2.3.1 see release
+ - Support for Arduino UNO R4 Minima (Renesas R7FA4M1 MCU - note UNO R4 WiFi is not yet supported) + - Support setting PWM polarity on ESP32 (thanks to [@mcells](https://github.com/mcells)) + - Expose I2C errors in MagneticSensorI2C (thanks to [@padok](https://github.com/padok)) + - Improved default trig functions (sine, cosine) - faster, smaller + - Overridable trig functions - plug in your own optimized versions + - Bugfix: microseconds overflow in velocity mode [#287](https://github.com/simplefoc/Arduino-FOC/issues/287) + - Bugfix: KV initialization ([5fc3128](https://github.com/simplefoc/Arduino-FOC/commit/5fc3128d282b65c141ca486327c6235089999627)) + - And more bugfixes - see the [complete list of 2.3.1 fixes here](https://github.com/simplefoc/Arduino-FOC/issues?q=is%3Aissue+milestone%3A2.3.1_Release) + - Change: simplify initFOC() API ([d57d32d](https://github.com/simplefoc/Arduino-FOC/commit/d57d32dd8715dbed4e476469bc3de0c052f1d531). [5231e5e](https://github.com/simplefoc/Arduino-FOC/commit/5231e5e1d044b0cc33ede67664b6ef2f9d0a8cdf), [10c5b87](https://github.com/simplefoc/Arduino-FOC/commit/10c5b872672cab72df16ddd738bbf09bcce95d28)) + - Change: check for linked driver in currentsense and exit gracefully ([5ef4d9d](https://github.com/simplefoc/Arduino-FOC/commit/5ef4d9d5a92e03da0dd5af7f624243ab30f1b688)) + - Compatibility with newest versions of Arduino framework for STM32, Renesas, ESP32, Atmel SAM, Atmel AVR, nRF52 and RP2040