2014-08-08 03:31 AM
Hello,
I would like to use the latest FOC library for small PMSM motor. I'm using STM32F303VCT6 MCU and I would like to use internal PGA. But motor doesn't run at all. Start sequence starts, but with very high current consuption (higher that I set in WB). I finaly fount that probably AD converter doesn't give a correct value. I see it mainly on Vbus voltage measurement. Measured value is not correct. It shoul be ~325V but reading from MCU give me a value ~189V and it fall down to ~21V after few seconds. Voltage on board is corrent, also MCU ADC works correct - I mean nothing is damaged on the board. I've check it with modified example project in StdLib for STM32F3 and it converts value from Vbus pin. So it seems to me, that something is wrong with setting of AD converter in library. ADC does not measure correct values of Vbus and probably also phase currents and that's why motor has during start so big current consuption and doesn't run. I'm attaching my settings in WB. Maybe I sould mention, that I use KEIL MDK to compile library. Any help/tips would be helpfull. Thanks. Daniel #foc-adc #mcu #foc-adc #foc #foc-adc2014-08-12 08:35 AM
Dear Daniel,
which hardware are you using, ST evaluation boards or custom? have you double checked the power stage\bus voltage sensing divider? any error raised from FW?
The pin assigned for bus voltage sensing - i see - is ADC12_IN9 on ADC2 , could you try assigning ADC1 instead? Is Vmcu = 3.3V? could you double check the actual HW matches the FW configuration?Regards,
Dino2014-08-13 09:11 AM
Hello Dino,
I'm using custom hardware. I've checked hardware and I can see correct voltage on the pin of MCU. I've also tried to check AD converter with another code and the converter give me a correct value. So the HW is ok. During start of motor FW give me a fault MC_UNDER_VOLT. This is true, because VBS_GetAvBusVoltage_V returns small value (at a beginning ~189, after few second ~21) and it should be ADC12_IN9 on ADC2 is set manually. Original value was ADC1, but then FW give me bus voltage ~1. Few notes about library: I was not able to compile and run code without changing manually constant BKIN2_MODE to NONE in file Control stage parameters.h and constant PWM_TIMER_SELECTION2 to TIM1 in file Control stage parameters motor2.h. One of this change enable me to compile it and another to run code without ending in HardFault interrupt. MCU voltage is 3.3V. Beside of this I've alredy tried to use IAR compiler - behavior is absolutely the same. My last try was to use configuration from joevn - I found it here on this forum. It is for two motors (ok I will use only one) and of course I had to modified it little bit for my HW (I'm attaching this file). Workbench generated files and it was possible to compile it without any problem, but during debuging code ends in MCboot function. When I stop MCU it stuck in function ADC_GetFlagStatus. Maybe it is a problem of this particular MCU. I would like to use another type of MCU from F3xx family - right know I don't have another MCU and time :) Maybe I will try to use your STM32F3Discovery kit. It has the same MCU. At least I will only try if the voltage measurement works. Daniel ________________ Attachments : F12_motor_dual.stmc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hz12&d=%2Fa%2F0X0000000bJf%2F5MsiEmrcOrBogwA7FyZEBbUB0P7vUBVviEDO2gXCG28&asPdf=false2014-08-15 12:16 PM
So I have tried to use Discovery kit. I'm using the same type of MCU as it is used in STM32F3Discovery kit. I only added crystal and downloaded code to kit and I put trimer on pin PC3 at which I normaly measure bus voltage. And it works. FW give me correct values and it seems it really measures voltage.
Is it possible that there are some difference inside MCU? The true is, that MCU that I have were bought long time ago. Is there some errata or list of ''changes'' for MCU as it is produced during time? Daniel2014-08-25 01:49 AM
Ciao Daniel
You can find the Errata Sheet in the ST.com. Anyhow, if is possible, try to get a new micro and replace it in the custom HW in order to understand if the problem is really in that particular part. Ciao Gigi2014-09-02 04:53 AM
Hello Gigi
Problem solved. I bought new MCU, resolder it and it works at first try. That's interesting. I have a lot of these old MCUs. That is pity, but I rather buy a new samples for new projects. Daniel2014-12-12 08:35 AM
2014-12-13 06:33 AM
Dear Gigi , i m trying to generate code for PMSM single drive from MC work bench, i gives 4 header files and one MC_it.c file. i m using Kiel u_vision4 . when i add these 4 header files and one c file and compile it it give error. can you please tell me the procedure to comiple the code and run PMSM, my controller is STM32F303VcT6.
also can you please provide me source code ?2014-12-14 02:17 AM
please help me gigi sir
2014-12-17 04:13 AM