Arduino DUE erase button and power switching (EE question)

Hi all,

I am reposting a post from last year that I think is important for users to get an answer for. I personally have also been very curious about this (for a CubeSat PCB I’m making derived from the ATSAM3X8E) and hope there is someone out there that understands the use of an op-amp and P-channel transistor for the circuitry in these two concepts. Here is the post:

In the DUE schematics, there are two things that I do not understand. First is the working principle of erase button (see: erase_button.png). I have my own idea how does it work, but would like to clarify the working principle from someone that know exactly what is the purpose of all the elements that are connected to erase button. Second thing is switching of power supply between external power and both usbs (see: usb_switch.png). Again, would someone please just briefly describe working principle? Here I really do not understand why is there op amp added?

Thank you for your time!

erase_button.png

My understanding of these circuitries:

The purpose of the Erase circuitry:
A full Erase of Flash Memory (All memory cells are filled with 0xFF) is compulsory before any upload of a new sketch. An Erase can be performed either manually or automatically when the baud rate is set to 1200 bauds.

BTW, a fix to do (reply 2):

The purpose of the USB circuitry:
When Sam3x acts as a USB Host towards a USB Device (e.g. a keyboard): Up to the end of the enumeration process, the Host is supposed to provide 100 mA on the bus to a USB Device, and 500 mA maximum after the negotiation process, except when the Device is self-powered.

When Sam3x acts as a USB Device towards a USB Host (e.g. a PC): Unless the board is powered (e.g. by a battery pack thru the jack, in such case the DUE is a self-powered USB Device), the DUE is powered by the USB Host and can receive up to 100 mA during the enumeration process and 500 mA after the negotiation process. When self-powered, a DUE will not receive its current via the USB cable.

Since this USB peripheral has also the OTG feature (On The Go), Sam3x can start as a USB Device and later on ask its distant USB Host to reverse their roles for a while from Host to Device and vice versa. In such case, if Sam3x started as a USB Device, it will become a USB Host for a while but will not provide current on the bus. The first USB Host on the bus will remain the current provider.