Go Down

Topic: client.connect fails and returns 0. (Read 591 times) previous topic - next topic

TomMar96

Hello!

I have a problem with Ethernet connection using ENC28J60 module, while making EthernetClient.connect function it's being proccesing really long and finally returns 0. In another script using the same module and IP Adress the same function works without any difficulties.

I'm sending the script as an attachment.

Thanks for any responce.

pylon

Does that IP address always have a web server running on port 80 and did that other sketch also access port 80? It might help to post that other sketch that works.

TomMar96

Both of them are running on port 80.
I'm posting the working sketch.
Is there a possibilty that sketch content could be a reason of that problem? Because of used libraries or something?


pylon

You specify the server differently, I guess you tried the string version too, didn't you?

You have quite a lot of things on that Arduino, so it might not get enough CPU time for the ENC28j60. I would try to use an Arduino Ethernet Shield because it's WizNet5100 chip does most of the network stuff in hardware and does not need so much processor time as the ENC28j60.

TomMar96

Yes, I have tried both ways to specify the server, there wasn't any recognizable change while processing.

I'm not sure if I understood correctly that the given CPU time has been exceeded due to amount of the network stuff to be done? If so.. Is there any chance to overcome it by for example changing configuration?
Or trying to use another method for sending data?

Thank you for recommendation, but for some reasons we cannot manage to change the equipment to such expencive one cause it is being done for our Studies project.


And thanks for your response!

TomMar96

Hi again,

Problem while executing the second sketch occured now for the first time, as shown on the pictures below there is a problem with connection, but every time I trigger the sketch, it behaves differently, the process time of each loop also looks like random (those 'not connected' lasts for couple of seconds, but it's not a rule). I'm looking for the advice where to look for.. I start to explore that world. 

Thanks in advance again.

pylon

What does the server side say?

Did you sniff the traffic there to check what might have gone wrong?

Quote
Thank you for recommendation, but for some reasons we cannot manage to change the equipment to such expencive one cause it is being done for our Studies project.
A WizNet5100 module starts at about 6€ on ebay, that's not really a big investment.


TomMar96

Hi again!

I've made some research and found out that the probable reason of connection failure in the first script is the running servo which is also connected to my model (I've tried it and the script is working correctly without the servo). I've read that Servo library actually influence abilities of pins 9 and 10, and Ethernet module uses pin 10 for it's purposes. So I think that this is the problem, I'll try to use another library for Servo. 


Thank you for all your help.

Go Up