Author Topic: Problems with STM32 PMSM FOC SDK  (Read 116155 times)

0 Members and 1 Guest are viewing this topic.

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Problems with STM32 PMSM FOC SDK
« on: November 15, 2016, 07:00:28 pm »
I do not know if this is the right place. Be gentle with me.

I'm having a lot of problems using this SDK:
http://www.st.com/en/embedded-software/stsw-stm32100.html

I already configured all the parameters and generated the configuration header files.
All done according to the documentation.

The problem starts when I try to use the IAR (or KEIL) to get the application up and running.
The examples are not clear enough for me.

I have no compilation errors nor problems in programming the MCU.

So my difficulty lies in building basic instructions with the SDK.

I do not understand how I can not get any assistance from ST  :( :(.

Has anyone here worked with this SDK, who can help me?

I'm using this board, slightly modified, for my application.
http://www.st.com/en/evaluation-tools/steval-ihm040v1.html


Attached is the configurator file.
http://s000.tinyupload.com/index.php?file_id=62181905025753098078


I'm freaking out with this ....


Thank you!!
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #1 on: November 15, 2016, 07:53:43 pm »
I am using it with success, but I remember getting off was quite painful. Maybe you can upload your complete IAR project, then I can have a look.
We Are The Watt - Resistance Is Futile!
 
The following users thanked this post: Dave_PT

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #2 on: November 15, 2016, 08:38:36 pm »
Oh, thank God (God Goku, of course  ;D).

I'm trying to run the "ramp" example.

But after doing "start motor", I have no PWM signals.

At this point, I came home and I have nothing installed on my PC.

Could you help me out tomorrow?


You can not imagine how relieved I am just for communicating with someone who is actually using the SDK !!!   :-+


My project takes some delay because I've been using Renesas for motor control, but now I have to add an encoder.

Because the project is changing, I decided to start using ST for the quality of its configuration tools.


So I'll buy you a beer for your help!  ;)
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #3 on: November 15, 2016, 08:44:44 pm »
no problem :)
We Are The Watt - Resistance Is Futile!
 
The following users thanked this post: Dave_PT, richard_t

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #4 on: November 15, 2016, 09:11:41 pm »
Tomorrow at 10 a.m. (Germany time) I will write something here.

Thank you.


I owe you a Franziskaner :)
« Last Edit: November 15, 2016, 09:23:29 pm by Dave_PT »
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #5 on: November 16, 2016, 07:13:17 am »
i can check this evening. just throw over that beer, but make it a Kilkenny 8) I don't drink that Bavarian stuff :o some ideas:
- ST maintains a forum dedicated to this SDK, have you been there? that was of great help for me
- have you measured your motor parameters, most important L, R, backemf constant. the sensorless rotor angle estimators really need good values
- have you played with the RS232 based remote control that is built into the configuration tool? it allows inspecting live values. it also allows routing them to the DACs of the micro, so you can make them visible on a scope

EDIT: just checked the reference design that you linked. Unless ST has added some features that I am not aware of, then the ST FOC library cannot run on that board. One of the essential features is phase current measurement, and that one http://www.st.com/en/evaluation-tools/steval-ihm040v1.html is missing that. Have you added phase current measurement in your design?

EDIT2: cannot download your configuration file, maybe just add as attachment to your post.
« Last Edit: November 16, 2016, 08:47:37 am by tatus1969 »
We Are The Watt - Resistance Is Futile!
 

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #6 on: November 16, 2016, 09:24:04 am »
My knowledge about German beers is very limited  :-DD.

- ST maintains a forum dedicated to this SDK, have you been there? that was of great help for me
The only ST forum I know is this: https://my.st.com/public/STe2ecommunities/motordriver_ics/Lists/Motor%20Control%20Firmware%20and%20Software/AllItems.aspx
But is not dedicated to this SDK.
Can you give me the forum link?


- have you measured your motor parameters, most important L, R, backemf constant. the sensorless rotor angle estimators really need good values
Yes. I measured these parameters with the Renesas board.


- have you played with the RS232 based remote control that is built into the configuration tool? it allows inspecting live values. it also allows routing them to the DACs of the micro, so you can make them visible on a scope
This EVB was poorly chosen.
I have access to the DAC output but I have not yet turned on the scope there. I'll do it next ...


