Overcurrent event on start with FOC  [SOLVED]

Post Reply
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Overcurrent event on start with FOC

Post by arber333 »

I finally tried to use FOC code to run PMSM motor with resolver.
It is 4pole servo motor with 2 pole tamagawa resolver.
when I set it up and connect precharge everything seems good. Code recognise 350Vdc. No faults found.
But as I start inverter and dc switch closes overcurrent is triggered. This happens no matter if resolver cable is connected or not.
I used 3 different olimex chips with latest 4.76R code.
I tried various settings and it seems it only happens with resolver or sin/cos. If I choose ABZ encoder I can start inverter and get pwm.
Can anyone explain what would the problem be? I think it may be hardware related.

EDIT: I tried removing ESP in case resolver and ESP would put too much load on the main chip. Still i get OC event on startup. I didnt even connect resolver cable to the board. Strange because i could run Leaf motor with rev2 board and resolver before.
I made a circuit according to Johannes here viewtopic.php?f=2&t=15#p65
I removed correct pullup resistors and caps.

However if i change to ABZ encoder i can start without problems and apply PWM to motor...

Anyone came across similar issue?
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: Overcurrent event on start with FOC

Post by johu »

First verify the resolver signal is sane. Put the inverter in a state where it generates the 4.4kHz
exciter signal and check what comes back from the feedback coils. You want to see at least, say, 1.5V peak-peak. More is better. Of course not more than 3.3V.

If adjustment is needed (considering a V3 mainboard) a lower value for R41+R40 (it's 2, to allow odd values) will result in a higher output amplitude and vice versa. Make sure to adjust the output of the boost converter to just put the amplifier into saturation (e.g. 9V for 8V amplitude). If the margin between supply and output voltage becomes too high, the SMT part gets hot.

Next follow this:

https://openinverter.org/wiki/Using_FOC_Software

Otherwise the default parameters are quite sane with the most recent release and you only need to set up the usual stuff like polepairs, respolepairs etc. It is very important that PWM-channels, current sensor channels and resolver sin/cos all line up. So PWM1 drives the phase with current sensor 1 etc. The direction of current also becomes important. Otherwise you either get instant over current or no movement. Or worse: it seems to sort of work but conks out later.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Overcurrent event on start with FOC

Post by arber333 »

OK i read your instructions.... what does this mean: "Only V3 main boards generate this excitation signal."
Cant i use rev 2 with Olimex chip and your resolver schematic and generate excitation at PD2? I used this setup before and it worked!!!

A
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: Overcurrent event on start with FOC

Post by johu »

Yes you can, no worries ;) V3 just has the amplifier on board
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Overcurrent event on start with FOC

Post by arber333 »

Ok then how do I get resolver Settings to start in mode 2? I tried various tricks but no luck.
Could I swap the current sensor position in software? Or pwm outputs?

Actually which pwm I/O is considered A, B, C? Volt has colour coded outputs Which are the same colour than Corresponding sensor lines. Very easy to setup really unless of course I swapped Olimex pins at design... could that be a problem?

Also I use 3k3/4k7 divider for 5v sensors. Should I rather use 3k3/6k8 to have full 3v3 range? I see rev3 uses the former?

Still I can sense no signal on pd2 output. Would that signal work out of start phase?

Thx
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Overcurrent event on start with FOC

Post by arber333 »

My PWM setup with Olimex STM32-H103 looks like this:
phases.jpg
Would that be good or should i correct it?

tnx
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Overcurrent event on start with FOC

Post by arber333 »

OK on close examination i found out i connected Fault transistor collector directly to PA3 (Mprot) pin. Would that be ok or could that be source of my problem?
When Fault is triggered NPN transistor pulls PA3 to GND. Under normal operation PA3 is floating at 3V.
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Overcurrent event on start with FOC

Post by arber333 »

I am not sure what is going on, but i have no 4kHz signal on PD2. Should i use pullup with PD2? I deleted it from board since instruction clearly state it shouldnt be populated. Hm.. should i also remove 1nF cap from the Z channel?

I did see 17khz function on PB8 and PB7 Which had complementary PWM. PB8 was at 80% duty and PB7 20%.
I also see 5Hz function on PC12.

Otherwise i didnt notice any other functions.

I have resolver connected at R1 to R2(gnd) and S1 through S4. S2 and S3 have 1.5V continuous voltage on them. R1 is at GND level.

EDIT: I tried to add 4.4khz square function from generator directly to resolver and i get one larger squid and smaller squid in return on S2 and S3.
If i select "sin cos" i still get overcurrent...
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Overcurrent event on start with FOC

