Author Topic: Moteino M0 Serial USB output not working anymore [SOLVED]  (Read 1688 times)

dherndon@shornetcom.com

  • NewMember
  • *
  • Posts: 6
Moteino M0 Serial USB output not working anymore [SOLVED]
« on: March 21, 2020, 06:46:17 PM »
I have six Moteino MO boards configured with RFM95 and have been loading sketches and running the system for several months until last week when I tried to load a new sketch onto a board and when I finally got it to accept the sketch it would not print anything out on the Serial Monitor or a separate terminal program called Tera Term.
I then tried uploading the sketch to another board that was working fine and the same thing happened.  The other four boards are still running the original sketch where they all communicate with each other through the RFM95 and do a Serial.print to the serial monitor where I am doing debugging. 

I have uploaded the blink sketch to the first board that quit printing to the serial monitor and the blink sketch runs.  I changed the delaying in the blink from 1 second to 5 seconds and uploaded that to make sure the program was loading and it works fine.  I then created a blank sketch where I activated serial in setup() with

  Serial.begin(115200);
  while (!Serial) ; // Wait for serial port to be available 

and put a delay and Serial.println in the loop as:

  delay(1000);
  Serial.println("Hello World");

And nothing prints out to the serial monitor.

I did update to the latest SAMD 1.5.0 release and Moteino AVR Boards release before this started.  One strange thing I did observe after the update, I had a lot of trouble getting the sketch to upload to the board as described in the first paragraph was for some reason the Board Manager had changed to Arduino Zero instead of Moteino MO.  When I changed it to Moteino MO I was able to upload the sketch, but no success with Serial.print.

I could find nothing in the forum to help.  If anyone can point out what I am doing wrong or how better to trouble shoot the issue I would appreciate the help.  I can provide more information if that helps.
« Last Edit: March 23, 2020, 06:07:06 PM by Felix »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Moteino M0 Serial USB output not working after working for months
« Reply #1 on: March 21, 2020, 08:25:11 PM »
Although other board packages might work and compile, please ONLY use the Moteino SAMD package, not something else,

With the Moteino Boards 1.5.0, Serial.print now uses the USB serial. SerialUSB.print is deprecated.
If you have any code that assigns SerialUSB to Serial, that should be removed. That was implemented in some RFM69 library examples and was removed with this release. There might be leftovers on this site with that piece of code.
Other than that there is no reason why a simple print would not print to the USB serial port.

Try an empty sketch:

Code: [Select]
void setup() {
Serial.begin(1);
}

uint8_t count;
void loop() {
Serial.println(count++);
}

dherndon@shornetcom.com

  • NewMember
  • *
  • Posts: 6
Re: Moteino M0 Serial USB output not working after working for months
« Reply #2 on: March 21, 2020, 09:04:23 PM »
I tried the empty sketch, but it didn't print anything either.

dherndon@shornetcom.com

  • NewMember
  • *
  • Posts: 6
Re: Moteino M0 Serial USB output not working after working for months
« Reply #3 on: March 22, 2020, 09:57:54 AM »
Felix,

I have done more testing and still can't get Serial.print to output anything.  I was wondering that since after I upgraded the boards to the latest version and the IDE had switched to Arduino Zero(away from the Moteino MO) and I was trying to upload sketches to that board type not the Moteino MO could that have messed up the bootloader so that it will not handle the Serial.print.  Is there anyway to verify the bootloader or do I need to manually reload it.

I also did some testing as to how the Arduino Zero got selected and found that if I load an earlier version for each board the Arduino Zero is selected and when I go back to the latest version the Arduino Zero is selected again.  I did not expect my selection in the IDE to change so that is why I didn't see it to begin with.   I have done this twice with the same results.  Is this common or point to another issue.

Thanks for the help.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Moteino M0 Serial USB output not working after working for months
« Reply #4 on: March 22, 2020, 10:20:37 AM »
Something is probably wrong in your IDE. The bootloader Serial is not related to the Serial in your sketch.
You must install the packages as per the M0 guide here.
Then select "Moteino M0", not Arduino Zero, not something else.
Then load that sketch above, I tested it right now and it works.

