Due derivative without Programming Port? SAM3X Erase, Bootloader?

Hello. I am working on a board based on the Due as an educational aid. My aim is to place the same processor as on the Due (SAM3X8E), but I want to eliminate the second boot loader 16U2 processor if possible. I am skilled in hardware and have written simple software for various Arduino platforms, but I am not deeply familiar with the low level details of the various boot loaders and options. I would very much appreciate some guidance before spinning my own board.

It is my understanding that the function of the 16U2 is to simply twiddle the Reset and Erase pins of the SAM3X to cause a mass erase, then work as a USBserial to UART converter to actually load the sketch onto the SAM3X. Reading the datasheet of the SAM3X, it seems that holding the ERASE pin high for more than 220 ms will cause a mass flash erase of the SAM3X.

I am considering adding a simple external one-shot circuit to accomplish this without the need to populate the 16U2.

The following is my understanding – I am hopeful that someone knowledgeable in the low level details can tell me if this will work or if I am missing something.

  1. It is my assumption that the Arduino IDE environment, when the Due NATIVE PORT is selected as the target, that the Arduino IDE communicates directly with the bootloader inherently present in the SAM3X. It is my assumption that there is no additional or special bootloader added to the SAM3X by the Arduino IDE or prior to shipping the Due board.

  2. It is my understanding that the Due “Programming Port” (which programs via the 16U2) is just there to guarantee programming is possible if the SAM3X becomes locked up or crashed, which according to what I read on the Due page, may make the Native programming port (USB direct to the SAM3X) unresponsive.

  3. Would there be any reason not to simply populate the SAM3X (the exact same part number as used on the Due) and allow programming using the native USB port on the SAM3X, then provide a button or jumper on the board that would trigger a simple circuit to reset the SAM3X and hold the ERASE pin high for a while? This would allow a user to activate the erase function if the SAM3X becomes bricked, then the native port can be used once again to re-program from there.

  4. If I take a new, blank SAM3X of the same part number as used in the Due and populate it on the board following the Due as a reference design, then plug it into the Arduino IDE and target the Due Native port, can it be expected I can simply load any sketch that would normally work on the Due board onto this new board?

Thanks very much in advance for the help!

kjdev:
then provide a button or jumper on the board that would trigger a simple circuit to reset the SAM3X and hold the ERASE pin high for a while? This would allow a user to activate the erase function if the SAM3X becomes bricked, then the native port can be used once again to re-program from there.

One hidden gotcha is the terrible quality problems with Microsoft's USB serial driver. It handles unexpected device disconnection very poorly where a program has the COM port open and in use in certain ways. It sometimes leaves junk in the Windows Registry, which wouldn't be a big deal, except that it can also get very confused by that leftover stuff the NEXT time the device reappears. Of course, there's no good feedback of this giving to the user, which makes the delayed troubles very confusing and difficult to resolve. If they take the common tactic of trying to reinstall the driver, they add yet another layer of complexity to the problem.

The 16u2 solves all that by never disconnecting the USB. Well, at least if you leave the cable physically plugged in.

Mac and Linux work pretty well, so you can probably disregard this particular issue if you're never going to use Windows.

It also might not be a big deal if you do fairly benign things that don't necessitate a hard reset while the USB is in use. At the very least, you might try to advise users to close the Arduino Serial Monitor or any program accessing the native port before pressing that button!

Thank you Paul that is good to know. I assume users would occasionally run into this. They would be using it primarily to load new sketches, but I'm sure many would also use the virtual serial port to monitor and/or debug. There's no reason however that I'd expect the device to hard reset during operation, except as needed when loading a new sketch. In this case, the user wouldn't un-plug and re-plug the USB cable (I wouldn't expect anyway).

Does that still sound like a serious problem, or are you referring primarily to the situation where the user has the virtual serial port in operation and the SAM3X is suddenly reset?

I've never personally experienced this, and I've been using the Due with Windows 7 for a while now, but I also do not use the virtual serial port much. Interesting side note that getting my Windows 7 machine and the Arduino IDE to play nicely with the 16U2 was a real hassle. It was happy to work with the native USB port on the SAM3X right away though. I found other posts here on the forum about the same problems I was having.

Thank you again for the guidance on this.

Anyone else have any thoughts? Can anyone confirm that the Arduino IDE should work right out of the box with a blank SAM3X chip connecting to the native USB port?

Take a look at this thread, it may answer your question:
http://forum.arduino.cc/index.php?topic=128913.msg970621#msg970621

@kjdev - Assuming you already own an Arduino Due, why don't you just try using it for a while, maybe do some "bad" things with code (like disable interrupts, try initializing pointers to random 32 bit address and writing zeros, etc). Just keep your USB cable on that native port and pretend the programming port doesn't exist.

If you don't already own an Arduino Due for testing, consider buying one and actually using it this way. You'll very likely learn some things along the way that'll save you more than cost of buying just one Due.