Xiaomi Cyber dog geared motor ~$60

Hi @hansihe , welcome to SimpleFOC!

Thank you very much for sharing!

I know this motor is generating a lot of interest in our community, so I think people will be happy to see these pics and hear about your experiences!

We have a port to GigaDevice MCUs underway thanks to @Candas1 , but I’m not sure this exact MCU was in scope so far.

2 Likes

The SimpleFOC driver I created was for GD32F130.
In the past I used same firmware (not based on SimpleFOC) on GD32F103 and STM32F103 because it’s mostly compatible.
If GD32F303 is mostly compatible with STM32F303, a STM32F3 current sense driver (doesn’t exist yet in SimpleFOC) could work on the GDF303.
I happen to have a nucleo board with STM32F303 so I could look at it later.

2 Likes

I machine translated the manual to English with DeepL here

2 Likes

Great pix, thank you.

This seems an STM 303 clone as you noted, be interesting to check if it can be programmed.

The SWD is already exposed next to the MCU, you need pogo pins, that’s really promising. This is a great find and could run simplefoc, based on the pics. We just need to see which pins are hooked to what.

I ordered one but will arrive in weeks. Once I get it I can x-ray the board to see the pin connections.

Cheers,
Valentine

1 Like

I just soldered to the SWD connection points. I can confirm I can attach to it with my blackmagic probe just as a normal STM32. It has no protection bits set, I read out the firmware and confirmed mine shipped with the 2.0 version of the firmware from the ZIP.

Can draw up a rough schematic for the board tomorrow if people are interested

For anyone else ordering this motor, you will want to order some of the male variant for this connector. I only had normal XT30s around, so I had to solder to the CAN probe points on the inside.

https://www.aliexpress.com/item/1005005500046003.html

It is a XT30 with 2 pins at the side. The XT30 is for power, the side pins are the CANH/L lines.

1 Like

If the PCB is two-layered then no x-ray is needed, that would be great, thank you.

Cheers,
Valentine

Hi, I spent some time tracing the driver PCB, and I think I’ve figured out how all of the fet driver and encoder pins connect to the MCU (see pin map here). I also got a quick blinky program working on the board over the exposed SWD header; it is very important to note that you must select STM32F103RETx when uploading, as trying to use the STM32F303RETx profile causes the GPIO to not work at all (see forum post here).
Unfortunately I never got around to porting the 6EDL7141 example code from infineon to arduino, maybe someone else with more time can give it a shot.

6 Likes

You are right the vesc port to GD32F303 I linked before is using the STM32F1 HAL drivers.
Then it should be OK with the SimpleFOC F1 current sense drivers.
But to work out of the box the current sense pins should be on the same ADC.

I keep buying stuff and forgetting it, I have 2 of this:

1 Like

@hansihe - was wondering if you’ve got any further with this? E.g how do you do rx/tx. Thinking about buying one myself.

This could be quite an important all-in-one solution if we can get it running well.

@Owen_Williams What do you mean by how to do TX/RX?

If you mean the physical interface, the motor exposes a CAN interface. The connector is an XT30 with 2 extra pins on the side, I believe I linked an Aliexpress listing for the connector above.

If you mean the vendor firmware, I have successfully talked to it over CAN, but I believe I accidentally sent an undocumented encoder calibration command, which wiped some parameters in memory. The debugger software they supply offers a method to do encoder calibration, which I presume will fix things, but the debugger app requires a very particular CAN adapter I am currently waiting for in the mail.

If you mean through SWD, yep, my debugger connects successfully and can interact with the chip. It does not ship with any debug protect bits set.

My primary interest is getting the motor running, and I don’t really care if that involves using the official firmware or using it with a SimpleFOC port. If there is anything I can help with regarding a SimpleFOC port I would of course be willing to do so, but I think the pin mappings @nanoparticle provided should be enough to get started on a port at least if anyone want to.

Sorry, I meant serial rx/tx. To make progress on getting simplefoc running on this actuator would require debugging which would require serial rx/tx. I know you can do some debugging with swdio/clk but it isn’t a printf type of debugging.

I understand that serial rx/tx is not important if you are happy with stock firmware.

Ah, I understand, that makes sense :slight_smile:

You could do semihosting or RTT, but I imagine there are probably also unused pins on the MCU we could solder to in order to get UART.

I desoldered the MCU to look for vias underneath + check for unused pins.

It seems like pin 16/PA2/USART1_TX and 17 PA3 USART1_RX are unused and usable for UART.

In the image Pin 1 is in the bottom right corner by the crystal.

1 Like

would you possibly be able to post that 3d model for the motor. I am planning on the start of a mini humanoid and this seems very intriguing to incorporate. Thank you very much

A file with the 3d model is published earlier in the thread:

1 Like

@hansihe that’s useful info. I don’t much like soldering directly on to chips but that location is definitely as easy as it could be.

Awesome and thank you for the info. I’m definitely interested in getting a few of these.

Any updates on the motor? :metal:

I have the motor working with the stock firmware. My preliminary tests seem very promising.