I should add that you should make sure that you're looking at the right serial port for the serial stream.
Note that Serial.print will output to the USB serial port, and not the side header "Serial" which is really Serial0, as detailed in this blog.

dherndon@shornetcom.com

  • NewMember
  • *
  • Posts: 6
Re: Moteino M0 Serial USB output not working after working for months
« Reply #5 on: March 23, 2020, 08:38:50 AM »
I am using the USB serial port and not the side port serial0 or serial1.  I did try those but couldn't see any data there either.

I uninstalled the IDE deleted the folders and rebooted the computer and did a clean download and install of the IDE and reconfigured the system for the Moteino MO with all the library and board updates. 

I am still not seeing anything from Serial.println.  I modified the blink program and added  the Serial.Begin statement in setup and the Serial.println statement in the loop.  The program uploaded and the led is blinking according to the delay, so the program is running.  When I select the serial monitor in the IDE it gives the following error:

"Error opening serial port 'COM14'. (Port busy)"

If i press reset it gives me the same error and if I do a reboot (two presses) followed by a reset the blink program starts again, but I get the same error as above.

The other four Moteino MO boards still activate and run as they did with the sketch loaded about six weeks ago.  Out of precaution I have not tried to upload any new sketches to them since the last two I have been trying to upload new sketches in the last two weeks have become none responding.

Any trouble shooting suggestions would be appreciated.

 

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Moteino M0 Serial USB output not working after working for months
« Reply #6 on: March 23, 2020, 09:47:55 AM »
First step is to make sure that is indeed the serial port emulated by the Moteino M0 (COM14?).
You can see which one it is by plugging/unplugging it in Device Manager or in the IDE serial ports menu.

Port busy means something else is accessing that port. Of course in that case you cannot even open it, let alone see any output from it.

dherndon@shornetcom.com

  • NewMember
  • *
  • Posts: 6
Re: Moteino M0 Serial USB output not working after working for months
« Reply #7 on: March 23, 2020, 10:17:00 AM »
Yes it is the port for the Moteino MO which I verified both in the IDE and device manager by unplugging and then plugging it back in.

It appears that something on the Moteino MO has the port locked up after the sketch is uploaded.  The blink program is continuing to run but the port is locked.  I still keep coming back to the bootloader, is there anyway it could lock up the port.

Thanks for the suggestions

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Moteino M0 Serial USB output not working after working for months
« Reply #8 on: March 23, 2020, 02:58:52 PM »
I still keep coming back to the bootloader, is there anyway it could lock up the port.
What is the reasoning behind that thought?
The BL is a completely different program than the main firmware running in the M0 memory. It enumerates a new/different USB CDC than the one in the bootloader.
The fact that you report that port is busy makes me think something on your PC is doing things it should not.

It could be that you may have to remove any old instances in DeviceManager to MoteinoM0, and let it re-enumerate.
But this should not happen when you haven't changed to new MoteinoM0's which enumerate a little different, and have some new PIDs.

dherndon@shornetcom.com

  • NewMember
  • *
  • Posts: 6
Re: Moteino M0 Serial USB output not working after working for months
« Reply #9 on: March 23, 2020, 03:58:10 PM »
Felix

Success!!!

When you pointed out that the bootloader and sketch in memory used different ports I went to device manager and selected "Show hidden devices" and 10's of com ports popup saying they were in use.  I uninstalled all of them and attached the MO to the computer and now have the sketch uploaded and running where I can monitor it on the serial monitor.

Thanks for your patience and help in getting to the problem.

Now my system is working fully.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Moteino M0 Serial USB output not working after working for months
« Reply #10 on: March 23, 2020, 06:06:35 PM »
Great, good it wasn't the leprechauns!

BTW Windows has a limit of (256?) serial ports that it can enumerate. With every new serial device a new COM port is assigned.
I go through them quickly and I have a habit of deleting the unused ones every now and then so they can start from a low number.
I noticed that sometimes with the UF2 bootloader (not your case but worth noting) the UF2 MSC does not enumerate but shows as UNKNOWN DEVICE and requires to be deleted and the device unplugged/replugged to enumerate correctly. At the moment I am not sure why

But at least this problem is SOLVED.