Post by arber333 »

Well i went on and reinstalled firmware 4.12R that i succesfuly used last time with Leaf motor.
Sure enough i can start inverter and get good excitation signal on PD2/R1. Also good response from resolver core.
I do have small problem with throttle2 signal throwing a warning despite it is not connected at all. I will inspect the board further.
I will also try to run the motor...

Johannes what is wrong with 4.76R code that it doesnt put excite signal through?
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Overcurrent event on start with FOC

Post by arber333 »

Ok... strange. I loaded 4.71R FOC code and setup my scope. When i start initially i get good square function on PD2, but the next second inverter throws OClimit again. Something is not good here.
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: Overcurrent event on start with FOC

Post by johu »

Nothings wrong with the code as it runs on various inverters. You just have to be more careful with the channel alignment
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Overcurrent event on start with FOC  [SOLVED]

Post by arber333 »

Well i think i found out my problem. According to Rev 2 design i connected PA0 pin directly to NAND gate. I cant see this pin on your Rev 3 design. Did you leave this pin floating? If so it may be floating at 2.5V and is discharged when Olimex starts and momentarily discharges NAND gate.
I tried this with my scope probe and it seems small probe capacitance was enough to keep inverter from tripping OC limit. I may just add one 10nf on its pin. If tht doesnt work i will cut the trace and connect it to one pullup.

EDIT: This thing now works! I used one 10nf cap from PA0 to GND and thing is solid now.
I still need to make some changes. I see it is not a good idea to have EMGC and MPROT pins connected to NAND gate since brain only sees error from overcurrent that way.

I will perform calibration of sensors now and setup everything to test with motor spinning. Then i will mark this solved.

Johannes can you tell me what is the purpose of PA0 pin on your rev. 3 HW and in new code?
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Overcurrent event on start with FOC

Post by arber333 »

johu wrote: Sun Mar 15, 2020 6:31 am Nothings wrong with the code as it runs on various inverters. You just have to be more careful with the channel alignment
Hi J

I am fiddling with my Volt inverter board design based on your V2 design (DIP stuff with Olimex on top). Currently i am using your newest V5 firmware and i am getting OClimit whenever i start my inverter with FOC code. If i use ACIM code inverter works really good.
I am not sure what the differences are physicaly but i observed in your schematic that V3 board uses somewhat less inputs on the NAND gate which provide OC and other trip inputs. I found 2 inputs not connected on the V3 board which ARE connected to NAND on V2 design.

PC7
PA0
Can you tell me the state of those inputs while brain is in operation? Even if they are not used...

There is another difference i noticed. I/O from LM2901 comparator to PC9 is transmitting some PWM. On V3 board you add 1nF cap to pullup resistor, why? While with ACIM code there was no issue, FOC trips OClimit. But if i add the cap on PC9 i/o FOC starts fine with some anomalies.
Is is possible you changed a sensing law for PC9 for FOC?

Is it possible that ACIM code still sees PC7/PA0 pins as active pins and FOC code just pulls them to GND at start, thereby triggering OClimit, since i use them as active inputs?

I see i will probably need to redesign my boards to follow the new FOC code...
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: Overcurrent event on start with FOC

Post by johu »

There are no different pin assignments in FOC. How is your board detected (hwver)?
PC9 is the desat input and PA0 used to be a separate UVLO input. In V3 I also disconnected emcystop from the NAND gate because I thought one external hardware shutdown pin (mprot) should suffice.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Overcurrent event on start with FOC

Post by arber333 »

johu wrote: Tue Apr 06, 2021 9:10 am There are no different pin assignments in FOC. How is your board detected (hwver)?
PC9 is the desat input and PA0 used to be a separate UVLO input. In V3 I also disconnected emcystop from the NAND gate because I thought one external hardware shutdown pin (mprot) should suffice.
Ok, i tried to see what FW shows.
For the primary side it shows 5.0 FOC on rev2 hardware
For the secondary side it shows 4.9 Sine code on rev2 hardware.
screenshots attached...

When i attached Wifi module i immediately get OClimit on the brain to which wifi module is connected. I guess it draws just too much for the AD to be stable. I am waiting for 3V3 LDOs. I actually made provision for separate 3V3 supply.

So in FOC code what happens with the PC7 and PA0 pins? You dont show them connected so...?

tnx
Attachments
Screenshot_2021-04-06-13-07-07-572_com.android.chrome.png
Screenshot_2021-04-06-13-05-20-739_com.android.chrome.png
Post Reply