LCD backlight and PWM

We have a piezo buffer on our board. The following code works fine:

        TempComponents.PWMPiezoController = PwmController.FromName(SC20260.PwmChannel.Controller5.Id);
        TempComponents.PWMPiezo = TempComponents.PWMPiezoController.OpenChannel(SC20260.PwmChannel.Controller5.PI0);
        TempComponents.PWMPiezoController.SetDesiredFrequency(1000.0);
        TempComponents.PWMPiezo.SetActiveDutyCyclePercentage(0.56);

        TempComponents.PWMPiezo.Start();

The :LCD backlight is on SC20260 pin 130 (PI7). If I use this pin as straight GPIO then it works as expected. This pin can also be setup as PWM. The following code does not work:

        TempComponents.PWMcontroller = PwmController.FromName(SC20260.PwmChannel.Controller8.Id);
        TempComponents.PWMcontroller.SetDesiredFrequency(1000.0);
        DataDefs.BacklightPwmLED = TempComponents.PWMcontroller.OpenChannel(SC20260.PwmChannel.Controller8.PI7);
        DataDefs.BacklightPwmLED.SetActiveDutyCyclePercentage(1.0);
        DataDefs.BacklightPwmLED.Start();

In fact, when the Start() is called the entire system fails. (strange behavior everywhere)

Pin 130 is defined as
PI7 or PWM8.3

Is the pwm set up correct ?

what does “entire system fails” mean?

1 Like

It means it no longer functions as expected. Code paths are random. Any timers are scrambled, Execution is very slow.

Since each pwm uses a different controller they should work beautifully side by side. If you see anything different then please provide a small program showing what you expect vs what you actually see.

Without sufficient data, or knowledge about what your applications does, I say you are suffering from excessive garbage collection.