cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CUBEIDE support for STEVAL-ESC002V1?

ABlak.1
Associate III

Is there any chance that STM32CUBEIDE will have support for STEVAL-ESC002V1?

If not - what is the fastest way to do development for this eval board using the IDE?

Generally - as a new user of STM products, the overall impression I get is once of chaos. There is an over abundance of hardware but confusion about what are the mainstream strategic products. The software support seems patchy - some products, which I am guessing are the strategic solutions are in STM32CUBEIDE, others are not.

Trying to figure this out is expensive, slow and frustrating.

I just want a simple BLDC motor controller!

What is the fastest, simplest way to make this happen?

10 REPLIES 10
ABlak.1
Associate III

Looking closer at this - what I am asking for is an ioc file for the STM32F031C6-like - system on a chip STSPIN32F0A. If this is not available, is there any documentation about the ioc file so I can create my own (which I am happy to redistribute)

Claire O.
ST Employee

Dear Customer,

I can advise you to download the XCUBE_MCSDK at the following address:

https://www.st.com/en/embedded-software/x-cube-mcsdk.html

And then to generate code through the MC Workbench for the STEVAL-ESC002V1 using STM32CUBEIDE.

Thanks and best regards,

Claire

ABlak.1
Associate III

I made some progress. However ...

Am I right in thinking that the workflow you have chosen is as follows:

  1. Run the motor profiler.
  2. Run the motor controller workbench and generate code for STM32CubeIDE
  3. Open the generated code in STM32CubeIDE - compile and debug

If so, where and in which version of the motor profiler may I find a built profile for STEVAL-ESC002V1A? I can not find any stmc/x files in the shipped example project for the board distributed as the file: en.stsw-esc002v1.zip (this is an IAR IDE project which I have been able to convert into STM32CubeIde - but the code runs into an infinite loop ...)

I run Version 5.4.8 of the motor workbench. New project/single motor/Inverter The closest match I can find to the board is labelled: STEVAL-SPIN3202 it shows the mcu as STSPIN32F0A and the fet as STD140N6F7 - the spec sheet for the board is close - it says: STSPIN32F0A,  STL140N6F7. I select Bus Voltage Sensing and Over Current Protection. I assume a generic low voltage <= 50v motor - and generate code. In the process of doing this I am asked to download some other code ...

Project generation confirms:

STM32CubeMX - 6.7.0

Target Toolchain ST STM32CubeIDE

Firmware Package Version: STM32 FW V1.11.3

I select the HAL drive type.

Code generation completes without error. I open it in STM32CubeMX on the prompt. This paint a nice picture of the pinout and offers GENERATE CODE - which I do.

It generates code in its work space and prompts to Open Project - which I do.

This appears as a project in STM32CubeIde. I select it and the do Project->Build All which finishes with 3 errors, 1 warning:

Description Resource Path Location Type

make: *** [makefile:66: STEVAL-SPIN3202.elf] Error 1 STEVAL-SPIN3202 C/C++ Problem

Description Resource Path Location Type

region `RAM' overflowed by 16 bytes STEVAL-SPIN3202 C/C++ Problem

Description Resource Path Location Type

STEVAL-SPIN3202.elf section `._user_heap_stack' will not fit in region `RAM' STEVAL-SPIN3202 C/C++ Problem

Description Resource Path Location Type

Warning[Pe172]: external/internal linkage conflict with previous declaration at line 533 of "C:/Users/ASUS_USER/STM32CubeIDE/workspace_1.11.0/STSPIN32F0/Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal.h" 6Step_Lib.c /STSPIN32F0/Middlewares/ST/MC_6Step_Lib/Src line 190 C/C++ Problem

My ST LINK is plugged into a USB port, and attached by a SWD cable I made to the board, the board is powered by 12v - lower voltages give connection errors - and the pads connected to my little motor.

What do I do now to resolve the errors? Hand edit code to make it smaller? Shouldn't the tooling be a bit smarter? Why do you ship hardware for which code can not be generated?

Turns out if I go back and only select Over Current Protection I can successfully build. (I suppose I could not use HAL but ...)

I attach my ST LINK to the USB port and connect it to my board using the little swd cable I made, apply 12v to the power input and attach a motor to the 3 pins.

I can then successfully debug the code. Yeah!

How can I now go back and attach the motor profiler - and run the motor?

If I open the Motor Controller Workbench and open the profiler and then attempt to connect using the default COM/115200 I get the error message: Open port failed, the port none may be busy

Am I attaching to the wrong port? (none?) do I need to disconnect the debugger before I can run the motor profiler - hopefully not.

As a general comment - this whole process is overly complex and not straight forward.

ABlak.1
Associate III

I went back and created a conservative motor profile for the EMAX 1106/6000 from values measured independently to:

0693W00000WKvNUQA1.pngGenerated code. Compiled it in STM32CubeIde and uploaded it into the board.

Back in the motor work bench, connect to the board and run Start Motor - the motor moves slightly and starts.

In the advanced tab - set the Speed controller to 10000rpm and 10000ms. Press Exec ramp - nothing happens - the motor does not run. Note there looks to be a speed feedback in orange warning - why?

0693W00000WKvPGQA1.pngAny ideas?

I am running my power supply at its maximum 15v - do I need "3s" (21v~)? The motor is a 2s/3s motor, does the board needs this level of voltage?

Please please improve your documentation. Start with a simple diagram that describes the workflow. Provide more info about errors. Fix the UI. It took me a while to even find the Exec ramp.

What would you do if you were me to get this to work?

ABlak.1
Associate III

I set the "Nominal dc voltage" to 8v. and reran. The motor tries very hard to run after start motor. After a couple of secs this appears - Speed feedback

What does this mean?

0693W00000WKvSAQA1.png 

ABlak.1
Associate III

I seem to be talking to myself. Is there a better way for some of these questions to be answered?

Is there a reason the speed dial is negative? I'll try swapping a couple of motor leads, but can this cause an issue?

The measured currents are quite high, and there are lots of things to tweak. Do the gains for the current control need to be altered, e.g. Iq/Id Kp & Ki.

There are gains (Kp & Ki) for a number of other features. If this motor is considerably different from ST expectations do all these values need to be set for this EMAX motor - and if so what values? Any guidance?

Am I wasting my time trying to use the significantly more complex field oriented control (FOC) and would 6Step be simpler and easier? If so how do I use the tooling to do this?

ABlak.1
Associate III

Thinking that the 5.Y wb might yield better results ... I started with the 5.Y motor profiler and had some success.0693W00000WL224QAD.pngI had to lower to rpm and Apk to get it to work. I suspect as I sad before my power supply can't deliver enough current. As you can see the motor values are in the ballpark of the values that were measured "scientifically" and the profiler says it can't vouch for their accuracy.

The profile never finishes - it moans about taking too long and the speed limit being too low or too high.

ABlak.1
Associate III

More to report - first motor profiling.

I grabbed another 1106 emax drone motor (4800 kva) that has a slightly higher impedance than the other one and grabbed a 5amp psu. I made sure I updated to the 5.4.8 and 6.1.0 mcwb.

The 6.1.0 wb's profiler (ST Motor Pilot V1.1.3) is a step backwards - there seems to be no way to find the board and it's unclear what needs to be typed into the search fields to find something - more about the 6.1 wb in min ...

0693W00000Y6qEwQAJ.png 

The 5.4.8 wb profiler mostly works. Setting as follows:

pp: 6

rpm: 1000000 (yes that high)

Apk: 2.7

VBus: 12

It seems to hit the motor with the full amount of current (and makes it very warm) and reports .8 ohms and .03 mH, and then runs it up. It reaches about 33,000 rpm consuming about 1.3 amps, at some high percentage complete and then seems to reverse the motor and do it all again before stopping at 96%-ish complete and complains about taking too long. Answering the prompt to continue restarts the cycle running the motor at 40% - it never completes whatever changes are made. ARGH

Is this a bug? Can the timeout a set bit higher? Is the rpm max value being scaled by 100? (The only way to get to 30000 is by making this value enormous)

Now on to the code generation with the 6.1 wb - I am pleasantly surprised to find the 6step seems to work - this is more than adequate for my needs - however after getting to the last step and asking it to open in ST32CubeIde - IT FAILS.

If I go an manually open the project in STM32CubeIde it will open however it appears to me to have not generated all the code - there is no 6step lib for example. I am going to do some more testing later and will have more to say.

All in all 6.1 looks like progress - so well done ST. Please test your code 🙂 I would so love this all to work. It's got promise - but it's not there yet - at least for me.

ABlak.1
Associate III

A bit more about inability to open the generated code in STM32CubeIde - after selecting "Generate Code" in STM32CubeMX - and accepting the prompt to open in STM32CubeIde, STM32CubeIde opens but the project does not appear, and the Ide it fails with a java traceback - with a null pointer excp (see below):

The version of STMCubeIde is 1.11.0 Build: 13638_20221122_1308 (UTC)

java.lang.NullPointerException
	at com.st.stm32cube.common.mx.editor.CubeMxEditor.init(CubeMxEditor.java:844)
	at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:353)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:344)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:995)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:960)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:140)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:403)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:330)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:995)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:659)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.lambda$0(PartServiceImpl.java:105)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.lambda$0(UIEventHandler.java:38)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4779)
	at org.eclipse.e4.ui.workbench.swt.DisplayUISynchronize.syncExec(DisplayUISynchronize.java:34)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:133)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElementGen(ElementContainerImpl.java:170)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:188)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.hidePart(PartServiceImpl.java:1381)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.hidePart(PartServiceImpl.java:1331)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.closePart(StackRenderer.java:1182)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$3.close(StackRenderer.java:1042)
	at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1961)
	at org.eclipse.swt.custom.CTabFolder.lambda$0(CTabFolder.java:336)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4243)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1063)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4060)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3632)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1467)

If I try manually importing the project the error is repeatable by clicking on the ioc file that's in the generated project - I have attached it.

What's going on?