Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Arduino IDE works but VisualMicro does not (Read 3263 times)
557Torino
Junior Member
**
Offline


Posts: 11
Joined: Aug 30th, 2018
Arduino IDE works but VisualMicro does not
Aug 31st, 2019 at 5:48pm
Print Post  
The C++ code runs under the Arduino IDE (1.8.9), but execution appears stops on the line of code 

Udp.begin(localPort);

when the code is run under Visual Studio 2017 with the VisualMicro add on.  I have tried reloading Visual Studio and VisualMicro with no change.  Any ideas?

Code (C++)
Select All
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x10, 0xCA, 0x26 };
IPAddress lclIp(192, 168, 2, 173);
unsigned int localPort = 8889;

IPAddress rmtIp(192, 168, 2, 177);
unsigned int remotePort = 8888;

char message[] = "Yippy!";
EthernetUDP Udp;//new instance of UDP

void setup() {
	Serial.begin(9600);  // start the serial port for output and Ethernet/UDP:
	Serial.println("running ArduinoTestUPDSend");
	Ethernet.begin(mac, lclIp);
	Serial.println("running ArduinoTestUPDSend1");
	Udp.begin(localPort);
	Serial.print("My IP address: ");//make sure the IP address is correct
	Serial.println(Ethernet.localIP());
}

// the loop function runs over and over again forever
void loop() {
	for (int i = 0; i < sizeof(message); i++)//print message to make sure its correct
	{
		Serial.print(message[i]);
	}
	Serial.println("\r");
	Udp.beginPacket(rmtIp, remotePort);//start packet
	Udp.write(message);//sending message
	Udp.endPacket();//Close packet
	delay(100);
} 

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino IDE works but VisualMicro does not
Reply #1 - Aug 31st, 2019 at 6:12pm
Print Post  
Please follow the guide in the yellow box above so we can see your config. 

Thanks
  
Back to top
WWW  
IP Logged
 
557Torino
Junior Member
**
Offline


Posts: 11
Joined: Aug 30th, 2018
Re: Arduino IDE works but VisualMicro does not
Reply #2 - Sep 1st, 2019 at 2:18pm
Print Post  
See attached for the ouput from Micro Build.  I tried attaching the output from Micro build.  That file just produces a blank page when I click on it from my post.  I will reattach it again.
« Last Edit: Sep 2nd, 2019 at 2:30am by 557Torino »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino IDE works but VisualMicro does not
Reply #3 - Sep 2nd, 2019 at 10:34am
Print Post  
The file you emailed shows compile and upload OK

What is the problem you believe you are having?
« Last Edit: Sep 2nd, 2019 at 10:34am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
557Torino
Junior Member
**
Offline


Posts: 11
Joined: Aug 30th, 2018
Re: Arduino IDE works but VisualMicro does not
Reply #4 - Sep 3rd, 2019 at 3:02pm
Print Post  
When the program is compiled by visual studio the line of code:

Udp.begin(localPort);

Stops execution, i.e.  Nothing happens after that.

When the same code is compiled and executed by the Arduino IDE, it works fine and sends the message across the ethernet connection to the receiving Arduino.

I am guessing it something to do with the way Visual Studio/MicroVisual are incorporating the ethernet/SPI libraries.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino IDE works but VisualMicro does not
Reply #5 - Sep 3rd, 2019 at 3:19pm
Print Post  
Oh yes sorry you did say. Well it should be easily resolved. I would certainly switch to Release mode for any testing so we have same as arduino ide.

We can see from the build output that these two libs are being used. If you compile in arduino ide with "file>preferences>compile verbose" then you will see where it is getting the libraries it is using. 

I would also delete the following folder so that your AVR is the one installed with your arduino ide and not board manager which might be older.  Click recsan or restart the ide after making external config changes. C:/Users/miker/AppData/Local/arduino15/packages/arduino/

Code (C++)
Select All
Using library SPI version 1.0 in folder 6.21/libraries/SPI"
  Using previously compiled file: ebug\SPI\SPI.cpp.o

Using library Ethernet version 1.1.2 in folder "file:///C:/Program%20Files/Arduino/arduino-1.8.5/libraries/Ethernet"
  Using previously compiled file: ebug\Ethernet\Dhcp.cpp.o
  Using previously compiled file: ebug\Ethernet\Dns.cpp.o
  Using previously compiled file: ebug\Ethernet\Ethernet.cpp.o
  Using previously compiled file: ebug\Ethernet\EthernetClient.cpp.o
  Using previously compiled file: ebug\Ethernet\EthernetServer.cpp.o
  Using previously compiled file: ebug\Ethernet\EthernetUdp.cpp.o
  Using previously compiled file: ebug\Ethernet\utility\socket.cpp.o
  Using previously compiled file: ebug\Ethernet\utility\w5100.cpp.o 

« Last Edit: Sep 3rd, 2019 at 3:21pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
557Torino
Junior Member
**
Offline


