An I/O controller for virtual pinball machines: accelerometer nudge sensing, analog plunger input, button input encoding, LedWiz compatible output controls, and more.

Dependencies:   mbed FastIO FastPWM USBDevice

Fork of Pinscape_Controller by Mike R

Issue: PWM output are strange if i have a tlc5940 extention card...


I've made electronics cards with TLC5940 and mosfet output, then another card with just 8 mosfet output. If i program my output ONLY with mosfet board and PWM output (PTA1, A2,A4,A5,A12,B1,C8&C9) everything work fine. If then i put a TLC5940 device in pinscape config tool (SI:PTC6,SCLK:C5,XLAT:C10,BLANK:C11,GSCLK:C4), my 8 regular PWM mosfet output have an issue, the curve is différent on each channel (like 2 different groups of curve). So, having a TLC device in configuration affect my regular PWM output...

Do you have any idea about that ?



27 Mar 2020

Yes, the TLC5940 interface will affect PWM frequencies on other GPIO pins that you might be using for regular outputs. The TLC5940 interface requires a PWM pin to generate the master clock signal for the TLC5940 chip, and the way the KL25Z is wired internally, the PWM frequency that's set on one port affects a whole group of ports. The correspondence between ports and frequencies is complex and arbitrary - it's just how the KL25Z is wired internally. For full details, refer to "PWM Limitations" in the KL25Z Pin-Out section in the Build Guide:


I'm not sure what you mean by "curve", but at a guess, your MOSFET boards are probably using optocouplers that are too slow for the 350kHz frequency that the TLC5940 sets on its TPM unit. Common optocouplers top out at around 80kHz. The MOSFETs themselves can usually go into the mega-Hertz, but that won't matter if they're connected through slower optos.

You can't really slow down the TLC5940 chip without starting to visible strobing on attached LEDs (350kHz is about as slow as it can go), so changing that isn't an option. You *could* potentially look for faster booster boards, but short of building something yourself using high-spec parts, that's probably not going to turn up anything. I think your best bets are: (1) toss out the MOSFET boards and add more TLC5940 outputs instead, or (2) try to move around the GPIO pin assignments so that the TLC5940 master clock signal generator is on a separate TPM unit from the ones you're using for the direct feedback-device GPIO ports. The TPM/GPIO matrix in the Build Guide chapter linked above will help you with that.

27 Mar 2020

One quick addition: when I said "toss out the MOSFET boards", what I should have said was that you can keep the MOSFET boards, but you just have to move them over to additional TLC5940 outputs. The TLC5940 outputs themselves only run at about 200 Hz, so they'll work fine with slow optos.

29 Mar 2020

Hey, thanks for your answer.

I moved my GPIO regarding your link, it was the issue, now it work like a charm.

When i talked about "curve", it's because i'm a lighting tech (use to talk about curve to define how is the output), and the way the outputs change wasn't similar regarding the output (and so, the GPIO), but now it's fine.

And i have no flicker issue with LTV817A and 80Khz, it's quite enough for a pincab ;)

Thanks a lot for your job dude !