Author Topic: No Serial.println output using Moteino M0 and Arduino IDE 1.8.5  (Read 2483 times)

gbsmith

  • NewMember
  • *
  • Posts: 7
I am not getting any print statements using this simple code:

int val = 0;

void setup() {
  Serial.begin(9600);
  delay(100);
}

void loop() {
  Serial.println("Start of Loop");
  delay(1000);
  Serial.println(val);
  delay(1000);
  val = val + 1;
}


I am using the Moteino SAMD Boards 1.1.0


I am trying to get a MySensors Node working using the Moteino M0.
I got some string messages in the serial monitor from Mysensor.h but none
from Serial.println ?

Tirititelu

  • NewMember
  • *
  • Posts: 9
Re: No Serial.println output using Moteino M0 and Arduino IDE 1.8.5
« Reply #1 on: August 02, 2018, 03:28:00 AM »
Yo need use SerialUSB.println().

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: No Serial.println output using Moteino M0 and Arduino IDE 1.8.5
« Reply #2 on: August 02, 2018, 10:57:05 AM »
There are several serial devices on Moteino M0. Look at the guide page to see where each one is assigned: https://lowpowerlab.com/guide/moteino/moteinom0/
For USB, you need to initialize and use SerialUSB (instead of Serial whch is actually going to be on pins 30,31).

gbsmith

  • NewMember
  • *
  • Posts: 7
Re: No Serial.println output using Moteino M0 and Arduino IDE 1.8.5
« Reply #3 on: August 02, 2018, 08:00:54 PM »
Thanks All.
SerialUSB.println works.
This is the first time to work with a device with more than one serial port.
I wonder why Serial doesn't default to the USB port to be compatible with older devices.

Uncle Buzz

  • Full Member
  • ***
  • Posts: 146
  • Country: fr
Re: No Serial.println output using Moteino M0 and Arduino IDE 1.8.5
« Reply #4 on: August 03, 2018, 03:44:14 AM »
I wonder why Serial doesn't default to the USB port to be compatible with older devices.
Serial on USB is a virtual COM port, to communicate with a PC on USB, but serial is not only for PC communication, so those who use serial to communicate with other things than a PC will ask same question, why the default serial is not the native serial to be compatible with older devices ? Different points of view... Even on ATMega1284p, there are more than 1 serial port.
Maybe 2 bootloader could be proposed, one with native serial, and another one with USB serial, so each one could choose its bootloader to keep sketch compatible with his intends.
Or maybe Felix could publy his bootloader on github so everyone could make their own modifications without asking some more works ans support from Felix ?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: No Serial.println output using Moteino M0 and Arduino IDE 1.8.5
« Reply #5 on: August 03, 2018, 09:57:43 AM »
Two bootloaders would make little to no sense IMO, rather one that supports 2 protocols.
In fact the current bootloader is based on the generic SAM-BA bootloader for SAMD21 devices. It supports both USB and serial protocols. Either way you have to put the board in bootloader mode or nothing happens.

The USB is there to make life easy, why bother with serial which is slower and requires additional components?

I would propose not to get stuck into naming convention debates, SerialUSB is very specific IMO and it aligns with the Arduino M0 standard. When there are multiple serials, they start to be named after this convention: SerialUSB, Serial, Serial1, Serial2 .... You can look in the definitions of the M0 package to see how Arduino did it. You could actually rename it and switch Serial with SerialUSB if that's what you really wanted, but I prefer to stick to a convention that will likely produce less stress to those switching between boards based on SAMD21 where 1 name can mean multiple different peripherals, would be a very confusing world.