Accessing Serial with Python for Arduino Due

I am having trouble accessing the serial port on my Windows System using Python and the Pyserial library. I am using an Arduino Due. It is working to upload sketches via COM3 from Windows, but the code I am using below in Python is resulting in an error. Sometimes this is a daemon / thread-related error:

raise RuntimeError("cannot set daemon status of active thread"

Can anyone provide sample code or advice on how to connect to an Arduino Due via USB / Serial using Python on a Windows system?

The reason that code is causing an error is because that is code that raises an error.

Please read the stickies at the top of this forum and try asking again.

OK, thank you. I am using Pywin to debug while I upgrade to Eclipse with PyDev. The debugger gets stuck at that point, but the problem is hit when trying to access the serial port, 'COM3'.

import time
import serial
import threading

#port = serial.Serial('/dev/ttyS1', 115200)
port = serial.Serial('COM3', 115200)

The last line is triggering an error.

When I open BOSSA and try to access COM3 it cannot see the device, giving an error 'device not accessible via COM3'.

WTF is "BOSSA"? All I can find is a textile manufacturing company in Turkey.

Does COM3 actually exist? Is the Arduino really on COM3?

Can you upload a simple serial-based sketch, like the ASCII Table example, and use the serial monitor in the Arduino IDE to display the results, all on COM3?

The Arduino Due requires a derivative of BOSSA called Bossac to communicate via serial. That's why the most recent versions of the Arduino IDE are required to run this.

Yes, COM3 exists and can be used to upload a simple serial-based sketch, as I mentioned.

Can you upload a simple serial-based sketch, like the ASCII Table example, and use the serial monitor in the Arduino IDE to display the results, all on COM3?

Yes.

(BOSSA | shumatech.com)

The due does not use com3 for any of its usb port.

PS this forum is for questions about c written to run on arduinos and not about code written to run on PC's that has its own form here as does the due.

Mark

Ahh, bossac - why didn't you say bossac then?

Find the right COM port and you'll start to get a clue as to why it's not working. My guess is the com port may be COM13 not COM3 ...?