I just wanted to make a quick post regarding the B-G431-ESC board and using closed loop control with current sensing. Since upgrading to SimpleFOC v2.2.3 (thank you all!), I’ve been able to control my gimbal motor torque using current sensing. The only thing I had to add was:
One question for the community - since I am now using the existing broken out pins for I2C, does anyone know if there are other broken out pins (UART maybe?) that could be used for an incremental encoder like the AMT103? I would need 2 digital pins for it, since i already have 5V and GND available.
If you are using two of the hall sensor pins for I2C, then you are left actually with 4 free digital pins. The tx/rx for uart, the third hall pin and the pwm pin next to the uart pins.
Using the UART pins is convenient because they are next to each other, however, if you need uart debugging you can keep them for serial and use the third hall pin and the PWM pin as digital i/o pins. I believe. Give it a try. You will need a lot of patience and some extra-fine soldering skills however. Whoever designed that board was some kind of engineering sadist.
Lol yeah, really! The G4 is such a powerful MCU, it’s such a shame they crippled this demo board with so few IOs…
In terms of attaching an encoder, it can work on the Hall Sensor Inputs, I think.
Any digital pins that support interrupts can be used with our Encoder class…
To use the STM32HardwareEncoder class from our drivers repository the pins all have to be on the same timer…
If they broke out an SPI channel this board could have been a big winner, even with the overheating problem. UART, Hall/I2C, SPI and CAN. Users can always add a good heatsink to control the temperature.
Update - I was successfully able to use an AMT102 encoder with the B-G431. I used the PWM and Hall 1 pin (PA15, PB6). I set the internal pullups to be used in the SimpleFOC code. The only issue I found was that with high sensor resolution (2048 ppr) and speeds above 25 rad/s, there was some jitter in velocity mode. Decreasing the ppr to 1024 via the dip switches alleviated the issue. So now, I can control my motor using the AMT encoder, and have the AS5600 sensor on I2C for sensing another angle in my project. Thanks for help folks!
I’m grateful to the community and all the efforts you guys have put in this.
I am able to run open-loop motion control without any issues on the B-G431 board (running through the Arduino IDE). But running into issues when working with Closed Loop. I’m using the AS5600 in I2C mode (and the sensor is working fine by itself). I’m trying to see if @wrcman555 's suggestion to set the build_flags would work for me (not sure, but just trying to troubleshoot). How do I set this up in the Arduino IDE?
I’m using boards-manager library from stm32duino’s github.