EDIT: just checked the reference design that you linked. Unless ST has added some features that I am not aware of, then the ST FOC library cannot run on that board. One of the essential features is phase current measurement, and that one http://www.st.com/en/evaluation-tools/steval-ihm040v1.html is missing that. Have you added phase current measurement in your design?
I made the changes on this board (so I can use a 24V motor).
But this board appears in the configuration tool.



EDIT2: cannot download your configuration file, maybe just add as attachment to your post.
In the forum I can not add the file ...
Try it here: http://www.filehosting.org/file/details/618819/drive_alte.rar
Or here: http://www.yourfilelink.com/get.php?fid=1273789

Thx
« Last Edit: November 16, 2016, 09:27:43 am by Dave_PT »
 


Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #8 on: November 16, 2016, 10:48:49 am »
I already bought the KIT.

It must arrive tomorrow ...

But making FOC with 1 shunt resistor is possible ....
 

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #9 on: November 16, 2016, 11:45:16 am »
I have already changed the DAC settings for several variables, but I have the feeling that something is not activating the functions ...

Changes on main template (after generating all config files to SystemDriveParams folder, open "STM32F10x_Workspace.eww"):
* line78 - #define EXAMPLE_RAMP




In debug mode I can make the MCI StartMotor with success... but nothing happens (no PWM, no rotation, no variation on DAC channels, ...)




I'm pretty sure that I'm forgetting to initialize something.
« Last Edit: November 16, 2016, 11:47:40 am by Dave_PT »
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #10 on: November 16, 2016, 01:00:27 pm »
My knowledge about German beers is very limited  :-DD.
Same for my Portugesian beer knowledge  ;)

- ST maintains a forum dedicated to this SDK, have you been there? that was of great help for me
The only ST forum I know is this: https://my.st.com/public/STe2ecommunities/motordriver_ics/Lists/Motor%20Control%20Firmware%20and%20Software/AllItems.aspx
But is not dedicated to this SDK.
Can you give me the forum link?
That's the one I meant. The FOC library is one of the main topics there. Gigi from ST is usually very helpful and responsive and he had helped me a lot in the past.

EDIT: just checked the reference design that you linked. Unless ST has added some features that I am not aware of, then the ST FOC library cannot run on that board. One of the essential features is phase current measurement, and that one http://www.st.com/en/evaluation-tools/steval-ihm040v1.html is missing that. Have you added phase current measurement in your design?
I made the changes on this board (so I can use a 24V motor).
But this board appears in the configuration tool.

I see, they do support single-resistor current sensing. Maybe I just missed that because I am using hall based current sensing anyway (currents up to 40A). I am happy to see that they now also have a motor profiler application. You could double check your motor params with that.

Some more ideas:
- have you changed R10=R12=47k?
- your overcurrent settings do not seem to match the circuit. Rsense = 0.25 Ohms, comparator trip point = 0.25V, according to 1.0A. Your settings differ (should not prevent startup though)
- the board seems to use the microcontroller's internal RC oscillator for clocking, but that is not available from the configuration. My latest project is doing it the same way, but I have modified the startup code. Don't know if there's an automatic fallback if there is no crystal.
- there's some timer magic with the BKIN signal (PB12 on your board), don't remember the exact details. That can block timer operation if I am correct.
We Are The Watt - Resistance Is Futile!
 
The following users thanked this post: Dave_PT

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #11 on: November 16, 2016, 02:56:48 pm »
Same for my Portugesian beer knowledge  ;)
When this is over I'll send you the best Portuguese beer ;).


That's the one I meant. The FOC library is one of the main topics there. Gigi from ST is usually very helpful and responsive and he had helped me a lot in the past.
I have seen seen in the various posts that the answers are late ...
Maybe this may not be the best time ...


I see, they do support single-resistor current sensing. Maybe I just missed that because I am using hall based current sensing anyway (currents up to 40A). I am happy to see that they now also have a motor profiler application. You could double check your motor params with that.
Yes. The new KIT I bought already supports the MPA.
It is very useful!


- have you changed R10=R12=47k?
Yes, exactly!


- your overcurrent settings do not seem to match the circuit. Rsense = 0.25 Ohms, comparator trip point = 0.25V, according to 1.0A. Your settings differ (should not prevent startup though)
I checked this out ...
This is the protection of the driver. These were the "default values" of the configurator for this board.


- the board seems to use the microcontroller's internal RC oscillator for clocking, but that is not available from the configuration. My latest project is doing it the same way, but I have modified the startup code. Don't know if there's an automatic fallback if there is no crystal.
A crystal is connected to pins 5 and 6, which I think is 8MHz.
The RefDes is Y1.


- there's some timer magic with the BKIN signal (PB12 on your board), don't remember the exact details. That can block timer operation if I am correct.
The PB12 pin is connected to the driver's SD pin.
In the datasheet the SD pin is described as being an input pin.
In the SD pin the voltage is always 10.5V, so the control logic is active.
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #12 on: November 16, 2016, 04:24:45 pm »
I already bought the KIT.

It must arrive tomorrow ...

But making FOC with 1 shunt resistor is possible ....
Then I suggest to compile and flash the project with default options (no ramp, etc) and use the STMC Workbench to control everything via RS232/UART. You'll most probably see directly why the PWM stays in disabled state, probably one of the protection mechanisms (for example over/undervoltage, but I don't think its that) is in error state.

Please also upload your complete project somewhere, there are many IAR project settings that can mess up things so I could check those.
We Are The Watt - Resistance Is Futile!
 
The following users thanked this post: Dave_PT

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #13 on: November 16, 2016, 04:44:14 pm »
Please also upload your complete project somewhere, there are many IAR project settings that can mess up things so I could check those.

I'm trying to export the project.

I'm more Eclipse user than IAR ...

The project has files all over the directory ....
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #14 on: November 16, 2016, 04:48:56 pm »
When this is over I'll send you the best Portuguese beer ;).
:popcorn:

- your overcurrent settings do not seem to match the circuit. Rsense = 0.25 Ohms, comparator trip point = 0.25V, according to 1.0A. Your settings differ (should not prevent startup though)
I checked this out ...
This is the protection of the driver. These were the "default values" of the configurator for this board.
The values for STMC Workbench "Power Stage -> Overcurrent Protection" are certainly used somehow in the library code, although I have no idea how. I can check this evening in the source code. I suggest to completely disable this feature for now.

A crystal is connected to pins 5 and 6, which I think is 8MHz.
The RefDes is Y1.
Alright... what a crappy symbol in the drawing (en.DM00073152-1.pdf)


- there's some timer magic with the BKIN signal (PB12 on your board), don't remember the exact details. That can block timer operation if I am correct.
The PB12 pin is connected to the driver's SD pin.
In the datasheet the SD pin is described as being an input pin.
In the SD pin the voltage is always 10.5V, so the control logic is active.
Can't see that in the document (STEVAL-IHM040V1), PB12 seems to be pulled to GND but not connected to anything else. BKIN (PB12) is an input to the PWM generating timer, and if I remember it correctly, a HIGH on that pin will inhibit PWM output. I found this document: from ST, AN4277. But maybe not important anymore, lets see how the new board performs.
We Are The Watt - Resistance Is Futile!
 
The following users thanked this post: Dave_PT

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #15 on: November 16, 2016, 05:09:57 pm »
The values for STMC Workbench "Power Stage -> Overcurrent Protection" are certainly used somehow in the library code, although I have no idea how. I can check this evening in the source code. I suggest to completely disable this feature for now.
OK.
Done!



Alright... what a crappy symbol in the drawing (en.DM00073152-1.pdf)
The first time I looked at him, I did not even realize what it was  :o.
I just understood because of RefDes.


Can't see that in the document (STEVAL-IHM040V1), PB12 seems to be pulled to GND but not connected to anything else. BKIN (PB12) is an input to the PWM generating timer, and if I remember it correctly, a HIGH on that pin will inhibit PWM output. I found this document: from ST, AN4277. But maybe not important anymore, lets see how the new board performs.
Yes, you are right. It's a little strange.
Look at THIS.
The PB12 pin connects, via R8, to pin 2 of the driver.
If the PB12 pin and the SD pin are inputs, then:
V(PB12) = 2.85V (logic 1)   -> Turn off PWM? (I believe the polarity is inverted, otherwise it would not have logic)
V(SDpin) = 11.2V (logic 1) -> Control logic active.

« Last Edit: November 16, 2016, 05:14:19 pm by Dave_PT »
 

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #16 on: November 16, 2016, 05:30:05 pm »
Please also upload your complete project somewhere, there are many IAR project settings that can mess up things so I could check those.

I'm trying to export the project.

