Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PWM Capability to MOSFET outputs (Fan Outputs) #701

Open
warasilapm opened this issue Jan 4, 2024 · 5 comments
Open

Add PWM Capability to MOSFET outputs (Fan Outputs) #701

warasilapm opened this issue Jan 4, 2024 · 5 comments
Assignees
Labels
area: pcb requires an update to an electrical design project: mobo Lumen motherboard type: enhancement New feature or request

Comments

@warasilapm
Copy link

warasilapm commented Jan 4, 2024

Version Number

Rev5b0

Bugfix or Enhancement

This is an enhancement.

Description

The MOSFET pins (MOS1-4) are currently driven by PE2-5. These are not all PWM capable because they lack the AF mapping to a TIM peripheral. The Gcode commnads for these outputs are the Marlin fan commands, which take an 8 bit duty cycle. This is not strictly necessary, but for the solenoids it may save energy (and thereby extend the life of the parts due to lower heat) to PWM them once they are actuated rather than leaving them at full current. This is relatively common.

Suggested Solution

Move MOS1 and MOS2 to PB8 and PB9 (TIM4/10/11) and move MOS3 and MOS4 to PE5 and PE6 (TIM9). This change to pin assignment should be fairly straightforward with the rev5 layout.

Alternatively, just moving the valve drivers to PE5/6 should be sufficient.

Interestingly, the best timer mapping is probably the two valves on PE5/6 since they will share frequency requirements and the pumps on PB8 and PB9 since they map to a different TIM block for whatever frequency requirements might be needed there.

@sphawes sphawes added type: enhancement New feature or request area: pcb requires an update to an electrical design project: mobo Lumen motherboard labels Jan 4, 2024
@sphawes sphawes added this to the REV05 Motherboard milestone Jan 4, 2024
@G-Pereira
Copy link
Collaborator

This can make sense. But we did not add this capability on purpoose since we didn't felt necessary initially.
@sphawes if you choose to implement this don't forget to check if the mosfet gate current does not violate the MCU pin max current.

@warasilapm
Copy link
Author

warasilapm commented May 6, 2024

...if you choose to implement this don't forget to check if the mosfet gate current does not violate the MCU pin max current.

Across that 120 ohm resistor there would be 27.5 mA into the empty gate capacitance. This is just over the per-pin absolute maximum in the datasheet.
image
This is quite east to solve with an increased series resistance. On the other hand, that may not be all that relevant with OSPEED set to the lowest value.
image
Since the gate capacitance is relatively small, a simply ramping of the output may be sufficient to prevent this issue.
image

Also, remember that if this were an issue it already exists in the current design. It will just be exacerbated by the move to PWM.

@warasilapm
Copy link
Author

warasilapm commented May 6, 2024

Spice supports my assumption about the slower output speed being sufficient:
image
Even at the fastest speed this doesn't quite reach the current limit:
image
image

@warasilapm
Copy link
Author

warasilapm commented May 6, 2024

Whoops! I did it with an order of magnitude less on the gate capacitance. Looks like it's fine on the slowest output speed but might not be at the highest. My mistake!
image
image

That said, I have a distant memory of the outputs being current limited so it may not matter at all; the difference in rise/fall times depending on the capacitance would suggest that. It's hard to say though and I can't find any documentation to support this memory at the moment.

@warasilapm
Copy link
Author

As a final note, it looks like the slow speed is the only meaningful one of note:
image

Spice here: mos_gpio_speed.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: pcb requires an update to an electrical design project: mobo Lumen motherboard type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants