Possible D7 issue on P2

I have a design that has worked with an Argon for over a year. I converted it by changing ports to work with a P2. I had an issue after building it of intermittent no boot of the P2 when power was applied. I am using an AC to DC 5 volt converter the same as on the Argon build. The P2 will show a solid red led most of the time when it fails to boot. I traced the problem to a solid state relay I have D7 connected to. When not connected it boots all the time. I then moved the relay to D10 and reconfigured to run on D10 and it works fine. The circuit board the P2 is connected to I made with a CNC router and I verified before cutting the trace and moving to D10 that the trace looked clean. Coincidently I used D7 on the Argon and had it connected to the same relay with no issues. Has there been any discussion of using D7 for certain types of equipment? Below is a picture of the board with AC to DC converter and the solid state relay.

Yes, D7 behaves differently on the P2 and Photon 2 because it's shared with SWD (SWDIO). This was also the case on Gen 2 (STM32, Photon) but is not the case on Gen 3 (nRF52, Argon). Care needs to be taken because this pin is pulled low at boot with a software pull-down.

Additionally, on the RTL872x, D7 is a boot mode pin. If this is held low at boot, the MCU will enter MCU test mode, which is I think what is happening to you.


Thanks for the response. I have quite a few Photons but must not have configured them in the same way.

The difference is that the Photon has the SWD issue, but if you have a device connected that's active high, you're fine.

With the P2/Photon 2, in addition to being a SWD pin, it's also a boot mode pin. That's specific to the RTL872x and I think what is causing your issue. TX is also a boot mode pin that can cause issues if grounded at boot. And it doesn't need to be push-pull driven; a pull-down with a small enough resistance can also cause issues.

Thanks for the info on the TX pin also. I need to be more cautious when designating pins from now on.

@rickkas7 I have some further questions on the photon 2 and boot mode. The link states be cautious using as inputs. If the port is set for input/pullup will that still be an issue needing an external resister? Also I am using D6 as an output feeding a 1k resister to an NPN transistor. Set as an output is that an issue or do I still need to be sure it is high on bootup? I am still having serious problems with the Photon 2 running identical code as the argon and want to make sure I have this portion correct before going further with it. Thanks for your help.

The boot mode pin caution applies to D7 and TX. If you pull these pins down while the device is booting, the MCU will go into an alternate mode (D7 is MCU test mode and TX is ISP download) and won't boot Device OS or your firmware. You can tell because the status LED doesn't come on.

If you are using say D7 as an input from an external processor running asynchronously from the Photon 2, and the output happened to go low at boot, this could trigger the alternate mode, which is why the migration guide says to be careful when using as an input.

The pinMode will not help with this because boot mode occurs before Device OS boots, which is also before your code runs. You really have to drive the boot mode pins to GND, however. If they are unconnected boot mode won't be entered, so as long as your external circuit does not pull the pin to ground it should not enter boot mode, and when your code runs it could enable the internal pull-up.

1 Like

Thanks very much for your reply. This will help.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.