3.3V output on Swan r5

When I power or reset the Swan r5 board the 3.3V output pops up to 3.3V, but then almost immediately starts dropping in voltage until it eventually ends up at close to 0V. I saw in another post that there’s a capacitor sitting on the output so it seems to me that when the board powers up it charges up that capacitor and then cuts the power to it.

I noticed there is a pin labeled EN (Power - Chip Enable) so I thought I might be able to use that to enable the output. I first tried tying it to a GPIO pin and setting it high in code, but as soon as the EN pin goes high the board resets. As there was a similar topic that talked about in rush current causing a reset, I then tried to tie the EN pin to 3.3V externally so the output capacitor wouldn’t have time to discharge and hopefully avoid causing the in rush. That resulted in stable chip operation but the 3.3V output pin still discharged after the board powered up.

Am I missing something on the operation of the 3.3V output pin or is there a problem with my board?


1 Like

Hi @RetiredWizard,

The pin labeled EN is for the main power supply on the Swan. If you pull it to GND, the Swan will power down. It should not be modified from it’s original configuration.

However, there is a combination of the 3V3 regulator (PE4) and discharge (PE6) pins that need to be correctly configured in order to enable the 3V3 regulator.

Can you share with us a little more about how you’re using your Swan? Are you using the STMCubeIDE, Arduino, Circuit Python or something else?

Once I have a better understanding of your starting point, then I can better help you resolve your issue.


Hi @zfields ,

I am using the Swan board with Circuit Python. At this point I’m just running it through some testing with I2C peripherals and some PWM output to a speaker. I wanted to use the 3V3 output to power the speaker.


Hi @RetiredWizard!

Sorry for this issue. I was able to reproduce and create a fix. With that fix, 3V3 is enabled at startup and remains active with no script changes. Script changes are only needed if you want to turn off 3v3 output.

The essence of the fix is to move the initialize_discharge_pin call from board_init to reset_board, in case you’d like to make that simple change locally rather than pull the PR.

If you just want 3v3 power continually, you don’t need to add any code to the script to alter the ENABLE_3V3 pin and don’t need to worry about the next paragraph. But if you want to turn 3v3 off, then the next part may relevant.

CircuitPython will deinitialize DigitalInOut instances when they go out of scope. This resets the pin to a quiescent state, so it’s a good idea to declare the pin instances as globals and ensure the script never terminates. I had a simple script that terminated after setting up the pins to discharge, but was not seeing any result. The discharge was working, but the script executed so quickly and the hardware subsequently reset - re-enabling 3v3 - that the discharge didn’t have enough time to complete.

The PR includes test code to show how to disable and re-enable 3V3.

I hope that helps!

1 Like

Thanks again Mat!

I don’t have any current need to turn the voltage off but it’s cool that there is that option :grinning:.

I’ll probably throw the simple change in my local copy for now but will keep an eye on your PR and grab an refreshed copy when it’s available.