B-G431B-ESC1 Discovery kit info

Hi @Owen_Williams,
By the way, from my side, I have tested the second way and it doesn’t works with me, under Arduino IDE and platformio. It is weird.

The RX seems good of the main board.

Hi @Owen_Williams,
Was you sure it worked from your side ? Because, I finally found what it was.
In the file “Variants.h” there was a mistake of typing:

// Default pin used for 'Serial' instance (ex: ST-Link)
// Mandatory for Firmata
#define PIN_SERIAL_RX USART2_TX <-- Here, I modified to RX
#define PIN_SERIAL_TX USART2_TX

Best Regards

Nice.
I did see that mistake on my investigations yesterday. I didn’t think it was the cause because it talked about being used for Firmata. I pushed the fix yesterday anyway.

Glad to here you are rolling!

Nice work, guys. I have spent the last weeks since I originally asked about the B-G431B-ESC1 trying to get my a balance bot running using a gimbal driver. It’s getting closer, the main issue I am having is horrendous electromagnetic interference (I think) from either the motors or driver which is causing my MPU6050 accelerometer to lock up the i2c bus. You know, the usual fun stuff.

Anyway, back to the B-G431B-ESC1. My second Discovery kit arrived today so I will probably swap the gimbal driver out for them and just run them over usb given that it sounds like the UART is busted when the programmer is still connected.

I had a quick look at the schematic and the MCU and it looks like the default i2c pins for that chip are broken out to the hall/encoder AB channels. I will check when I get time (so maybe in the year 3000) but I wonder if it would be possible to simply boot up i2c on those pins and directly connect something like an AS6500 that way?

@Ashemah_Harrison as you say, It does look PB_7 and PB_8 can be used for i2c. You’ll need to override/uncomment a couple of lines in PeripheralPins.c otherwise the pin introspection will think you are doing something not supported by the board and throw an error. I think there WEAK keyword means you can change pinmap const in your code rather than in board definition.

1 Like

Is it the “BGC 3.0 board” you’re talking about here? I mapped the pins when I started to use it. I don’t know if you’re still interested, but I only just saw this thread…

1 Like

Not disagreeing with you in principle, but I can say that I run 2 AS5048B encoders on the BGC 3.0 board’s single I2C interface without any problems. Seems to work just fine. And the board even handily has 2 I2C inputs (for the same I2C bus): one as a solder header, and one as a JST connector, so its even quite easy to physically connect it all up…

Hey thanks for the info, that’s still really useful.

I finally worked out which way up the ISP header was which allowed for programming from a random pic and then used the pinouts from here to work out enough pins to use SoftwareSerial: https://github.com/jpmalkiewicz/brushless-gimbal-brugi-code/blob/master/definitions.h

I feel like the i2c will work in my case but I am going to have to mod SimpleFOC itself to allow for a onBeforeRead (and maybe onAfterRead) callback to allow me to correctly set up the bus with the i2c multiplexer I am using (I bought 2xAS5600’s and their address is hardcoded :expressionless:)

I now have the B-G431B-ESC1 running arduino code but not hooked up to anything. Thanks to @Owen_Williams 's PRs it just worked :slight_smile: :+1:t5:

One thing I noted, Owen, was that you said copy %HOME%/.platformio/packages/framework-arduinoststm32/disco_b_g431b_esc1.json.

This file should actually be copied to: %HOME%/.platformio/platforms/ststm32/boards/disco_b_g431b_esc1.json

Just in case that trips anyone up.

1 Like

I have been trying to set up a B-G431B-ESC1 using simpleFOC but I keep running into the following error:

exec: “/bin/arm-none-eabi-g++”: file does not exist

I cloned the Arduino_Core_STM32 fork from @Owen_Williams and the file above most definitely does exist and in the correct directory (as far as I can tell). I get the same error in VS Code and the Arduino IDE and even if I explicitly add the location of the above into the path in VS Code it still insists that the file doesn’t exist. Any suggestions would be appreciated.

I will try a completely fresh install tonight and I will also try @Marc_O steps directly.

On the encoder side I have been experimenting with the AEAT-6600-T16 chip which is similar to the AS5600 but is a 16bit unit. It uses SSI instead of SPI but more importantly has ABI and UVW incremental outputs. It needs the OTP memory to be written to configure it so I am in the process of writing a script for that but reading from the chip is dead easy with any 2 digital pins.

Can you build for any stm32 boards?
Might be worth picking another board (e.g. blue pill) and trying to build a blink.ino / empty project. Sounds like a build chain issue.

It might also be worth trying to not clone my repo but just copy files over.

goodnews

Thanks for the quick response. Following your suggestion I tested on another board with no luck so I rolled back the changes I made on the assumption that I had messed up the build chain as you said. Then I only changed the 2 files as per @Marc_Os suggestion and it immediately compiled. :partying_face:

Unfortunately my first attempts of just running the open loop examples yielded zero response after upload so I will dive into it now and see what I am doing wrong.

Nice!
Have you found that these boards are really difficult to solder! Especially the hall/encoders underneath.

You are powering the board with 12V? And using BLDCMotor6PWM?
My recent tuning guide uses this board, have you seen it?

It’s been a horribly frustrating day and a half that has ended with 2 dead boards neither of which did me the courtesy of rotating a motor even one revolution before releasing the magic blue smoke.

First to answer your points, yes 12v and after a minute of contemplating the pin requirements I realised I needed to change it over to BLDCMotor6PWM. Lastly, absolutely! Access into the solder pads is a nightmare!

Now on to how I killed 2 boards in one night. On the first board I was trying to run your basic 6 step code with no luck and I had my oscilloscope connected and somewhere along the way the ground ref clip slipped from my fingers and touched the +12v line and pop. I’m not even sure how it killed the board but the programmer is completely unresponsive. I suspect if I hook up an ST link programmer the main board will still work but that is a project for another day.

Second board was just pure stupidity on my part. The only motor I have to test with only has 0.2Ohm resistance so I should be keeping the voltage below 8v if I want to stay in board spec of 40a. Naturally at 12v the board lasted all of 0.5s.

So now I get to go Christmas without an ESC to play with. Although now I’m thinking of making one of your ESC boards Owen.

Hi @4nswer,
My poor, I confirm that this board is breakable, and it is really difficult to solder.
I had damaged any with a probe in looking at the signals of 6 pwm on L6387. I have unfortunately short circuited the Hin pin (2) with the bootstrap pin (3). The output pin of the STM32G4 is damaged and this one heats a lot now but the microcontroller works again (amazing) without the pwm output of this one doesn’t work however.

Otherwise, for your information, the STM32G4 is a very powerful microcontroller (the one of the best for the motor control from my point of view).

Have a nice Christmas.

It’s just school fees for me I suppose :man_facepalming:t3:.

I’ll spend some time now looking at your driver board and the SFOC reference board. I’m thinking of creating a stackable driver board based on the NEMA 17 bolt pattern with 3 levels to the stack:

  1. encoder
  2. logic
  3. power stage

That way the end user can mix and match the 3 layers to suit their budget and application. You could do a simple build for example:

AS5600 encoder
Atmega328p
IRL540 and 4N35 based power stage

Or go fancy:

AEAT6600-T16 encoder
STM32G4
IRL40B209 with IR2136SPBF driver

In the same form factor. And by stacking you can keep the magnetic encoder away from the power stage and make the power connections really accessible.

I agree that the STM32G4 is the best looking chip for a BLDC driver, that’s why I got excited about the board, but given what I’ve learned I don’t think I’ll be buying any more any time soon.

Merry Christmas to you too :grin:

Eek 8V - that sounds way to high!! You probably want to start with a voltage limit of 0.5V if the resistance is 0.2ohms. Forget the rated 40A (at least initially) - you might get that if you have a drone fan blowing air on it. I’d try to keep it under 4A until you are comfortable with the heat. By the way I believe an 8V limit means +8 to -8V across high and low mosfets so you may be drawing more than you think.

I’ve got three of these boards and haven’t properly damaged them yet but I always use a power supply where I limit current to 0.5A until I know what I’m doing!

I’ve had to add additional pullup resistors (1K) to some of the hall phases. Without the additional pullup the hall interrupts misfire.

Oops :scream:. So the reason I had the amperage and voltage so high is because the first thing I tried to do with the board was use the standard ST tools. No matter what I did I couldn’t get the motor profile tool to run so I ended up trying higher voltages.

Oh well, lesson learned. The board that I blew with the oscilloscope was just unlucky though. I’m busy using said oscilloscope to go through the over current board now and if I can identify what I’ve fried I’ll try swap it out with parts from the board I popped with the oscilloscope. Wish me luck

I’m building a 4-wheeled / AWD electric quad with 15" hub motors from china (similar, but bigger to the hoverboard motors). And I’m looking into which controller to use.

The G431 datasheet mentions “40 A” peak. To me, that seems like quite the overstatement. Especially ‘peak’ doesn’t tell us much… for how long? Half a second?

So I have two questions for those already playing along with their G431 at home. I would be grateful if somebody could answer them (before I order).

  1. Did you have experience what’s the continuous current before the MOSFETS get hot? Potentially even cooled with a heatsink - I wouldn’t care.
  2. The FETS and caps used seem to have a 60V rating. But the datasheet says ‘6S LiPo’, so that’s only ~25V. Does anybody have more insights?

BTW, the motors I bought are rated for 48V nominal at up to 15 A (~800W). But it would be fine for me to limit them to 500W (~10A). After all, I have 4 of them, so still 2kW of power :smiley:

I don’t think the drone kit can sensible drive those motors. Probably ok for light testing though. Let’s say the mosfets are 90% efficient (unlikely) - dissipating 80W of heat just isn’t going to happen. They are tiny and have no cooling fins. The drone kits are supposed to be self cooled by the drone rotor air flow.

My guess is unless you figure a way to cool them you are unlikely to get more than 50W continuous out of them.