Ethernet / UDP Problems

Have been spending a bit of time on the bench trying to get a connection over UDP rather than serial, but having some snags wondering if anyone can shine some light, I know the UDP can be a bit tricky, but would be great to get it working!

So have got a ECN28J60 Hooked up, ethernet cable connected and link lights come on, and have set:

#define EtherNet 1

But cant see to get it to work, not sure if the board is actually running though / think it might be crashing once code is loaded as get a few errors after it compiles which I will post below…

/Users/darrenjlobb/Desktop/AgOpenGPS-master/ArduinoCode/AutosteerPCBv2/AutosteerPCBv2.ino: In function ‘void setup()’:
/Users/darrenjlobb/Desktop/AgOpenGPS-master/ArduinoCode/AutosteerPCBv2/AutosteerPCBv2.ino:254:33: warning: invalid conversion from ‘void ()(uint16_t, uint8_t, uint16_t, byte*, uint16_t) {aka void ()(unsigned int, unsigned char, unsigned int, unsigned char*, unsigned int)}’ to ‘UdpServerCallback {aka void ()(unsigned int, unsigned char, unsigned int, const char*, unsigned int)}’ [-fpermissive]
ether.udpServerListenOnPort(&udpSteerRecv, 8888);
^~~~~~~~~~~~~
In file included from /Users/darrenjlobb/Desktop/AgOpenGPS-master/ArduinoCode/AutosteerPCBv2/AutosteerPCBv2.ino:86:0:
sketch/EtherCard_AOG.h:489:17: note: initializing argument 1 of ‘static void EtherCard::udpServerListenOnPort(UdpServerCallback, uint16_t)’
static void udpServerListenOnPort(UdpServerCallback callback, uint16_t port);
^~~~~~~~~~~~~~~~~~~~~
/Users/darrenjlobb/Desktop/AgOpenGPS-master/ArduinoCode/AutosteerPCBv2/AutosteerPCBv2.ino: In function ‘void loop()’:
/Users/darrenjlobb/Desktop/AgOpenGPS-master/ArduinoCode/AutosteerPCBv2/AutosteerPCBv2.ino:484:83: warning: invalid conversion from ‘byte* {aka unsigned char*}’ to ‘const char*’ [-fpermissive]
ether.sendUdp(toSend, sizeof(toSend), portMy, ipDestination, portDestination);
^
In file included from /Users/darrenjlobb/Desktop/AgOpenGPS-master/ArduinoCode/AutosteerPCBv2/AutosteerPCBv2.ino:86:0:
sketch/EtherCard_AOG.h:445:17: note: initializing argument 1 of ‘static void EtherCard::sendUdp(const char*, uint8_t, uint16_t, const uint8_t*, uint16_t)’
static void sendUdp (const char *data, uint8_t len, uint16_t sport,

Have i missed something / made a silly fail? Using latest download from Github.

As an update,

I have got the UDP communication working now on the bench, turned on ICMP so i could diagnose a bit easier until I got a ping, and have now proven its working in simulator turning the work switch on and off.

For anyone else having a similer problem, turned out to be something very silly, I had my ethernet card connected to an external PSU as found the nano wasn’t able to provide enough power (no link lights etc was giving that away). But had stupidly forgotten to link the GND’s together, so they were isolated, soon as I hooked that up, it instantly started responding to pings and AOG was talking to it!

So back to the errors, should I be concerned? Or are they normal?

1 Like

Not really sure, not a lot to go on for troubleshooting online :frowning: Do know the code does work though, been using for 2 years as have others

Are all devices on the same subnet? In the arduino settings for the ip addresses, do they match your router? 192.168.1.1 etc.

Sorry Brian should have been more clear, Have got everything working great now, its just when I compile I get those errors in the arduino log? It still uploads, and agopengps connects to it just fine over UDP / all working great.

Just wondered if others get those same few compile errors / warnings or if theres something I can change to prevent it.

Can you post a pic of the errors?

Sure, should be attached:

Screenshot 2020-01-06 at 18.45.54

May you scroll up to the first errors? Thx

That is all the errors from the top…

I compiled even in verbose, no such errors at all.

I wonder if it would be worth posting on the arduino forum and asking that huge resource. It seems the casting is messed up - it really should know what a uint8_t is!

well, now I got the same error, but I can’t even compile. I tried in in Win and Ubuntu. No success… Guys, who else had the same troubles? Did you resolve it?

ethernet_not_compiling

error text:
Arduino: 1.6.7 (Windows 7), Ïëàòà:“Arduino/Genuino Uno”

D:\AgOpenGPS-master\Ethernet\AgOpenGPS-master\ArduinoCode\AutosteerPCBv2_ETH\Relays.ino: In function ‘void setup()’:

Relays:254: error: invalid conversion from ‘void ()(uint16_t, uint8_t, uint16_t, byte*, uint16_t) {aka void ()(unsigned int, unsigned char, unsigned int, unsigned char*, unsigned int)}’ to ‘UdpServerCallback {aka void ()(unsigned int, unsigned char, unsigned int, const char*, unsigned int)}’ [-fpermissive]

In file included from D:\AgOpenGPS-master\Ethernet\AgOpenGPS-master\ArduinoCode\AutosteerPCBv2_ETH\AutosteerPCBv2_ETH.ino:86:0:

EtherCard_AOG.h:489: error: initializing argument 1 of ‘static void EtherCard::udpServerListenOnPort(UdpServerCallback, uint16_t)’ [-fpermissive]

 static void udpServerListenOnPort(UdpServerCallback callback, uint16_t port);

             ^

D:\AgOpenGPS-master\Ethernet\AgOpenGPS-master\ArduinoCode\AutosteerPCBv2_ETH\Relays.ino: In function ‘void loop()’:

Relays:484: error: invalid conversion from ‘byte* {aka unsigned char*}’ to ‘const char*’ [-fpermissive]

In file included from D:\AgOpenGPS-master\Ethernet\AgOpenGPS-master\ArduinoCode\AutosteerPCBv2_ETH\AutosteerPCBv2_ETH.ino:86:0:

EtherCard_AOG.h:445: error: initializing argument 1 of ‘static void EtherCard::sendUdp(const char*, uint8_t, uint16_t, const uint8_t*, uint16_t)’ [-fpermissive]

 static void sendUdp (const char *data, uint8_t len, uint16_t sport,

             ^

exit status 1
invalid conversion from ‘void ()(uint16_t, uint8_t, uint16_t, byte*, uint16_t) {aka void ()(unsigned int, unsigned char, unsigned int, unsigned char*, unsigned int)}’ to ‘UdpServerCallback {aka void ()(unsigned int, unsigned char, unsigned int, const char*, unsigned int)}’ [-fpermissive]

Could it be a version issue? I see you use ver 1.6.7 of arduino.
Maybe try to compile on the internet version, if you don´t want to update the one on your computer.

yes, you are right. I updated the ver to 1.8.10. It began to compile, but now they are just the red warnings, not error. Still I am afraid that there is some trouble with parameter conversion.

Compiles fine on this end, no errors. Also using 1.8.10, is it a language/localization thing?

actually, I didn’t change anything related to localization. UNO was loaded through official web. Don’t know. Will try to solve it myself…

Are you choosing nano as your board?

I know I was…

I seems to be language:
The following tests (Verify/Compile) is done without any board attached to com port.
First I compiled without changing anything, and I got the same faults as above.
Then I changed settings (Editor language from standard to English (as seen on prt scr), and the only warning I get now are a long Archiving message.
That warning did not appear next time I compiled. (The archive is already made)
image

Edit: As I don´t recall changing that setting before, I tried to set language to Danish instead of the standard that probably was there automatically, and now it compiles also without faults and with Danish help texts (there were also Danish help texts at first with the standard setting)

I have had problems with “knock off” Nano boards recently. As this problem never occurs with officially branded Arduino boards. I was constantly receiving compiler errors in the IDE. This remedied my compiler issues.
If using knock off nano board use the Atmega328P (Old Bootloader)
If using a Arduino Nano board use the regular Atmega328P
Maybe it will help you.
bootloader2

Hi,
For connecting the Autosteer Nano to the PC (Microsoft Surface), I’ve put an ESP8266 (Serial Wifi Board) programmed as a bidirectionnal serial to UDP bridge and connected to A0 A1 of the Nano, I’ve used NeoSWSerial (emulated port)
So the “standard” port of the Nano remains for programming/debug the Arduino code.
Just to program the right IP and ports in the ESP and it works at 38400 bauds without any problem.
So far so good
francois

2 Likes

Very interesting. You could also connect gps to the ESP and everything could go from one place. :thinking: