Bafang M500/M600 thread

4πr^2 said:
I'll work on getting set up on github and some pics. Looks like my motor is using an S32K142H controller
https://www.nxp.com/docs/en/data-sheet/S32K-DS.pdf

80V / 60A mosfets if anyone is interested:
http://www.hunteck.com/Datasheets/HGN036N08S_V1.0-061417.pdf

You my friend are getting a Beer if you're ever in my region of the world!

Interesting though:
So in the m500 they use 1 single 80v60s mosfet and in the m600 they use three.

i did some board research and I think, would be great if someone can confirm it, the MOSFET cooling is not very good. Hence they use multiple over-rated MOSFETS for the m600.

But more importantly, for 15194:2017 compliance they measure the temperature equilibrium of the single MOSFET, because it's not adequately cooled it means they can certify for 250w continues.

Why is this all interesting?
If we start to push more current for the m500, we could just add extra cooling to deal with the extra MOSFET load and be done with it.

But the m600 is definately capable for running the 2KW load that Luna puts through it by their shuntmod, assuming cooling is adequate.
 
Waynemarlow said:
Why reinvent the wheel guys, I know Caisanho loves to reprogram from scratch and probably in the long term creates a better motor. But that development is hugely long winded as in the case of the TSDZ2 which has been developed now for probably 3 years.
Not TSDZ2 only, I started the development of OpenSource firmware for the KT motor controllers as seen on the image bellow. Then Stancecoke did the same for the other popular motor controller that I do not remember the name now.

Even for TSDZ2, we started to do little changes to the original firmware, and looking now some years after, no one is using that firmware but instead our fully developed firmware, because we could add MANY advanced features, things like motor FOC control that uses less battery and makes motor stronger, adding motor temperature sensor, torque sensor calibration, current ramp value, very good battery SOC based on Coulomb counting and recently wireless with integration with EBike wireless standard, making the popular cycling GPS units like Garmin Edge, compatible with TSDZ2. So yes, I agree that is best to have something that bring immediate value to users and then that will help project grow in awareness, attracting more users but mostly important, more developers - and possible more cheap repair parts, which a big part of success of TSDZ2!

25-1.png
 
Guess this is the development board for this cheap @casainho:

https://www.nxp.com/design/development-boards/automotive-motor-control-solutions/arm-based-solutions-/s32k142-development-board-for-bldc-pmsm-motor-control:MCSXTE2BK142
 
And seeing that people are talking about a shop Like Luna Cycles, that seems did some hack to the controller and then marketing like being their super special version, on TSDZ2 with our OpenSource firmware, the story is different.

At begin of the OpenSource project, some shops owners did help the project, providing parts, donating money and help to get access to the 850C and 860C displays bootloader. And this shops decided to sell the motor preinstalled with our OpenSource firmware, including with our own the extra features like the motor temperature sensor - this is very important to some users that lack the time and skills to DIY. Also this shops provides support to build very special ebikes and our firmware have some specific features for it, like Jeff bike:

v0.20.0-Handcycle-Coaster-Brk.jpg




 
I've started work on fetching everything I can about the controller.
There is a lot of content for it in the NXP database, so will take a while.

I've also already added the earlier noted documentation to the repository.

Edit:
SoC type actually seems to be s32k142 without the "h"
the "h" is part of the product code for the chips themselves, but not part the actual SoC name:
FS32K142HAT0VLHT
 
ornias said:
Guess this is the development board for this cheap @casainho:

https://www.nxp.com/design/development-boards/automotive-motor-control-solutions/arm-based-solutions-/s32k142-development-board-for-bldc-pmsm-motor-control:MCSXTE2BK142
Oh well, S32K142 is not that popular as STM32.... contrary to STM32, when I search on EBay for S32K142, there are no results, for a development board or even for the microcontroller :-(

So I guess we are out of luck, the development will be hard and expensive....
 
casainho said:
ornias said:
Guess this is the development board for this cheap @casainho:

https://www.nxp.com/design/development-boards/automotive-motor-control-solutions/arm-based-solutions-/s32k142-development-board-for-bldc-pmsm-motor-control:MCSXTE2BK142
Oh well, S32K142 is not that popular as STM32.... contrary to STM32, when I search on EBay for S32K142, there are no results, for a development board or even for the microcontroller :-(

So I guess we are out of luck, the development will be hard and expensive....

I can get you a dump of everything NXP has on this beasty...
It's quite a lot.
I already uploaded part of the SDK related to this chip and Bafangs board looks pretty close to the default development board tbh.
 
ornias said:
I already uploaded part of the SDK related to this chip and Bafangs board looks pretty close to the default development board tbh.
That is good to know!! Now, the question is: is that board cheaper or is the motor controller? Can you get a place to buy online the board?

We we still need to buy motor parts in the most cheap possible. We need to buy a motor unit to connect to the development board or to the motor controller.

Another very first thing is to find the programmer and debugger. On TSDZ2 V1 and displays we use STLinkV2 and on TSDZ2 V2 (different microcontroller) we use JLink -- both this are very cheap, like 2€ and 4€ on Ebay. I would expect JLink to work on this S32K142.

Everything you get I can also get online, so not point for now.
 
casainho said:
ornias said:
I already uploaded part of the SDK related to this chip and Bafangs board looks pretty close to the default development board tbh.
That is good to know!! Now, the question is: is that board cheaper or is the motor controller? Can you get a place to buy online the board?

We we still need to buy motor parts in the most cheap possible. We need to buy a motor unit to connect to the development board or to the motor controller.

Another very first thing is to find the programmer and debugger. On TSDZ2 V1 and displays we use STLinkV2 and on TSDZ2 V2 (different microcontroller) we use JLink -- both this are very cheap, like 2€ and 4€ on Ebay. I would expect JLink to work on this S32K142.

Everything you get I can also get online, so not point for now.

Edit:
Found another cheap option:
https://www.nxp.com/design/development-boards/automotive-development-platforms/s32k-mcu-platforms/s32k142-evaluation-board-for-general-purpose:S32K142EVB

Thats 100USD, for an evaluation board.
It's not the big and more expensive development board, but it is a st32k142 developmentboard none-the-less
 
casainho said:
Found another cheap option:
https://www.nxp.com/design/development- ... S32K142EVB

Thats 100USD, for an evaluation board.
It's not the big and more expensive development board, but it is a st32k142 developmentboard none-the-less
Well, that is not one for motor control, right? that would need another extra board on top, specific for motor control.

For me, from https://flx.bike/, the motor controller + shipping and taxes, costs 126 dollars. So, unless there are other cheap development board, the motor controller still be the cheaper.
 
casainho said:
casainho said:
Found another cheap option:
https://www.nxp.com/design/development- ... S32K142EVB

Thats 100USD, for an evaluation board.
It's not the big and more expensive development board, but it is a st32k142 developmentboard none-the-less
Well, that is not one for motor control, right? that would need another extra board on top, specific for motor control.

For me, from https://flx.bike/, the motor controller + shipping and taxes, costs 126 dollars. So, unless there are other cheap development board, the motor controller still be the cheaper.

Agreed, you might, however, be able to make a deal with flx.bike for a more reasonable price ;)

Also good news:
I maged to output similair looking firmware binaries from the buildtools provided by NXP :-D
 
ornias said:
casainho said:
casainho said:
Found another cheap option:
https://www.nxp.com/design/development- ... S32K142EVB

Thats 100USD, for an evaluation board.
It's not the big and more expensive development board, but it is a st32k142 developmentboard none-the-less
Well, that is not one for motor control, right? that would need another extra board on top, specific for motor control.

For me, from https://flx.bike/, the motor controller + shipping and taxes, costs 126 dollars. So, unless there are other cheap development board, the motor controller still be the cheaper.

Agreed, you might, however, be able to make a deal with flx.bike for a more reasonable price ;)

Also good news:
I maged to output similair looking firmware binaries from the buildtools provided by NXP :-D
Ok, yes, we need to explore the best cheap options to buy the parts and then make this information on the front page, to help other developers and users as also this shops.

Did you figured out what hardware is used for flash and debug?
 
casainho said:
ornias said:
casainho said:
casainho said:
Found another cheap option:
https://www.nxp.com/design/development- ... S32K142EVB

Thats 100USD, for an evaluation board.
It's not the big and more expensive development board, but it is a st32k142 developmentboard none-the-less
Well, that is not one for motor control, right? that would need another extra board on top, specific for motor control.

