-
Notifications
You must be signed in to change notification settings - Fork 88
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
Support for high current pin configuration #21
Comments
You are right, this is quite interesting. I would rather provide an example sketch though. If you have a tested one, I'll welcome a PR! :) |
Actually, my coding skills are really basic and I have no idea how to do it. That's why I was hoping for a simple solution, like |
I may give this a try today. There are only 3 usable pins available though: Also D1 but if you connect it to something else, it may interfere with serial communication (including uploading). There are two more (E4 and E5), but these are typically left floating in the breakout boards. You could solder wires directly to the chip though. |
I just tried it, it only worked on pin D5 and D6. void setup() {
pinMode(LED_BUILTIN, OUTPUT);
pinMode(D5, OUTPUT);
pinMode(D6, OUTPUT);
digitalWrite(D5, HIGH);
digitalWrite(D6, HIGH);
/*
Port F is not defined in the lqfp32 and ssop20 cores, you need to select the lqfp48 core to use these.
(*) This may bring some incompatibilities.
(*) UPDATE: it should be OK, but make sure not to do digitalWrite(F1, HIGH) and digitalWrite(D1, LOW) (or even use Serial) as this shorts the pins internally and you may kill the board
pinMode(F1, OUTPUT); // internally connected to D1 in LQFP32 chips
pinMode(F2, OUTPUT); // internally connected to D2
pinMode(F4, OUTPUT); // internally connected to E4
pinMode(F5, OUTPUT); // internally connected to E5
digitalWrite(F1, HIGH);
digitalWrite(F2, HIGH);
digitalWrite(F4, HIGH);
digitalWrite(F5, HIGH);
*/
}
void loop() {
HDR = 0b00111111; // ENABLE high current on the 6 pins
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
HDR = 0b00000000; // DISABLE high current on the 6 pins
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
} For activating each pin individually: HDR |= 1 << 0; // Enable high current D5
HDR |= 1 << 1; // Enable high current D6
HDR |= 1 << 2; // Enable high current F1/D1
HDR |= 1 << 3; // Enable high current F2/D2
HDR |= 1 << 4; // Enable high current F4/E4
HDR |= 1 << 5; // Enable high current F5/E5 You can test it with a multimeter, it will output ~40ma(*1) in normal mode and ~140ma (*2) in high current mode. Just make sure to do it quickly to avoid risking the board (as you'll be shorting the pin). They don't die THAT fast :) (*1) using more than 12ma is unsafe Thanks for the issue, I wasn't aware of this and it may come handy :) |
I just tested it and can confirm PD5 and PD6 work correctly on LQFP32. What about PD2 tho? It works when you enable |
Yes, those pins are not exposed in the LQFP32 core.
I dug a bit deeper into the difference of both cores last night and it
should be safe to use the LQFP48 core if you need 80mA on D1 and D2. Just
make sure not to digitalWrite(F1, HIGH) and digitalWrite(D1, LOW) at the
same time or you'll be shorting the pin internally. UPDATE: also Serial uses D1 so watch out for that
David Buezas
…On Thu, Jul 16, 2020 at 7:27 PM rokweom ***@***.***> wrote:
I just tested it and can confirm PD5 and PD6 work correctly on LQFP32.
What about PD2 tho? It works when you enable pinMode(F2, OUTPUT); and digitalWrite(F2,
HIGH); and select LQFP48 as the board, but not when you select LQFP32.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#21 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAF5X3GW7BMIZXDXKKHDSP3R34Z7PANCNFSM4MZC46OA>
.
|
the 80mAh drive is spectacular to drive logic level Mosfets w/o a driver at high speed. Unfortunately the only timer that has "convenient" 80mA pins (in the QFP32) as output is timer0 (D5 and D6), which is the 8 bit timer with less modes and one looses millis() and delay(). Timer 3 can also be used (by enabling the alternate outputs to F1 and F2), but F1 and F2 are exposed as D1 and D2 which are the standard serial pins. |
According to the datasheet (page 81 in v1.0.5) some pins can be set to a a high current push-pull configuration, allowing for 80mA, instead of the standard 12/30mA. This can be done by setting a register. Any plans to add support for that? It would be useful for stuff like driving mosfets.
The text was updated successfully, but these errors were encountered: