Hello,
This is a communications issue resulting from an incorrect port speed.
No it's not! It is an issue, that you try to communicate with the wrong device!
As soon, as the DigiX is running with an Arduino-Sketch, there is not SAM-BA daemon running, which is needed for bossac to talk with.
That is the standard behavior of the DigiX, DUE and all other ATMEL ARM based devices, when connecting the RAW port.
As soon, as an Arduino sketch is running, the device is known with VID/PID 2341/003E as an Arduino DUE connected to the native port.
In that state, there is no SAM-BA running, so the bossac can't talk with it.
Do an "lsusb" on the command-line and you will see.
So you have to force the digiX to switch to the SAM-BA bootloader. That can be done by pressing ERASE, which will delete the GPNVM-bit 1 (besides the whole flash), and than RESET. Because GPNVM bit 1 is now "0", SAM-BA is booting up and bossac can talk with the chip!
Opening and closing the virtual-USB-COM-port with 1200 baud will do the same by deleting the flash and resetting the CPU. That happens in
./hardware/arduino/sam/cores/arduino/USB/CDC.cpp:
if (CDC_SET_CONTROL_LINE_STATE == r)
{
_usbLineInfo.lineState = setup.wValueL;
// auto-reset into the bootloader is triggered when the port, already
// open at 1200 bps, is closed.
if (1200 == _usbLineInfo.dwDTERate)
{
// We check DTR state to determine if host port is open (bit 0 of lineState).
if ((_usbLineInfo.lineState & 0x01) == 0)
initiateReset(250);
else
cancelReset();
}
return true;
}
}
return false;
}
However it happens only, when your program has not crashed. When the device is back with running SAM-BA you see in lsusb the VID/PID: 03EB/6124, which shows the CORE Atmel device.
So each IDE has to make sure, that the triggering-event (opeing/closing with 1200 baud) takes place. If that cannot take place, because the program on the DigiX stucks, you have to do that manually!
I have added a description into the WIKI:
http://digistump.com/wiki/digix/tutorials/programmingThe key in investigating communication problems with the DigiX is, to figure out, if it is currently an Atmel SAM-BA device, or if it is an Arduino!
As it changes the VID/PID it appears for the operating system, like unplugging device A and plugging DEVICE B to the same port!
So there is also no need, to set the tty back to higher speed after uploading. After uploading the bossac tool triggers an reset, which will bring back the device in Arduino-Mode as an new device for linux.
The serial monitor (or any other terminal program) will configure the device usually themself.
You can watch this happen, when you start a
"udevadm monitor" as root in another terminal, while programming the DigiX!