Pages: [1]   Go Down
Author Topic: Ethernet begin variable allocation  (Read 316 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 1
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I´m having some problems with the ethernet component of my project.

I do data submissions to a personal server.
Sometimes when my server is down, my program restarts, because of the sistematic trys to establish a connection with my server.

Every time the server doesn´t answer, i reset the ethernet module and recall the Ethernet Begin function and after i do a Client connect.
I think it is the consistent calling to the Ethernet Begin function that might be my problem.

Does someone has an opinion?
Does anyone has any idea if this might be a memory problem related with the Ethernet Begin re calling?

Regards
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4257
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Read this http://arduino.cc/forum/index.php/topic,97455.0.html
Post your code otherwise nobody can help you.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, you should not call Ethernet.begin() more than once. It allocates a DhcpClass object which will never get released. This object uses more than 50 bytes of memory which will get lost the next time you call begin() again.

Show us your code we may help you to correct that error.
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I haven´t post the code because it is to dense, and i was trying to close in on the error.

Do you think it would be possible to release the previous DhcpClass object before calling Ethernet Begin again?

Another idea,

in case of using fixed ip, do you think this problem would persist?

Thank you for the input
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I haven´t post the code because it is to dense, and i was trying to close in on the error.

If you think the code is too complex, create a minimal test sketch that just demonstrates the problem. This will also enable you to confirm that you understand what the problem actually is, and subsequently that you have fixed it.

I'm sure you will have figured out by now that ethernet.begin() should only be called once.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do you think it would be possible to release the previous DhcpClass object before calling Ethernet Begin again?

No, I think, Ethernet.begin() shouldn't be called more than once.

Quote
in case of using fixed ip, do you think this problem would persist?

That might remove the main symptom but your problem of wrong code persists. If you call Ethernet.begin() again in your code, your code is broken and you should fix that!
Logged

Pages: [1]   Go Up
Jump to: