BGC Board I2C Trouble

Hi everyone,

I am having some trouble with I2C on a BGC 3.0 (commonly also sold as BGC 3.1) board.
I got the boot-loader for the Arduino Pro Mini onto it using a USBasp.
There was some trouble re-flashing new stuff, but I soldered a Reset-Button on, to bridge ground and RST and that works well for me.
Here’s my problem:
Whenever I connect my AS5600 to the board using the I2C pins I can no longer use serial or upload new sketches. When uploading this is the error I get:

avrdude: stk500_paged_load(): (a) protocol error, expect=0x10, resp=0x20
avrdude: stk500_cmd(): programmer is out of sync
avr_read(): error reading address 0x0000
    read operation not supported for memory "flash"
avrdude: failed to read all of flash memory, rc=-2
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x21
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x21

I have tried the same code and same sensor on a Mega and it works perfectly…
Anybody have any idea why the board stops working?

Thanks for any help in advance

I have gotten the driver test to work, so at least I know that works, but in testing I have also found another problem…
Apart from failing to upload at all when I2C is connected, it also seems that its unstable the larger the upload size… To the point where its a really really unpleasant experience to work with → unusable if I ever wanted to tune something or having to go in for small changes…

I have ordered a new board which will hopefully arrive within a couple of weeks and I have some concern since it seems the auto-reset-circuit doesn’t work as I always have to press my reset button when flashing. And before using the USBasp I tried flashing over “Arduino as ISP” from a Nano and the area over what I am guessing is the voltage regulator for the chip got very hot, so now my concern is that the board might be broken, but I can’t smell/see anything and the current consumption over USB is about what I’d expect from the board…

I also got the open loop example to work by flashing firmware directly using the programmer…
But this is day 3 of trying to get this to work and honestly I am getting really tired of these problems…

Hey @Thor, welcome to SimpleFOC…

I don’t really know what to say… it sounds like you have figured things out, and are having a similar experience to me…
I played with the BGC boards for a bit initially, as I was looking for a small 2-motor driver… it seems like a really nice package.

But in my experiments I made two discoveries which eventually led me to move on to other boards:

  1. while it is possible to get FOC working on 2 motors on the Atmel chips, it is so near the limits of the board that there would be no more overhead for any kind of extra sensor code, comms, etc… this is both in terms of memory usage and performance. The performance of the board with 2x closed loop on I2C sensors is such that it can only just run gimbal motors.
  2. I2C in general is a bit slow for FOC - you won’t get much more than 1kHz loop iteration speed if the loop has to wait on I2C comms… while 1kHz is ok for gimbal motors, that also limits the performance.

If you want to stick with the BGC boards, it will be an optimization game - eliminating code you don’t need, getting rid of strings etc to conserve memory, and seeing what you can do to shave the execution time down. There is a minimal branch of the SimpleFOC code on GitHub which might be a better starting point.

If you want to switch to another board, STM makes a demo board for a 3-axis gimbal controller (around $80), or there are the Storm32 gimbal boards (around $25 - but they come with their own set of difficulties!)… or there are various drivers which can be used with different boards like the newer Arduino Nano33s, STM32 or ESP32 boards.

Strange problem. I tried connect AS5600 over I2C and it works… As well MPU6050 and AS5600 on the same time. Also works…

Yea thanks.
Sadly most drivers are not available (on a board), or they are to high power, big and expensive. I was really looking for a good low power, cheap, small solution. If I wanted high power I could have just bought an Odrive or something. But I really like the idea of no mater how small my project, I can equip everything with a good performance brushless controller.
As I was looking specifically into gimbal motors I still think the BGC boards could be just enough and looking at youtube and what other people have done with it I think that holds. They also seem to have not had these types of issues so I hope the new board will solve them (if it does I will update it here).
I found a Storm32 BGC that arrives relatively quickly, so I will try around with that a bit.

Its just such odd behavior that connecting something to I2C (not even uploading code that uses it, but just physically connecting to the ports), would make flashing and serial stop working.

At any rate, thanks for the help.

Not sure at all if this fits your use case, if you are willing to wait a few weeks, ill test and open it

As promised I have come back with an update.

First up: While I got to a point where I could flash stuff to the “Storm32 BGC Board” I never got a Serial-Bootloader on it, or got Serial to work at all for that matter. So that board is currently outside my skill-level it seems.

On the “Atmel BGC” Board though:

Having received a new one I started testing. Using the USBasp I tested a couple of bootloaders, the new Nano Bootloader doesn’t work, but the old Nano Bootloader works. The Pro Mini Bootloader also works fine, so maybe its a problem with the higher Baud Rate on the new Nano Bootloader. Eather way just stick to the tried an tested Pro Mini Bootloader everyone else uses and you should be good.

Auto Flash Detect:
Even my new board does not auto detect when I want to flash new firmware to it… So it has to be reset manually. For my own convenience I soldered a button between GND and RST and that works well for me. I temporary abandoned PlatformIO for the ArduinoIDE just to have something known and familiar. In the settings there is an option for more verbose output when uploading. I recommend activating that, as it makes things more transparent. My new workflow involves pressing upload, then holding down my reset button until the output shows that its trying to upload. From there you can let go and make sure to wait until uploading and reading back is done.

Problems with the other old board:
They just disappeared… I don’t know why… I established my new workflow on the new board and it just works perfectly on the old board. Dunno whats I did wrong back then.
I think I now have a good grasp on this board, so if anyone is having trouble with them, or needs some help feel free to ask and I’ll try my best to help.
Next up I’ll try to use two AS5600’s at the same time on this board. Should be fun.

1 Like

Hello! I am trying to work with the BGC3.0 board. I have some questions:

  1. once the bootloader is uploaded does the BGC3.0 works like an Arduino, in the sense I can program and upload the sketch by the IDE? Or I have to upload the sketch using an Arduino board?
  2. Do you think it is possible to burn the bootloader using an “Arduino as ISP”?
  3. What USBasp did you use? Do you think this can play well ?
  4. Apart the problem of resetting during the flashing phase, what is the workflow using the USBasp? And the setup? I need an Arduino together with the USBasp? In which way?
    Thank you very much

Once it has the right boot loader it works as normal from the IDE…

Yes, its how I did it… :slight_smile: