Close
0%
0%

CM5 Cybergear Controller

IMU and Raspberry Pi Compute module 5 controller for Xiaomi CyberGear BLDC motors

Public Chat
Similar projects worth following
210 views
0 followers
I have been using Eagle for many years now, but after Autodesk announced that they would kill off the stand-alone application, I suspect that the pricing structure will also change dramatically. Being forced to purchase the full version of Fusion 360 to be able to make boards with more that two layers and be able to use multiple schematic sheets etc is a no-go for me.

Therefore, I decided to bite the bullet and convert to KiCad. I have to say that I am rather impressed. KiCad now seems more mature than Eagle and also easier to use in many respects.

I needed a new project for this "self learning" excercise. Since I already have sourced several CM5 modules with wifi, A CM 5 devkit and also have a few Xiaomi Cybergear BLCD motors lying around, I thought that a high level controller would be a nice project to get me started learning KiCad

The CyberGears are 24V BLDC motors with CAN interface (I believe that they can tolerate up to 30V).

Ignoring passive components, the BoM currently consist of:

* Raspberry Pi Compute Module 5
* LM64460 Buck converter (max 36V input / 5V 6A output)
* MCP2515 CAN controller
* TJA1051 CAN transciever (The '51 has configurable I/O voltage reference)
* BNO055 IMU (NRND, but I will use it as long as it is available since it has 9 axis in one package and it is easy to use)

I'll update the project with schematics once I have a working first version :)

  • RTFMs

    Hans Jørgen Grimstad02/27/2025 at 19:30 0 comments

    I read chapter 2.6.1 "Alternative function assignments" in the "Raspberry Pi Compute Module 5" manual _carefully_ before deciding on the GPIO pin assignment in my schematic. I decided on using SPI4, I2C0 and UART2. Too bad I didn't read the rest of the manual. Especially the table where the clearly states that SPI4 is "slave only"

    Fortunately it seems that I can use SPI0 with the SPI4 pinout using some device tree magic. The following line in config.txt did the trick:

    dtoverlay=spi0-1cs,cs0_pin=8,sclk_pin=11,miso_pin=9,mosi_pin=8


    Next up was defining the overlay for the MCP2515

    dtoverlay=mcp2515-can0,oscillator=8000000,cs_pin=8,sclk_pin=11,miso_pin=9,mosi_pin=8

     Do you spot the second brain fart already ? (The Xiaomi Cybergears default to a bitrate of 1000000)

    Now I had to make sure that the mcp driver was loaded

    > echo "mcp251x" | sudo tee -a /etc/modules

    After a quick reboot, i checked dmesg

    hansj@cyber-1:~ $ dmesg | grep 2515
    [    4.277991] mcp251x spi0.0 can0: MCP2515 successfully initialized.

    Yaaaay - right...?

    Now it was tTime to bring up can0

    sudo ip link set can0 up type can bitrate 1000000
    Error: bitrate error: 33.3% too high.

    Wooops...

    Turned out I hadn't looked to carefully at the MCP2515 datasheet either, so I had selected a 8MHz crystal without thinking about the implications regarding the maximum bitrate the mcp could support given the frequency of the oscillator. I can do a bitrate of 500000, but not 1000000.

    This is fixable by changing the Cybergear bitrate using communication type 22 via another tool, but I decided to order some 16Mhz crystals from Mouser instead (along with some 22pF capacitors). I guess they will arrive in a couple of days.

  • CM5 first light - Leeroy Jenkins style

    Hans Jørgen Grimstad02/24/2025 at 21:35 0 comments

    The Raspberry Pi IO Board has been sitting on my shelf for a few weeks now. This evening, I finally got around to flashing two of the compute modules. This process is supposed to be rather easy, but I actually struggled a bit before i got it up and running

    It was rather nerve wracking powering up the controller board with the first CM5 mounted, but it did't blow up and I managed to get a shell via wifi. Happy days :)

  • Manual PCBA

    Hans Jørgen Grimstad02/23/2025 at 18:11 0 comments

    Just finished assembling two of the boards. So far, I have only tested the 5V power rail.  Power LED lights up and no detectable current draw withouth the CM5 in place. This is a good sign, since there is no smoke coming out and no shorts between power and ground anywhere. 
    My biggest worry was the tolerances of the CM5 connectors, but the footprint / placement seems to be ok. The module snapped into place without any problems.
    Next, I'll have to verify that the pinout is OK. Since I am going to use both SPI, I2C and UART + a couple of GPIO pins, it is entirely possible that I have made a mistake that will require a modification and a new revision (200 pins and mutually exlusive I/O function assignments is a recipe for future facepalms)

  • Fresh PCBs !

    Hans Jørgen Grimstad02/17/2025 at 20:13 0 comments

    Just got my prototype batch from JLC today.  I decided to include support for dynamixel AX-12 and XL-320 as well as the Cybergears. Next up - assembly and testing. I am NOT looking forward to aligning the CM5 100 pin connectors, though :|

View all 4 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates