I'm experimenting with the serial communications between the A9 and M4. I have the code below running on the M4, and on the A9 I am using minicom -D /dev/ttyMCC to monitor the serial data. In minicom I see "foo" printed once or twice and that's it. It should be displaying every 2 seconds. The M4 is getting stuck in the call to serial.println() (indicated by the state of the BLINK_PIN). Any idea what I've got wrong here? #include <SimpleTimer.h> #define SERIAL_A9 Serial #define BLINK_PIN 13 SimpleTimer send_timer; void setup() { send_timer.setInterval(2000,sendRun); SERIAL_A9.begin(115200); pinMode(BLINK_PIN, OUTPUT); delay(2000); } void loop() { send_timer.run(); } static void sendRun() { digitalWrite(BLINK_PIN, 1); SERIAL_A9.println("foo"); digitalWrite(BLINK_PIN, 0); }
Note that a Code: digitalWrite(BLINK_PIN, 1); SERIAL_A9.println("foo"); digitalWrite(BLINK_PIN, 0); will blink the led so fast that your eyes won't be able to see it.
SimpleTimer is just an arduino library for scheduling tasks. I don't think this is the source of the problem. I have simplified the code so that it now uses delays rather than SimpleTimer and the problem is still there. Here is the updated code; #define SERIAL_A9 Serial #define BLINK_PIN 13 void setup() { SERIAL_A9.begin(115200); pinMode(BLINK_PIN, OUTPUT); delay(2000); } void loop() { delay(2000); digitalWrite(BLINK_PIN, 1); SERIAL_A9.println("foo"); digitalWrite(BLINK_PIN, 0); } "foo" get printed a few times in minicom and then stops. The LED (BLINK_PIN) turns on and stays on indefinitely.
Could the issue be that I also have the udoofota-serial package installed? Will there be a conflict? The serial comms looks fine when I monitor remotely in the Arduino Serial Monitor (via the virtual com port). But when I run minicom locally that's when the serial comms falls over.
I've uninstalled the udoofota-serial package using 'sudo apt remove udoofota-serial'. But I'm still seeing the serial data in my remote Arduino Serial Console. Is there something else that I need to do to disable this?
The issue only seems to occur when using minicom. If I access the serial port through a c program it works fine.
Strange, this should work without any problems. What if you use the sketch from my IoT gateway How-To? http://www.udoo.org/forum/threads/how-to-make-udoo-neo-an-iot-gateway-of-sensors.6103/ What Udoobuntu version are you on?