For me, from https://flx.bike/, the motor controller + shipping and taxes, costs 126 dollars. So, unless there are other cheap development board, the motor controller still be the cheaper.

Agreed, you might, however, be able to make a deal with flx.bike for a more reasonable price ;)

Also good news:
I maged to output similair looking firmware binaries from the buildtools provided by NXP :-D
Ok, yes, we need to explore the best cheap options to buy the parts and then make this information on the front page, to help other developers and users as also this shops.

Did you figured out what hardware is used for flash and debug?

J-Link and PEMicro are the debuggers they promote in their docs:
"you can use PE Micro OpenSDA interface on EVB or any other supported debug probe - Segger J-Link, PE Micro Multilink, Lauterbach... "
 
savaoaknyc said:
Hi Guys,

can someone measure the exact dimensions of the m500 or m600.I have some frames for e8000 shimano and i am wondering if somehow i can make the m500 or m600 to fit the frame.

Here some pictures from the framesshimano1.JPGshimano2.JPG
Hi,
I am in the exact situation, did you manage to check the dimensions or even better did you try it?
 
tfischer said:
savaoaknyc said:
Hi Guys,

can someone measure the exact dimensions of the m500 or m600.I have some frames for e8000 shimano and i am wondering if somehow i can make the m500 or m600 to fit the frame.

Here some pictures from the framesshimano1.JPGshimano2.JPG
Hi,
I am in the exact situation, did you manage to check the dimensions or even better did you try it?

dimensions and even drawings have been posted both here and in the earlier linked github development repository.
 
ornias said:
4πr^2 said:
I'll work on getting set up on github and some pics. Looks like my motor is using an S32K142H controller
https://www.nxp.com/docs/en/data-sheet/S32K-DS.pdf

80V / 60A mosfets if anyone is interested:
http://www.hunteck.com/Datasheets/HGN036N08S_V1.0-061417.pdf

You my friend are getting a Beer if you're ever in my region of the world!

Interesting though:
So in the m500 they use 1 single 80v60s mosfet and in the m600 they use three.

i did some board research and I think, would be great if someone can confirm it, the MOSFET cooling is not very good. Hence they use multiple over-rated MOSFETS for the m600.

But more importantly, for 15194:2017 compliance they measure the temperature equilibrium of the single MOSFET, because it's not adequately cooled it means they can certify for 250w continues.

Why is this all interesting?
If we start to push more current for the m500, we could just add extra cooling to deal with the extra MOSFET load and be done with it.

But the m600 is definately capable for running the 2KW load that Luna puts through it by their shuntmod, assuming cooling is adequate.

Glad it helped. I'm just looking forward to the point when we have more control over the controller!

As for the mosfets, not sure how the M500 would get by with one. The M600 actually has six pairs of two for the 3-phase motor drive, seems like the M500 would be similar? I'll add an approximate block diagram below.

Cooling is 'interesting' to say the least. With the mosfets mounted on what I'd consider the 'top' of the board and the heat sink and thermal pad attached to the 'bottom'. So where you typically think you have a heat sink mounted directly to a component, in this case, the thermal path is: mosfet > circuit board > thermal pad > heat sink. Several of the mosfets are topped by a blob of hot glue and have a big electrolytic capacitor laying over them! But there is a lot of copper in that area of the board and lots of vias for heat conduction, too.

On the plus side, I believe the RDSon for these mosfets is listed as 3 milliohms. So figure worst case 2000w 'ludicrous' option at 48 volts 'should be' about 42 amps. 3 milliohms resistance at the mosfets, that works out to about 5 watts dissipated - across the two mosfets. There are a few other small factors to figure in, but ballpark mid single-digit watts and a great deal of the time, it will be much less than that.
 

Attachments

  • 3-phase bridge motor driver example.jpg
    3-phase bridge motor driver example.jpg
    60.3 KB · Views: 499
  • X1 Ludicrous Controller M600 - Annotated Bottom.jpg
    X1 Ludicrous Controller M600 - Annotated Bottom.jpg
    459.9 KB · Views: 499
  • X1 Ludicrous Controller M600 - Annotated Top.jpg
    X1 Ludicrous Controller M600 - Annotated Top.jpg
    418.3 KB · Views: 499
There is not much information about S32K microcontroller and seems OpenOCD does not support it originally but I found on Github a version of OpenOCD for S32K: https://github.com/xobs/openocd-s32k

And here is the setup process for Visual Code Studio for flash and debug S32K: https://www.programmersought.com/article/91304575903/


4πr^2 said:
As for the mosfets, not sure how the M500 would get by with one. The M600 actually has six pairs of two for the 3-phase motor drive, seems like the M500 would be similar? I'll add an approximate block diagram below.

Cooling is 'interesting' to say the least. With the mosfets mounted on what I'd consider the 'top' of the board and the heat sink and thermal pad attached to the 'bottom'. So where you typically think you have a heat sink mounted directly to a component, in this case, the thermal path is: mosfet > circuit board > thermal pad > heat sink. Several of the mosfets are topped by a blob of hot glue and have a big electrolytic capacitor laying over them! But there is a lot of copper in that area of the board and lots of vias for heat conduction, too.

On the plus side, I believe the RDSon for these mosfets is listed as 3 milliohms. So figure worst case 2000w 'ludicrous' option at 48 volts 'should be' about 42 amps. 3 milliohms resistance at the mosfets, that works out to about 5 watts dissipated - across the two mosfets. There are a few other small factors to figure in, but ballpark mid single-digit watts and a great deal of the time, it will be much less than that.

I hope this pictures will be stored on the repository.

So, there are no phase current resistors? how are the phase currents measured to implement FOC??

And can someone please make a list on the repository of the inputs and outputs? for instance, details with some pictures about the torque sensor and cadence sensor as they are inputs?
 
4πr^2 said:
ornias said:
4πr^2 said:
I'll work on getting set up on github and some pics. Looks like my motor is using an S32K142H controller
https://www.nxp.com/docs/en/data-sheet/S32K-DS.pdf

80V / 60A mosfets if anyone is interested:
http://www.hunteck.com/Datasheets/HGN036N08S_V1.0-061417.pdf

You my friend are getting a Beer if you're ever in my region of the world!

Interesting though:
So in the m500 they use 1 single 80v60s mosfet and in the m600 they use three.

i did some board research and I think, would be great if someone can confirm it, the MOSFET cooling is not very good. Hence they use multiple over-rated MOSFETS for the m600.

But more importantly, for 15194:2017 compliance they measure the temperature equilibrium of the single MOSFET, because it's not adequately cooled it means they can certify for 250w continues.

Why is this all interesting?
If we start to push more current for the m500, we could just add extra cooling to deal with the extra MOSFET load and be done with it.

But the m600 is definately capable for running the 2KW load that Luna puts through it by their shuntmod, assuming cooling is adequate.

Glad it helped. I'm just looking forward to the point when we have more control over the controller!

As for the mosfets, not sure how the M500 would get by with one. The M600 actually has six pairs of two for the 3-phase motor drive, seems like the M500 would be similar? I'll add an approximate block diagram below.

Thanks for the headsup about the MOSFETS, I misunderstood the old pictures, you are right I think there are even 6 on the m500.
That would be good to know though, because that makes the boards quite a bit more compatible :)

4πr^2 said:
Cooling is 'interesting' to say the least. With the mosfets mounted on what I'd consider the 'top' of the board and the heat sink and thermal pad attached to the 'bottom'. So where you typically think you have a heat sink mounted directly to a component, in this case, the thermal path is: mosfet > circuit board > thermal pad > heat sink. Several of the mosfets are topped by a blob of hot glue and have a big electrolytic capacitor laying over them! But there is a lot of copper in that area of the board and lots of vias for heat conduction, too.

On the plus side, I believe the RDSon for these mosfets is listed as 3 milliohms. So figure worst case 2000w 'ludicrous' option at 48 volts 'should be' about 42 amps. 3 milliohms resistance at the mosfets, that works out to about 5 watts dissipated - across the two mosfets. There are a few other small factors to figure in, but ballpark mid single-digit watts and a great deal of the time, it will be much less than that.
That is actually quite decent thermal performance, beter than I anticipated :)
 
casainho said:
There is not much information about S32K microcontroller and seems OpenOCD does not support it originally but I found on Github a version of OpenOCD for S32K: https://github.com/xobs/openocd-s32k

And here is the setup process for Visual Code Studio for flash and debug S32K: https://www.programmersought.com/article/91304575903/

I hope this pictures will be stored on the repository.

So, there are no phase current resistors? how are the phase currents measured to implement FOC??

And can someone please make a list on the repository of the inputs and outputs? for instance, details with some pictures about the torque sensor and cadence sensor as they are inputs?

You can download the nxp S32 Design Studio 2.2 software package.
It includes all required dev tools and documentation on how to use the software is also available from NXP.

I'll make sure all this info is documented.

On another note:
I might have made some baby steps to reverse engineer the firmware today by hexediting it. We'll see if it's effective and possible when some folks test it.
 
ornias said:
You can download the nxp S32 Design Studio 2.2 software package.
It includes all required dev tools and documentation on how to use the software is also available from NXP.
Is always the same, every manufacturer make a version of the OpenSource Eclipse and GCC and then call his own version of design studio (seems the same as that shop that were mention before, selling their special version of the motor controller). I am looking to use a generic IDE for all the microcontrollers of the different projects, as the compiler and debugger is just the same: GCC, GDB and OpenOCD.
And also important is that I am on Linux and sometimes their own versions of theirs "design studio" are Windows only.

And I really wonder how FOC is implemented without the phase current sensors but only one current sensor... is that the same on development board hardware and firmware??
 
casainho said:
ornias said:
You can download the nxp S32 Design Studio 2.2 software package.
It includes all required dev tools and documentation on how to use the software is also available from NXP.
Is always the same, every manufacturer make a version of the OpenSource Eclipse and GCC and then call his own version of design studio (seems the same as that shop that were mention before, selling their special version of the motor controller). I am looking to use a generic IDE for all the microcontrollers of the different projects, as the compiler and debugger is just the same: GCC, GDB and OpenOCD.
And also important is that I am on Linux and sometimes their own versions of theirs "design studio" are Windows only.

And I really wonder how FOC is implemented without the phase current sensors but only one current sensor... is that the same on development board hardware and firmware??
NXP has more papers about things than you might expect:
https://www.nxp.com/docs/en/application-note/AN5327.pdf
 
ornias said:
NXP has more papers about things than you might expect:
https://www.nxp.com/docs/en/application-note/AN5327.pdf
I knew that reconstruction of the phase current is possible because others also do that but seems is the more complex to implement, I wish they were doing the most simple way :)
Thanks for pointing to this document. Maybe you could link on the repository documentation this document about the motor control done on this motor controller.
 
casainho said:
ornias said:
NXP has more papers about things than you might expect:
https://www.nxp.com/docs/en/application-note/AN5327.pdf
I knew that reconstruction of the phase current is possible because others also do that but seems is the more complex to implement, I wish they were doing the most simple way :)
Thanks for pointing to this document. Maybe you could link on the repository documentation this document about the motor control done on this motor controller.

I updated the hardware readme accordingly :)
 
So to get the motor control, we can use the MCSXTE2BK142 S32K142 motor control development board that costs 329 dollars!!

MCSXTE2BK142 motor control development board features
- Out-of-box motor control and tuning using FreeMASTER Motor Control Application Tuning (MCAT) Tool with the ability to drive multiple types of automotive motors and tune those motors directly.
- PMSM field oriented control (FOC) single, dual and triple shunt current sensing solutions implemented in software projects
- Implement advanced motor control algorithm: Field Weakening (FW) and Stall Detection
- Integrate BSP layer API of CAN, LIN and PWM communication for motor control
- Includes a sensor (Hall, encoder) and sensorless mode

So yes, buying a Bafang M500 motor controller board will be cheaper for development.

And the best is to have the Bafang M500 motor controller board + motor + lab power supply and use the FreeMASTER Motor Control Application Tuning (MCAT) Tool to make the motor running code.
 
Fixed your typos! 🚴‍♂️😆

casainho said:
So yes, buying a Bafang M600 motor controller board will be cheaper for development.

And the best is to have the Bafang M600 motor controller board + motor + lab power supply and use the FreeMASTER Motor Control Application Tuning (MCAT) Tool to make the motor running code.
 
Back
Top