Posts: 11
Joined: Aug 30th, 2018
Re: Arduino IDE works but VisualMicro does not
Reply #6 - Sep 3rd, 2019 at 5:37pm
Print Post  
I deleted:

C:/Users/miker/AppData/Local/arduino15/packages/arduino/

and 

changed to "release" mode from "debug"

Now the port opens, but there is no serial output at all.

I am going to reinstall both Visual Studio and Visual Micro again, in an attempt to start clean.  Any suggestions on ensuring a clean reinstallation?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino IDE works but VisualMicro does not
Reply #7 - Sep 3rd, 2019 at 5:41pm
Print Post  
Reinstall will not help in any way.

No serial normally means the baud rate on the monitor is wrong. What speed is your code using and what speed is the monitor set to?

  
Back to top
WWW  
IP Logged
 
557Torino
Junior Member
**
Offline


Posts: 11
Joined: Aug 30th, 2018
Re: Arduino IDE works but VisualMicro does not
Reply #8 - Sep 4th, 2019 at 7:27pm
Print Post  
I ran this program on my lap top and after updating the Arduino files it ran.

I have updated both VS2017 and VisualMicro on the desktop computer (several times) to no avail.  There is no serial output at all.  Changing the baud rate to 9600 did not help.  If I run it with debug on the serial connection works, since the first line of text is printed to the serial port, but the program hangs on the Upd.begin statement.  I have sent you and email with the build info from both machines.  Maybe you can figure out what is different between the two machines.

Code (C++)
Select All
// Visual Micro is in vMicro>General>Tutorial Mode
//
/*
    Name:       Arduino_Dash2.1VS.ino
    Created:	9/3/2019 10:29:00 AM
    Author:     CORE2QUAD\Mike Blankenship1
*/
//Pins 10, 50, 51 and 52 are used by the Ethernet board
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x10, 0xCA, 0x26 };
IPAddress lclIp(192, 168, 2, 172);
unsigned int localPort = 8889;
IPAddress rmtIp(192, 168, 2, 177);
unsigned int remotePort = 8888;
char message[] = "t";
EthernetUDP Udp;//new instance of UDP
void setup() {
	Serial.begin(9600);  // start the serial port for output and Ethernet/UDP:
	Serial.println("running Arduino_Dash2.1VS");
	Ethernet.begin(mac, lclIp);
	Udp.begin(localPort);
	Serial.print("My IP address: ");//make sure the IP address is correct
	Serial.println(Ethernet.localIP());
}
// the loop function runs over and over again forever
void loop() {
	if (message[0] == 'r')
	{
		message[0] = 'R';
	}
	else
	{
		message[0] = 'r';
	}
	Serial.print(message[0]);
	//for (int i = 0; i < sizeof(message); i++)//print message to make sure its correct
	//{
	//  Serial.print(message[i]);
	//}
	Serial.println("\r");
	Udp.beginPacket(rmtIp, remotePort);//start packet
	Udp.write(message);//sending message
	Udp.endPacket();//Close packet
	delay(1000);
}

 

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino IDE works but VisualMicro does not
Reply #9 - Sep 5th, 2019 at 1:39pm
Print Post  
The one that runs is using a different version of arduino. we can see this by the enternet library version. The one that runs has a final program size of 9k the one that fails is 8k

Runs OK

Code
Select All
Using library Ethernet version 2.0.0 in folder "file:///C:/Program%20Files%20(x86)/Arduino/libraries/Ethernet"
 



Fails

Code
Select All
Using library Ethernet version 1.1.2 in folder "file:///C:/Program%20Files/Arduino/arduino-1.8.5/libraries/Ethernet"
 




side note:  If the DTR on the serial monitor on or off? It should be On so that the chip reboots and setup runs when you open the serial monitor. The arduino ide has it on by default.

« Last Edit: Sep 5th, 2019 at 1:51pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
557Torino
Junior Member
**
Offline


Posts: 11
Joined: Aug 30th, 2018
Re: Arduino IDE works but VisualMicro does not
Reply #10 - Sep 7th, 2019 at 1:14pm
Print Post  
It is fixed!  Your were right, I had an older version of the Arduino IDE still installed.  Visual Micro was still pointing at the older version.
   I changed the location in Visual Studio by going to:

vMicro, General, configure Arduino IDE location(s)

and changed:


C:\Program Files\Arduino\arduino-1.8.5

to:

C:\Program Files (x86)\Arduino

  I assumed that loading new versions of all the software would take care of that(wrong).  Comparing the micro build dumps, that you made me aware of, was key in figuring out what had to be done.

  Thanks for your help and hope this helps others as well.  Visual Studio and Visual Micro are nice tools for programming the Arduino.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino IDE works but VisualMicro does not
Reply #11 - Sep 7th, 2019 at 3:47pm
Print Post  
Great, thanks for the update.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint