I hope this is the right section to post this.
I want my UNO to crank up the code I downloaded on power-up.
There have been several posts on this but I've found a problem.
If I leave the serial monitor open on power down the UNO can't restart with a series of error messages
java.io.IOException: jssc.SerialPortException: Port name - COM3; Method name - setEventsMask(); Exception type - Can't set mask.
at processing.app.Serial.dispose(Serial.java:166)*
at processing.app.SerialMonitor.close(SerialMonitor.java:116)*
at processing.app.AbstractMonitor.suspend(AbstractMonitor.java:90)*
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2160)*
at java.lang.Thread.run(Thread.java:748)* Caused by: jssc.SerialPortException: Port name - COM3; Method name - setEventsMask(); Exception type - Can't set mask.
at jssc.SerialPort.setEventsMask(SerialPort.java:279)*
at jssc.SerialPort.removeEventListener(SerialPort.java:1064)*
at jssc.SerialPort.closePort(SerialPort.java:1090)*
at processing.app.Serial.dispose(Serial.java:163)*
... 4 more*
Obviously it doesn't like the serial port being open.
If I close the serial monitor before powering on and open it afterwards all works fine.
Is there any way around this ?
Obviously I can't close the serial port with a serial.end during its dying gasp even if that would work.
Putting a Serial.end at the beginning of startup does nothing.
Thanks for any crumbs of wisdom.
I want my UNO to crank up the code I downloaded on power-up.
Please explain what this means in English.
What operating system?
An Uno is connected to the serial monitor via USB. How are you powering down the Uno without disconnecting USB? Disconnecting USB closes the port automatically in Windows and Mac, don’t know about *inx. How is it possible that you’re powering down an Uno and not disconnecting the USB cable?
Thank you.
The final project (if I ever get it working !) will be stand alone not connected to a PC so it's not a disaster and the workaround is simple.
I can even run the program with the serial monitor connected, close and open it again and it starts, I just wondered if I was being daft.
I'll try PuTTY though to see if it offers a more elegant solution.
Thanks again.
Quote 'Please explain what this means in English.'
English is my first language but I've only been speaking it for 72 years so I suppose I've a bit to learn.
I'm using the delightful and user-friendly Win 10.
The UNO is powered by the USB cable and I pull that out (with my hands using a left to right motion).
It seems Win10 doesn't know it should disconnect the port - but that doesn't surprise me.
Delta-G -nice thought and a fun link.
My work involves continuous contact with the Military who, as you know, are always right and tend to mumble about X and Y while keeping Z up their sleeves to spring out when I come up with my usual brilliant solution.
You are correct in both assumptions.We are done and thanks for your input.
You raised the X-Y problem and my only off-topic post was about that.
You are also correct that no-one in their right mind would let an Arduino out into the Real World but we sometimes develop code using Arduinos and then port it to PLCs.
We wouldn't trust an Arduino in a mission critical application - they're too fragile and I'm too old to go to prison.
I think the 'intended to support or sustain life' bit says it all !
There is, as I'm sure you know, an excellent US company that makes ruggedised Arduinos
(Note - not off topic here - still talking about Arduinos)
We'd really like to use them but two problems :-
No CE certification so no bits of paper to wave at the Judge when he's trying me for Corporate Manslaughter
Made in the US - excellent BUT Uncle Sam doesn't allow export to Europe because they contain Secret Things like Zener diodes which mustn't fall into the hands of the Ungodly.
have the military disclaimer on the last page, not for use without Atmel's consent:
SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any applications where the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety-Critical Applications”) without an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environments unless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specifically designated by Atmel as automotive-grade.
SteveinFrance:
Quote 'Please explain what this means in English.'
English is my first language but I've only been speaking it for 72 years so I suppose I've a bit to learn.
I'm using the delightful and user-friendly Win 10.
The UNO is powered by the USB cable and I pull that out (with my hands using a left to right motion).
It seems Win10 doesn't know it should disconnect the port - but that doesn't surprise me.
So whilst you appear to know what you mean by;
"I want my UNO to crank up the code I downloaded on power-up"
srnet:
"I want my UNO to crank up the code I downloaded on power-up"
"Crank up" is slang for "run".
The way I read that sentence...
"When my UNO powers-up, I want it to run the code I previously downloaded to it."
(I would use "uploaded" instead of "downloaded" to indicate the direction is away from the human.)
I believe @SteveinFrance originally misdiagnosed the problem: he assumed the Serial Monitor errors indicated that the Uno was not running the previously uploaded code. Instead the problem is contained entirely within Serial Monitor and the way it behaves when an Uno is disconnected from a computer.
CrossRoads,
Thank you, most interesting.
A quick skim through the pdf suggests it has ISO accreditation and various good things like brown-out detection and ESD protection on I/O pins
I'll contact Atmel to see what they say.
Is the chip available as a complete package ?
Thanks again, valuable info.
Sreve
SteveinFrance:
Is the chip available as a complete package ?
If you can tolerate an 8 MHz ±1% clock (after tuning) and USB is not a necessity the only required external components are 0.1 µF bypass capacitors across each VCC / GND pair. Other than that, apply electricity and they run.
I'm sorry we've strayed from the original topic but this has been most useful to me.
I'll read the (293 !!) manual pages tomorrow.
I haven't looked to see if there are any posts about it on the Forum but will do that too.
We can, and do, get PCBs made but ready-made board with the other bits (I can do the electricity) would be good.
23.30 here so time for a sustaining glass of Red Medicine and toddle off to bed.
Good Night to All
Steve
smet,
Coding Badly (he should have his own bar for all of us in that club) has translated perfectly.
The problem isn't in my code but the way the Arduino serial monitor behaves by not dropping serial connection (Windows) when the USB connection is disconnected.
The code is trying to connect to the serial monitor but (because it wrongly thinks it is still connected) the interface is saying 'Go Away, I'm busy'.
Interesting 'upload' vs 'download' - I assume anything coming towards me is an upload whereas anything going away is a download.
Certainly works when I go to the lavatory !