I'm using visual micro for visual studio, and I understand this kind of thing is caused by conflicting serial data when I try to read and print to the main serial at the same time, right?

Well, I need to read serial data from the main serial on my Mega 2560, and then I need to see it on my LCD screen, which is controlled by the board via SPI. I know I can use those two at the same time because I'm doing it with my transmitting arduino and I can see that it's transmitting correctly.

When I try to view my serial data in the serial port, I get nothing but a stream of these error codes, or whatever they are. They generally look like this: VMDPE_1|1_VMDPE. Usually there are some numbers in there too, like: MDPE_1|2571143_VMDPE. I sort of expected that, since you can't read and write at the same time on one serial. But that would be fine, because my project is not going to be plugged into a PC anyway.

So of course I try to pipe my data directly to the LCD screen so I can plug my recieving arduino into external power and not have to see the error messages, which I thought were coming from the debugger of my compiler. Here's my code:

//on the receiver side

#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>

char incoming[3];

void setup() {
    //TFT_BL_ON;      // turn on the background light
    //Tft.TFTinit();  // init TFT library
    //TFT_BL_ON;      // turn on the background light
    //Tft.drawString("INCOMING:", 20, 301, 3, RED);


void loop() {

    if (Serial.available()) {

        Serial.readBytesUntil(',', incoming, 3 ) ;

        //Tft.fillRectangle(64, 236, 45, 165, BLACK);

        //Tft.drawString(incoming, 65, 235, 4, WHITE);


But nope! I get the same error codes on my LCD screen! Even worse, now they seem to have screwed up my zigbee module! I took it off the board, plugged it into my computer, and now the XCTU utility is reading all sorts of messed up values that are total nonsense. Somehow, this seems to have overwritten the zigbee's actual SERIAL NUMBERS!!! What are they now? Take a guess!

Serial number high: E_1|2571092_VMDPE

Serial number low: MDPE_1|2571143_VMDPE

3 Answers 3


Your incoming buffer is not big enough to handle the data that you're giving it. Cutting away the comments from your code:

char incoming[3];

This declares a buffer for two characters, allowing for the (required) 0 on the end. println() needs to know when to stop printing characters: it does this when it sees a NUL (0) character.

Serial.readBytesUntil(',', incoming, 3 ) ;

You're passing in that you want to read 3 characters - but that completely fills incoming, leaving no room for the trailing NUL (0).


This then prints the first character, the second character, the third character... then the 4th, 5th, 6th, 7th etc. in memory until it finally reaches a NUL and then quits.

What you call "debug messages" are actually printed gibberish in memory... To fix it, you need to make incoming larger.

Also, it's a good idea when using buffers like this to use the sizeof() function, as follows:

Serial.readBytesUntil(',', incoming, sizeof(incoming)-1 ) ; // Note the -1!
  • 1
    Thanks!I see what you mean about the buffer overflow.Last night I loaded both my arduinos using "start without debugging", and the output changed to something more like numbers, bit also gibberish. I do believe the "VMDPE_1|1_VMDPE" stuff is some kind of VisualMicro-specific error related to debugging.I have a big sketch, and it prints on the serial every time I flash the board. I read about it here: visualmicro.com/forums/YaBB.pl?num=1365950696/0 I still have no idea how it got into my sketch while not hooked up to PC, or how it invaded my Zigbee! Jul 22, 2016 at 17:55
  • "I still have no idea how it got into my sketch while not hooked up to PC" Because Visual Micro's debugging works by adding a bunch of hidden serial prints to your sketch. Once you upload the sketch to your board they will be in the flash whether it's connected to your PC or not.
    – per1234
    Dec 20, 2016 at 3:08

I have seen the same messages, using VS2017 and Arduino Unu and Visual Micro. Messages start with "DPV..." or "VMDPV...".

The solution is to upload the sketch to the Arduino using Release mode. Then the hidden debug serial prints that Visual Micro seems to put in are gone. enter image description here

  • This might hide the unwanted output, but it is not a solution the the question. Aug 31, 2020 at 6:20

I had the same problem. The problem seems to come from AVR Studio serial debugging. If you turn off the serial debugger the problem will go away. Remember to also turn of "Automatic Software Debugging (Release/Debug)", as shown below. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.