My Arduino code only runs when launch it from the Arduino IDE. How can I make it run every time the board it powered up, without having to launch it from the IDE each time?
It should start the latest compiled and uploaded version after each reboot:http://www.udoo.org/docs-neo/Arduino_M4_Processor/Overview.html From where do you start the Arduino IDE? on the Neo itself or on an external PC?
I can't find the thread so quickly, but I thought there was some issue that the m4-file doesn't get synced to the sd card if you power down the Neo too quickly. Normally the Neo starts the last 'Arduino' program on startup. It should be in /var/opt/m4, and is called m4last.fw.
I am launching the sketch from an external PC. I'm pretty sure my board used to run the sketch automatically each boot, but it's not doing it now. Is it possible that something in my sketch could be causing the issue?
Are you using a genuine Arduino or are you using a "compatible" device? Sent from my iPhone using Tapatalk
@knick, today (17-Nov) UDOO has released a new UDOObuntu. I haven't checked the release notes, but if it is indeed the sync problem I assume that that is included as it has been known for a few weeks. If you think it might be something in your program, you could also remove the m4last.fw file, upload the file again and reboot. If the problem persists but the m4last.fw file is still there I would assume that indeed it is your program. Then fallback to a simple blink of pin 13 (builtin led), and retry.
I am using an Udoo Neo programmed from a PC. Setup is as described in the 'getting started' section of the docs.
Try it with the blink led example sketch first so you are sure it is not your sketch that is the problem.
I just tried running a simple "hello world" sketch. It still doesn't run automatically on power-up. I'll try updating the OS later.
You have to wait 1 minute between upload sketch and reboot, else the m4last.fw file will be empty after reboot by the reset button. It is a SD card protection mechanism from Linux. If you update the OS you can reboot directly after uploading.
Ok, I have a couple of questions. 1) If your sketch uses the serial port to log data to a 'terminal', should the data continue to be logged (when restarting the terminal after restarting the NEO)? If so, it doesn't for me; I have to reload my sketch. 2) What OS update is being referenced in the reply above?
UDOObuntu 2.1.1 solves an issue where the M4 program file isn't synced to the SDD storage right away.
If you write to Serial (/dev/ttyMCC) and use println you have to read the data on Linux side. Else it will time out and later the relative small buffer of 1 MB will be filled. Best is to have the arduino sketch wait with sending until on the Linux side your reading application is ready. See for example my iot gateway example http://www.udoo.org/forum/threads/how-to-make-udoo-neo-an-iot-gateway-of-sensors.6103/
I was having the same issue when writing to the hardware serial port (Serial0). It worked ok after programming from the Arduino IDE, but nothing would get written to the serial port after a reboot. I found that adding a 2 second delay at the top of the begin() function resolved the issue.
Waiting 2 seconds is of course the least secure way to check if the serial connection is available. What if you do While (Serial0.available > 0) { Serial0.println(your_string); } This should check first if serial0 is available before writing
Correct me if I'm wrong, but isn't the serial.available() method for checking if there is any data sitting in the receive buffer? In my case the data flow is just one way. The M4 is writing debug information out to the serial port (transmit), but isn't expecting to get anything back (receive). So Serial0.available() should always return 0?