* Z:\home\khalils\Downloads\files\data\raw_asc\16f5343726c2_current_source_new.asc
* Generated by LTspice 26.0.1 for Windows.
* .tran {TC*20} uic
* .op
* {300*exp(beta*(1/(TEMP+273.15)-1/(25+273.15)))}
* WATCH OUT FOR 300mA PEAK CURRENT!!!!\nSELECTED ZENNER MIGHT BE MAD ABOUT IT
* Depending on the number of compensation elements, R_TRIM needs to be:\n673 for 0\n1.17k for 1\n3k for 2\n60k for 3\nThese numbers are approximate.
* So the problem seem to be with the gate drive:\n \nI managed to set the low level so high that it partially turns the FET off during the transient,\nkicking the LC formed by the load and the gate capacitance again and again, leading to\noscillation. If you don't do that however, the turn-on transient ends up overshooting\nthe current source.
;.step temp 0 75 25
;.step param VCC 18 25 1
;.step param R_SET 100 350 5
;.step param beta 3100 4000 100
;.step param R_SET 15 30 15
;.step dec param L_COMP 100n 1000n 3
;.step param R_TRIM 3k 4k 25
R21 N010 RIGHT 25
R4 N007 DB 100
R5 N011 RIGHT 50
Q7 DB DB N006 0 2N3906
R1 DB N009 {R_TRIM}
R7 VCC VT 145
Q9 N005 N005 N003 0 2N3906
C3 NC_01 N010 5n
D2 Vd Vb BAT54SHY
V1 VCC 0 {VCC}
D9 N012 LEFT BZX84C27VLY
Q5 0 N007 Vb 0 2N3906
C2 NC_02 N011 100n
D3 Vd LEFT 1N914
C1 VCC N002 22n
L4 RIGHT N008 {L_SET}
R12 LEFT N008 {R_SET}
I1 RIGHT 0 PULSE(0 320m 50n 1n 1n {TON} {TC}) AC 1
R2 N001 Ve {R_ISENSE}
D4 N003 VCC BZX84C6V2L
R13 VT N004 145
Q1 N006 N006 N004 0 TIP42C
V2 NC_03 RIGHT PULSE(0 2 50n 1n 1n {TON} {TC}) AC 1
R3 N005 0 4.7k
D12 RIGHT RIGHT 1N914
RT VCC VT {300*exp(beta*(1/(TEMP+273.15)-1/(25+273.15)))}
L1 VCC N001 10n
Q4 Vd Vb Ve 0 TIP42C
R6 N012 RIGHT 500
Q8 0 N005 N009 0 2N3906
.model D D
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.dio
.model NPN NPN
.model PNP PNP
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.bjt
.lib ../../spice_models/tip42c.bjt
.param VCC=20
.param beta=3468
.temp 25
.step param L_SET list 1p 1u 2u 4u
.lib ../../spice_models/tip41c.bjt
.param L_SET=1p
.param R_SET=15
.param TON=10350n
.param TC=20500n
.param R_ISENSE=0.562
.param R_TRIM=3.0k
.ac dec 100 100k 1000mega
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 4220 5156
WIRE -2496 -1552 -2928 -1552
WIRE -2416 -1552 -2496 -1552
WIRE -2160 -1552 -2416 -1552
WIRE -1312 -1552 -2160 -1552
WIRE -1200 -1552 -1312 -1552
WIRE -1200 -1488 -1200 -1552
WIRE -1312 -1344 -1312 -1552
WIRE -1200 -1328 -1200 -1408
WIRE -2160 -1264 -2160 -1552
WIRE -2160 -1264 -2352 -1264
WIRE -1312 -1232 -1312 -1280
WIRE -1200 -1216 -1200 -1248
WIRE -2352 -1200 -2352 -1264
WIRE -2160 -1200 -2160 -1264
WIRE -1200 -1200 -1200 -1216
WIRE -1376 -1152 -1840 -1152
WIRE -1328 -1152 -1376 -1152
WIRE -1264 -1152 -1328 -1152
WIRE -2352 -1072 -2352 -1120
WIRE -2208 -1072 -2352 -1072
WIRE -2160 -1072 -2160 -1120
WIRE -2160 -1072 -2208 -1072
WIRE -1376 -1056 -1376 -1152
WIRE -1312 -1056 -1376 -1056
WIRE -1200 -1056 -1200 -1104
WIRE -1200 -1056 -1248 -1056
WIRE -2496 -1024 -2496 -1552
WIRE -2160 -1008 -2160 -1072
WIRE -2496 -880 -2496 -960
WIRE -2160 -880 -2160 -928
WIRE -2560 -832 -2656 -832
WIRE -2224 -832 -2320 -832
WIRE -2656 -752 -2656 -832
WIRE -2496 -752 -2496 -784
WIRE -2496 -752 -2656 -752
WIRE -2320 -752 -2320 -832
WIRE -2160 -752 -2160 -784
WIRE -2160 -752 -2320 -752
WIRE -2160 -720 -2160 -752
WIRE -2224 -672 -2320 -672
WIRE -2320 -592 -2320 -672
WIRE -2160 -592 -2160 -624
WIRE -2160 -592 -2320 -592
WIRE -1840 -576 -1840 -1152
WIRE -1200 -544 -1200 -1056
WIRE -2160 -528 -2160 -592
WIRE -2128 -528 -2160 -528
WIRE -2064 -528 -2128 -528
WIRE -1904 -528 -1984 -528
WIRE -1200 -512 -1200 -544
WIRE -2928 -496 -2928 -1552
WIRE -2160 -464 -2160 -528
WIRE -1200 -352 -1200 -448
WIRE -1120 -352 -1200 -352
WIRE -1040 -352 -1120 -352
WIRE -880 -352 -960 -352
WIRE -752 -352 -800 -352
WIRE -736 -352 -752 -352
WIRE -624 -352 -736 -352
WIRE -624 -336 -624 -352
WIRE -1200 -272 -1200 -352
WIRE -2160 -176 -2160 -384
WIRE -1136 -160 -1136 -240
WIRE -720 -160 -720 -240
WIRE -2496 -128 -2496 -752
WIRE -2224 -128 -2496 -128
WIRE -1200 -128 -1200 -208
WIRE -2496 -80 -2496 -128
WIRE -2928 16 -2928 -416
WIRE -2496 16 -2496 0
WIRE -2496 16 -2928 16
WIRE -2320 16 -2496 16
WIRE -2160 16 -2160 -80
WIRE -2160 16 -2320 16
WIRE -1840 16 -1840 -480
WIRE -1840 16 -2160 16
WIRE -1200 16 -1200 -48
WIRE -1136 16 -1136 -80
WIRE -1136 16 -1200 16
WIRE -1008 16 -1136 16
WIRE -928 16 -1008 16
WIRE -752 16 -752 -352
WIRE -752 16 -928 16
WIRE -720 16 -720 -80
WIRE -720 16 -752 16
WIRE -624 16 -624 -272
WIRE -624 16 -720 16
WIRE -2320 48 -2320 16
WIRE -928 96 -928 16
WIRE -928 320 -928 176
WIRE -1216 352 -1376 352
WIRE -1376 432 -1376 352
WIRE -1312 432 -1376 432
WIRE -1216 432 -1312 432
CIRCLE Normal -2256 -1104 -2432 -1216 2
SYMBOL res -2176 -1216 R0
SYMATTR InstName R7
SYMATTR Value 145
SYMBOL res -736 -176 R0
SYMATTR InstName R5
SYMATTR Value 50
SYMBOL cap -1152 -304 R0
SYMATTR InstName C3
SYMATTR Value 5n
SYMBOL diode -1216 -512 R0
SYMATTR InstName D3
SYMATTR Value 1N914
SYMBOL pnp -2224 -784 M180
SYMATTR InstName Q1
SYMATTR Value TIP42C
SYMBOL res -2176 -480 R0
SYMATTR InstName R1
SYMATTR Value {R_TRIM}
SYMBOL res -2176 -1024 R0
SYMATTR InstName R13
SYMATTR Value 145
SYMBOL res -1968 -544 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R4
SYMATTR Value 100
SYMBOL ind -784 -368 R90
WINDOW 0 5 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName L4
SYMATTR Value {L_SET}
SYMBOL cap -1328 -1344 R0
SYMATTR InstName C1
SYMATTR Value 22n
SYMBOL res -1216 -144 R0
SYMATTR InstName R6
SYMATTR Value 500
SYMBOL voltage -2928 -512 R0
SYMATTR InstName V1
SYMATTR Value {VCC}
SYMBOL pnp -1264 -1104 M180
SYMATTR InstName Q4
SYMATTR Value TIP42C
SYMBOL pnp -2224 -80 M180
SYMATTR InstName Q8
SYMATTR Value 2N3906
SYMBOL res -2368 -1216 R0
WINDOW 3 -440 -107 Left 2
SYMATTR Value {300*exp(beta*(1/(TEMP+273.15)-1/(25+273.15)))}
SYMATTR InstName RT
SYMBOL res -1152 -176 R0
SYMATTR InstName R21
SYMATTR Value 25
SYMBOL schottky -1248 -1072 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName D2
SYMATTR Value BAT54SHY
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL res -1056 -336 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 0 56 VBottom 2
SYMATTR InstName R12
SYMATTR Value {R_SET}
SYMBOL pnp -1904 -480 M180
SYMATTR InstName Q5
SYMATTR Value 2N3906
SYMBOL res -2512 -96 R0
SYMATTR InstName R3
SYMATTR Value 4.7k
SYMBOL voltage -1008 -80 R0
WINDOW 123 24 44 Left 2
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value PULSE(0 2 50n 1n 1n {TON} {TC})
SYMATTR Value2 AC 1
SYMBOL res -1216 -1344 R0
SYMATTR InstName R2
SYMATTR Value {R_ISENSE}
SYMBOL ind -1216 -1504 R0
SYMATTR InstName L1
SYMATTR Value 10n
SYMBOL pnp -2560 -784 M180
WINDOW 0 -25 28 Left 2
WINDOW 3 -86 72 Left 2
SYMATTR InstName Q9
SYMATTR Value 2N3906
SYMBOL current -928 96 R0
WINDOW 123 24 28 Left 2
WINDOW 39 0 0 Left 0
SYMATTR InstName I1
SYMATTR Value PULSE(0 320m 50n 1n 1n {TON} {TC})
SYMATTR Value2 AC 1
SYMBOL zener -2480 -960 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D4
SYMATTR Value BZX84C6V2L
SYMBOL cap -736 -304 R0
SYMATTR InstName C2
SYMATTR Value 100n
SYMBOL diode -1184 -208 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D9
SYMATTR Value BZX84C27VLY
SYMBOL diode -640 -336 R0
SYMATTR InstName D12
SYMATTR Value 1N914
SYMBOL pnp -2224 -624 M180
WINDOW 0 -25 28 Left 2
WINDOW 3 -86 72 Left 2
SYMATTR InstName Q7
SYMATTR Value 2N3906
FLAG -2320 48 0
FLAG -2208 -1072 VT
FLAG -2416 -1552 VCC
FLAG -2128 -528 DB
FLAG -928 320 0
FLAG -1120 -352 LEFT
FLAG -736 -352 RIGHT
FLAG -1200 -544 Vd
FLAG -1328 -1152 Vb
FLAG -1200 -1216 Ve
FLAG -1312 432 0
TEXT -2624 456 Left 2 ;.tran {TC*20} uic
TEXT -2624 136 Left 2 !;.step temp 0 75 25
TEXT -2624 104 Left 2 ;.op
TEXT -2624 168 Left 2 !;.step param VCC 18 25 1
TEXT -2624 200 Left 2 !.lib ../../spice_models/tip42c.bjt
TEXT -2624 232 Left 2 !.param VCC=20
TEXT -2616 304 Left 2 !;.step param R_SET 100 350 5
TEXT -2640 -1624 Left 2 !.param beta=3468
TEXT -2624 -1672 Left 2 !;.step param beta 3100 4000 100
TEXT -2160 -1672 Left 2 ;{300*exp(beta*(1/(TEMP+273.15)-1/(25+273.15)))}
TEXT -1968 -1600 Left 2 !;.step param R_SET 15 30 15
TEXT -2616 -1760 Left 2 !.temp 25
TEXT -1592 -1600 Left 2 !.step param L_SET list 1p 1u 2u 4u
TEXT -2192 200 Left 2 !.lib ../../spice_models/tip41c.bjt
TEXT -1592 -1632 Left 2 !.param L_SET=1p
TEXT -1960 -1632 Left 2 !.param R_SET=15
TEXT -2632 360 Left 2 !.param TON=10350n
TEXT -2624 408 Left 2 !.param TC=20500n
TEXT -944 -1664 Left 2 !.param R_ISENSE=0.562
TEXT -448 -288 Left 2 ;WATCH OUT FOR 300mA PEAK CURRENT!!!!\nSELECTED ZENNER MIGHT BE MAD ABOUT IT
TEXT -1424 -1728 Left 2 !;.step dec param L_COMP 100n 1000n 3
TEXT -2104 72 Left 2 !;.step param R_TRIM 3k 4k 25
TEXT -2096 112 Left 2 !.param R_TRIM=3.0k
TEXT -2128 272 Left 2 ;Depending on the number of compensation elements, R_TRIM needs to be:\n673 for 0\n1.17k for 1\n3k for 2\n60k for 3\nThese numbers are approximate.
TEXT -848 168 Left 2 ;So the problem seem to be with the gate drive:\n \nI managed to set the low level so high that it partially turns the FET off during the transient,\nkicking the LC formed by the load and the gate capacitance again and again, leading to\noscillation. If you don't do that however, the turn-on transient ends up overshooting\nthe current source.
TEXT -1608 -816 Left 2 !.ac dec 100 100k 1000mega