I'm more Eclipse user than IAR ...

The project has files all over the directory ....

It's ridiculous ... but I can not export the project with the IAR.

To send you the project I would have to send you the folder with the whole SDK (~ 400MB).

But the only files with some kind of change made by me are the files I've already sent you.

I'll take the project home. Any file you need I can search and send to you.
 

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #17 on: November 16, 2016, 05:52:49 pm »
I've been trying to figure out the polarity of BKIN.

TIM1 - BDTR - BKP

But the only "TIM1" reference I have in the project has no configuration.
Where is the timers setup?




[EDIT]: In fact, in all *.c files inside the SDK folder, I can not find any TIM1 settings.
« Last Edit: November 16, 2016, 06:02:26 pm by Dave_PT »
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #18 on: November 16, 2016, 07:45:27 pm »
Can't see that in the document (STEVAL-IHM040V1), PB12 seems to be pulled to GND but not connected to anything else. BKIN (PB12) is an input to the PWM generating timer, and if I remember it correctly, a HIGH on that pin will inhibit PWM output. I found this document: from ST, AN4277. But maybe not important anymore, lets see how the new board performs.
Yes, you are right. It's a little strange.
Look at THIS.
The PB12 pin connects, via R8, to pin 2 of the driver.
If the PB12 pin and the SD pin are inputs, then:
V(PB12) = 2.85V (logic 1)   -> Turn off PWM? (I believe the polarity is inverted, otherwise it would not have logic)
V(SDpin) = 11.2V (logic 1) -> Control logic active.


That circuit actually makes sense, it is described on page 12 of the UM1595 manual that you gave me a link to. Interestingly, the product brief schematic is actually wrong...

I checked the FOC library source code (rev4.0 - you won't find it, it is not publicly available).

The relevant code passages are these:

Code: [Select]
(R1_LM1_PWMnCurrFdbkClass.c)

  if ((pDParams_str->EmergencyStop)!= DISABLE) 
  {
    /****** Configure TIMx BKIN input, if enabled ******/   
    GPIO_StructInit(&GPIO_InitStructure);
    GPIO_InitStructure.GPIO_Pin = pDParams_str->hBKINPin; 
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
    GPIO_Init(pDParams_str->hBKINPort, &GPIO_InitStructure);
    GPIO_PinLockConfig(pDParams_str->hBKINPort, pDParams_str->hBKINPin);
  }

  /* Dead Time */
  TIM_BDTRStructInit(&TIMx_BDTRInitStructure);
  TIMx_BDTRInitStructure.TIM_OSSRState = TIM_OSSRState_Enable;
  TIMx_BDTRInitStructure.TIM_OSSIState = TIM_OSSIState_Enable;
  TIMx_BDTRInitStructure.TIM_LOCKLevel = TIM_LOCKLevel_1;
  TIMx_BDTRInitStructure.TIM_DeadTime = (pDParams_str->hDeadTime)/2u;
  /* BKIN, if enabled */
  if ((pDParams_str->EmergencyStop)!= DISABLE) 
  {
    TIMx_BDTRInitStructure.TIM_Break = TIM_Break_Enable;
    TIMx_BDTRInitStructure.TIM_BreakPolarity = pDParams_str->hBKINPolarity;
    TIMx_BDTRInitStructure.TIM_AutomaticOutput = TIM_AutomaticOutput_Disable;
    TIM_ClearITPendingBit(TIMx, TIM_IT_Break);
    TIM_ITConfig(TIMx, TIM_IT_Break, ENABLE);
  } 
  TIM_BDTRConfig(TIMx, &TIMx_BDTRInitStructure);

What I found:
- the SD pin of the motor driver can act as an output and pull the line low in an overcurrent situation (2 amps).
- BKIN (PB12) is an input that can be configured for immediate shutdown of all six PWM outputs. Polarity can be active low, or active high. That feature can be enabled or disabled. That input is also configurable as an interrupt source, I haven't checked how the FOC libary configures that though. Most probably enabled. Interrupt "TIM_IT_Break" is enabled and assigned.

You'll find the settings in file "SystemNDriveParams.h" (output from STMC Workbench) in struct "R1_SDParams_t". There, you find these lines:

Code: [Select]
/* PWM Driving signals initialization ----------------------------------------*/ 
 (FunctionalState)SW_OV_CURRENT_PROT_ENABLING, /*!< It enable/disable the management of
                                            an emergency input instantaneously
                                            stopping PWM generation. It must be
                                            either equal to ENABLE or DISABLE */ 
  (uint16_t)(OVERCURR_FEEDBACK_POLARITY),/*!< Emergency Stop (BKIN) input polarity,
                                           it must be TIM_BreakPolarity_Low or
                                           TIM_BreakPolarity_High */
  EMERGENCY_STOP_GPIO_PORT,             /*!< Emergency Stop (BKIN) GPIO input
                                           port (if used, after re-mapping).
                                           It must be GPIOx x= A, B, ...*/
  EMERGENCY_STOP_GPIO_PIN,              /*!< Emergency Stop (BKIN) GPIO input pin
                                         (if used, after re-mapping). It must be
                                          GPIO_Pin_x x= 0, 1, ...*/     

In order to eliminate this mechanism from preventing your motor to spin, I suggest you make sure that SW_OV_CURRENT_PROT_ENABLING == DISABLE.

« Last Edit: November 17, 2016, 06:40:28 pm by tatus1969 »
We Are The Watt - Resistance Is Futile!
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #19 on: November 16, 2016, 07:51:26 pm »
Please also upload your complete project somewhere, there are many IAR project settings that can mess up things so I could check those.

I'm trying to export the project.

I'm more Eclipse user than IAR ...

The project has files all over the directory ....

It's ridiculous ... but I can not export the project with the IAR.

To send you the project I would have to send you the folder with the whole SDK (~ 400MB).

But the only files with some kind of change made by me are the files I've already sent you.

I'll take the project home. Any file you need I can search and send to you.
Only the "Project" and "SystemDriveParams" folders are interesting. If you leave out the SDK binaries (search for .a .o .pbi .cout etc, should be in subfolders like "MC Library Compiled"), it should not be that large.
We Are The Watt - Resistance Is Futile!
 

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #20 on: November 16, 2016, 08:26:12 pm »
Only the "Project" and "SystemDriveParams" folders are interesting. If you leave out the SDK binaries (search for .a .o .pbi .cout etc, should be in subfolders like "MC Library Compiled"), it should not be that large.

I hope I have not deleted too many files ...

https://meocloud.pt/link/3eaf8bf7-7baa-4699-af75-c8520d082afd/stm_foc_sdk.rar/

 

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #21 on: November 16, 2016, 09:03:28 pm »
You'll find the settings in file "SystemNDriveParams.h" (output from STMC Workbench) in struct "R1_SDParams_t". There, you find these lines:

/* PWM Driving signals initialization ----------------------------------------*/ 
 (FunctionalState)SW_OV_CURRENT_PROT_ENABLING, /*!< It enable/disable the management of
                                            an emergency input instantaneously
                                            stopping PWM generation. It must be
                                            either equal to ENABLE or DISABLE */ 
  (uint16_t)(OVERCURR_FEEDBACK_POLARITY),/*!< Emergency Stop (BKIN) input polarity,
                                           it must be TIM_BreakPolarity_Low or
                                           TIM_BreakPolarity_High */
  EMERGENCY_STOP_GPIO_PORT,             /*!< Emergency Stop (BKIN) GPIO input
                                           port (if used, after re-mapping).
                                           It must be GPIOx x= A, B, ...*/
  EMERGENCY_STOP_GPIO_PIN,              /*!< Emergency Stop (BKIN) GPIO input pin
                                         (if used, after re-mapping). It must be
                                          GPIO_Pin_x x= 0, 1, ...*/     


In order to eliminate this mechanism from preventing your motor to spin, I suggest you make sure that SW_OV_CURRENT_PROT_ENABLING == DISABLE.

The only reference I can find is in the MCTasks.c file (and in the SystemNDriveParams.h file).
Code: [Select]
oCurrSensor[M1] = (CPWMC)R1F0XX_NewObject(&PWMnCurrFdbkParamsM1, &R1_SDParams);
This is all a bit tricky ...
« Last Edit: November 16, 2016, 09:05:16 pm by Dave_PT »
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #22 on: November 16, 2016, 09:08:35 pm »
Only the "Project" and "SystemDriveParams" folders are interesting. If you leave out the SDK binaries (search for .a .o .pbi .cout etc, should be in subfolders like "MC Library Compiled"), it should not be that large.

I hope I have not deleted too many files ...

https://meocloud.pt/link/3eaf8bf7-7baa-4699-af75-c8520d082afd/stm_foc_sdk.rar/
Should be complete. I checked --> #define SW_OV_CURRENT_PROT_ENABLING      DISABLE

Your Eclipse project file is not included there, that would be essential. The library extensively uses #define rubbish.

I checked my IAR project. It defines the following globals:
USE_STDPERIPH_DRIVER
STM32F10X_MD
ARM_MATH_CM3

Here is the search path for .c/h files:
$PROJ_DIR$\..\..\STM32 PMSM FOC LIBv4.0\ProtectedSources\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x
$PROJ_DIR$\..\..\STM32 PMSM FOC LIBv4.0\ProtectedSources\Libraries\STM32F10x_StdPeriph_Driver\inc
$PROJ_DIR$\..\..\STM32 PMSM FOC LIBv4.0\ProtectedSources\MCLibrary
$PROJ_DIR$\..\..\STM32 PMSM FOC LIBv4.0\ProtectedSources\MCLibrary\inc
$PROJ_DIR$\..\..\STM32 PMSM FOC LIBv4.0\ProtectedSources\MCLibrary\interface
$PROJ_DIR$\..\..\STM32 PMSM FOC LIBv4.0\ProtectedSources\MCLibrary\interface\common
$PROJ_DIR$\..\..\STM32 PMSM FOC LIBv4.0\ProtectedSources\MCApplication\inc
$PROJ_DIR$\..\..\STM32 PMSM FOC LIBv4.0\ProtectedSources\MCApplication\interface
$PROJ_DIR$\..\..\STM32 PMSM FOC LIBv4.0\ProtectedSources\UILibrary\inc
$PROJ_DIR$\..\..\STM32 PMSM FOC LIBv4.0\ProtectedSources\UILibrary\interface
$PROJ_DIR$\
$PROJ_DIR$\SystemDriveParams

For some of the files you only have the compiled libary binaries.

Have you been more successful with the new kit? Does the RS232 link work?
We Are The Watt - Resistance Is Futile!
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #23 on: November 16, 2016, 09:24:29 pm »
You'll find the settings in file "SystemNDriveParams.h" (output from STMC Workbench) in struct "R1_SDParams_t". There, you find these lines:

/* PWM Driving signals initialization ----------------------------------------*/ 
 (FunctionalState)SW_OV_CURRENT_PROT_ENABLING, /*!< It enable/disable the management of
                                            an emergency input instantaneously
                                            stopping PWM generation. It must be
                                            either equal to ENABLE or DISABLE */ 
  (uint16_t)(OVERCURR_FEEDBACK_POLARITY),/*!< Emergency Stop (BKIN) input polarity,
                                           it must be TIM_BreakPolarity_Low or
                                           TIM_BreakPolarity_High */
  EMERGENCY_STOP_GPIO_PORT,             /*!< Emergency Stop (BKIN) GPIO input
                                           port (if used, after re-mapping).
                                           It must be GPIOx x= A, B, ...*/
  EMERGENCY_STOP_GPIO_PIN,              /*!< Emergency Stop (BKIN) GPIO input pin
                                         (if used, after re-mapping). It must be
                                          GPIO_Pin_x x= 0, 1, ...*/     


In order to eliminate this mechanism from preventing your motor to spin, I suggest you make sure that SW_OV_CURRENT_PROT_ENABLING == DISABLE.

The only reference I can find is in the MCTasks.c file (and in the SystemNDriveParams.h file).
Code: [Select]
oCurrSensor[M1] = (CPWMC)R1F0XX_NewObject(&PWMnCurrFdbkParamsM1, &R1_SDParams);
This is all a bit tricky ...
that is how the library is organized. mctasks.c instanciates all objects and feeds them with parameters. the library is using a poormans object oriented approach, still being pure c code.
We Are The Watt - Resistance Is Futile!
 

Offline Dave_PTTopic starter

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #24 on: November 16, 2016, 10:28:42 pm »
Your Eclipse project file is not included there, that would be essential. The library extensively uses #define rubbish.
You wanted to say IAR, right?
Please do not ruin my head  ;D.


Have you been more successful with the new kit? Does the RS232 link work?
The new KIT should arrive tomorrow (if the carrier is not late) ...
Tomorrow as soon as the KIT arrives I test this all and keep the topic updated.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf