The reason you are encountering the error "FixedStep cannot be used" is because the "FixedStep" method is not compatible with the WhenEvent feature in NDSolve. The WhenEvent feature requires an adaptive step size method to handle the event detection accurately.
To modify your program, you can switch to an adaptive step size method such as the default method "Automatic" or "BDF" (Backward Differentiation Formula). Here's an updated version of your code using "BDF" as the method:
system = {vi q[t] == l il'[t] + ir[t] r, il[t] == ir[t], il[0] == 0};
control = {q[0] == 1,
WhenEvent[Mod[t, τ] == (2/3) τ, q[t] -> 0],
WhenEvent[Mod[t, τ] == 0, q[t] -> 1]};
pars = {vi -> 24, r -> 22, l -> 2 10^-2,
c -> 1 10^-4, τ -> 25/10 10^-4};
sol = NDSolve[{system, control} /. pars, {il, q}, {t, 0, 0.2},
Method -> {"EquationSimplification" -> "Residual", "BDF"},
DiscreteVariables -> q];
a = Evaluate[il[t] /. sol];
Plot[a, {t, 0, 0.06}, AxesLabel -> {"s", "il[t]/A"},
PlotLegends -> {"BDF"}, PlotStyle -> {Red}, PlotRange -> All]
In this modified code, I have removed the StartingStepSize option since we are now using an adaptive step size method. I have also replaced the Method -> {"FixedStep", Method -> "LinearlyImplicitEuler"} with Method -> {"EquationSimplification" -> "Residual", "BDF"} smash karts to specify the "BDF" method for solving the differential equation.