|
| 1 | +# Silabs Hardware-Specific Examples for SimpleFOC |
| 2 | + |
| 3 | +This folder contains **hardware-specific example projects** for running the [SimpleFOC](https://docs.simplefoc.com/) library on **Silicon Labs EFR32 microcontrollers** (tested on Arduino Nano Matter). Each example demonstrates a motor control use case using a **6PWM BLDC driver**. |
| 4 | + |
| 5 | +**Example List** |
| 6 | + |
| 7 | +- **efr32_hall_sensor_velocity_6pwm** |
| 8 | + - Demonstrates velocity control of a BLDC motor using a Hall sensor for feedback and a 6PWM driver on an EFR32 board. |
| 9 | + |
| 10 | +- **efr32_open_loop_velocity_6pwm** |
| 11 | + - Shows how to run a BLDC motor in open-loop velocity mode (no sensor feedback) using a 6PWM driver on EFR32. |
| 12 | + |
| 13 | +- **efr32_torque_velocity_6pwm** |
| 14 | + - Example of torque and velocity control for a BLDC motor using a 6PWM driver on EFR32, suitable for advanced control scenarios. |
| 15 | + |
| 16 | +## Hardware Setup |
| 17 | + |
| 18 | +Required hardware: |
| 19 | + |
| 20 | +* **Arduino Nano Matter (EFR32MG24)** [https://docs.arduino.cc/hardware/nano-matter/](https://docs.arduino.cc/hardware/nano-matter/) |
| 21 | +* **DRV8305 BoosterPack (BOOSTXL-DRV8305EVM)** |
| 22 | +* **BLDC Motor: DF45M024053 – A2** |
| 23 | +* USB cable for programming and serial monitor |
| 24 | + |
| 25 | +👉 Connect the Arduino Nano Matter board to the DRV8305EVM according to the board pin mapping (phase outputs, PWM inputs, and Hall sensor connections). |
| 26 | + |
| 27 | +Of course. Here is a clear wiring table for your README markdown file, based on the connections shown in the user guide. |
| 28 | + |
| 29 | +### Wiring Table: Arduino Nano Matter to BOOSTXL-DRV8305 & BLDC Motor |
| 30 | + |
| 31 | +This table describes the connections between the Arduino Nano Matter, the TI BOOSTXL-DRV8305 driver board, and a 3-phase BLDC motor with Hall sensors. |
| 32 | + |
| 33 | +| From (Nano Matter Pin) | To (DRV8305 BoosterPack Pin) | BLDC MOTOR | Function / Description | |
| 34 | +| :--- | :--- | :--- | :---| |
| 35 | +| `3.3V` | `3V3` | HALL/ENC Supply* | 3.3V Power the BoosterPack provides 3.3V through an LDO | |
| 36 | +| `GND` | `PowerSupply GND` | HALL/ENC sensor GND | Common Ground | |
| 37 | +| N/A | `PowerSupply 12V` | N/A | Power supply for power stage 4.4 to 45 V, consider motor power| |
| 38 | +| `A0` | `ISENA` | N/A | Phase A current sense | |
| 39 | +| `A1` | `ISENB` | N/A | Phase B current sense | |
| 40 | +| `A2` | `ISENC` | N/A | Phase C current sense | |
| 41 | +| `A3` | `VSENA` | N/A | Phase A Voltage sense (Optional, not mandatory to run examples) | |
| 42 | +| `A4` | `VSENB` | N/A | Phase B Voltage sense (Optional, not mandatory to run examples) | |
| 43 | +| `A5` | `VSENC` | N/A | Phase C Voltage sense (Optional, not mandatory to run examples)| |
| 44 | +| `A6` | `VSENVPVDD` | N/A | DC BUS Voltage sense (Optional, not mandatory to run examples)| |
| 45 | +| `D0` (MOSI1) | `SDI` | N/A | DRV8035 SPI connection, configuration and status reading (Optional, not mandatory to run examples)| |
| 46 | +| `D1` (MISO1) | `SDO` | N/A | DRV8035 SPI connection, configuration and status reading (Optional, not mandatory to run examples)| |
| 47 | +| `D2` (SCK1) | `SCLK`| N/A | DRV8035 SPI clock, configuration and status reading (Optional, not mandatory to run examples)| |
| 48 | +| `D3` (SS1) | `SCS` | N/A | DRV8035 SPI chip select, configuration and status reading (Optional, not mandatory to run examples)| |
| 49 | +| `D4` | N/A | HALL A or Encoder A | Motor sensor connection (HALL configuration in examples) | |
| 50 | +| `D5` | N/A | HALL B or Encoder B | Motor sensor connection (HALL configuration in examples) | |
| 51 | +| `D6` | `PWMHA` | N/A | PWM Phase A High-Side Gate Signal | |
| 52 | +| `D7` | `PWMLA` | N/A | PWM Phase A Low-Side Gate Signal | |
| 53 | +| `D8` | `PWMHB` | N/A | PWM Phase B High-Side Gate Signal | |
| 54 | +| `D9` | `PWMLB` | N/A | PWM Phase B Low-Side Gate Signal | |
| 55 | +| `D10` | `PWMHC` | N/A | PWM Phase C High-Side Gate Signal | |
| 56 | +| `D11` | `PWMLC` | N/A | PWM Phase C Low-Side Gate Signal | |
| 57 | +| `D12` | `ENGATE` | N/A | Enable DRV8305 gate driver | |
| 58 | +| `D13` | N/A | HALL C or Encoder Index | Motor sensor connection (HALL configuration in examples) | |
| 59 | +| N/A | `PHASE U` | `PHASE U` | Motor phase connection | |
| 60 | +| N/A | `PHASE V` | `PHASE V` | Motor phase connection | |
| 61 | +| N/A | `PHASE W` | `PHASE W` | Motor phase connection | |
| 62 | + |
| 63 | +**Important Notes:** |
| 64 | +* **Power:** Ensure the DRV8305's `PVDD` and `GVDD` jumpers are correctly set for your motor's voltage. The power supply should rated twice as motor nominal power. The Booster pack can supply the nanomatter if nano Matter is not connected to USB. |
| 65 | +* **Rotor sensor:** Some Encoder or Hall sensors might require 5V supply, make sure of proper level shifting if required. |
| 66 | +* **SPI:** The SPI connection (`nSCS`, `SPI_CLK`, `SPI_MOSI`, `SPI_MISO`) is used to configure the DRV8305 driver IC (e.g., set gain, fault parameters). It is optional for the examples. The examples are using the defualt gate driver configuration. Only needed in case Dead time or other settings needed to be changed. |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +Below a dedicated interface board set-up connecting the Motor - Power Stage - Nano Matter. |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## Software Setup |
| 77 | + |
| 78 | +1. **Arduino IDE** |
| 79 | + |
| 80 | + * Use Arduino IDE **2.3.4 or later**. |
| 81 | + * [Download here](https://www.arduino.cc/en/software). |
| 82 | + |
| 83 | +2. **Silicon Labs Arduino Core** |
| 84 | + |
| 85 | + * Open *Boards Manager* in Arduino IDE. |
| 86 | + * Search for *Silicon Labs* and install the latest version (**2.3.0** or newer). |
| 87 | + * If not found, add this URL under *Preferences → Additional Boards Manager URLs*: |
| 88 | + |
| 89 | + ``` |
| 90 | + https://siliconlabs.github.io/arduino/package_arduinosilabs_index.json |
| 91 | + ``` |
| 92 | +
|
| 93 | +3. **SimpleFOC (Silabs-modified version)** |
| 94 | +
|
| 95 | + * Open *Library Manager* in Arduino IDE. |
| 96 | + * Search and add *Simple FOC* library |
| 97 | +
|
| 98 | +4. **(Optional) SimpleFOC Studio or web viewer** |
| 99 | +
|
| 100 | + * For runtime tuning and monitoring. |
| 101 | + * [Docs](https://docs.simplefoc.com/studio) |
| 102 | + * [Enable Monitoring](https://docs.simplefoc.com/monitoring) |
| 103 | +
|
| 104 | +--- |
| 105 | +
|
| 106 | +## Running the Examples |
| 107 | +
|
| 108 | +1. Open the `.ino` file in Arduino IDE. |
| 109 | +2. Select your **Arduino Nano Matter** board. |
| 110 | +3. Compile & upload. |
| 111 | +4. Open the Serial Monitor (115200 baud) |
| 112 | +5. (Optional) Connect with monitoring tools. |
| 113 | + 1. Modification of the example code is necessary to enable monitoring feature. |
| 114 | + 2. [Enable Monitoring](https://docs.simplefoc.com/monitoring) |
| 115 | +
|
| 116 | +### Example Commands |
| 117 | +
|
| 118 | +Send commands to control the motor: |
| 119 | +
|
| 120 | +``` bash |
| 121 | +M50 # Run clockwise at 50 rad/s |
| 122 | +M-50 # Run counter-clockwise at 50 rad/s |
| 123 | +M0 # Stop motor |
| 124 | +``` |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## Notes on EFR32 Porting |
| 129 | + |
| 130 | +The EFR32 port of SimpleFOC includes: |
| 131 | + |
| 132 | +* Full **6PWM driver support** (deadtime insertion, duty cycle updates). |
| 133 | +* **Current sense integration** (low-side sensing tested). |
| 134 | +* **Arduino-style pin mapping** for portability. |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +## References |
| 139 | + |
| 140 | +* [SimpleFOC Documentation](https://docs.simplefoc.com/) |
| 141 | +* [Commander Interface](https://docs.simplefoc.com/commander_interface) |
| 142 | +* [Arduino Nano Matter Manual](https://docs.arduino.cc/tutorials/nano-matter/user-manual/) |
| 143 | +* [Silicon Labs Arduino Core](https://github.com/SiliconLabs/arduino) |
| 144 | +* [SimpleFOC Studio](https://github.com/JorgeMaker/SimpleFOCStudio) |
| 145 | + |
| 146 | + |
0 commit comments