Pages: [1]   Go Down
Author Topic: Bug with Ethernet Shield?  (Read 946 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 73
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My Arduino works for several hours with the ethernet shield and then the ethernet shield seems to stop working.  The other functions work fine, but the ethernet parts just seem to stop working.  My code is at www.russdraper.com (search for the arduino posts) if you wish to look at it.  Is this a known issue?  It works fine after I push the button to reset it.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an ethernet shield associated to a freeduino board,can you help me how to connect a temperature sensor (DALLAS 18B20) and how to view the temp on the internet (i mean the full code needed)

thanks in advance.
Logged

STOCKHOLM
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can this have something to do with the millis rollover? approx 9h30 on
older software 49 days on release 0012

I don't have any hardware yet, but I would try something like
Code:
     uint8_t oldSREG = SREG;
      
      // disable interrupts while we write timer0_millis or we might get an
      // inconsistent value (e.g. in the middle of the timer0_millis++)
      cli();
      timer0_millis = 0xF800;
      SREG = oldSREG;
You can read the millis function and find the time for rollower.
If it takes too long time to rollower, you can increase the 0xF800 constant.
You will find the millis() function in wiring.c

Magnus
      
Logged

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Magnus's technique for testing whether your application is "rollover-proof" is a good one.  However, since timer0_millis is a 32-bit unsigned long, you should really change

Code:
timer0_millis = 0xF800;
to
Code:
timer0_millis = 0xFFFFF800;

This will start your sketch at about 0x800 = 2048 ms (about 2 seconds) before the rollover.

Mikal
Logged

Tokyo, Japan
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
Trackballer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To test "rollover-proof", it's not a good idea to adding the line

Code:
timer0_millis = 0xFFFFF800;

to the millis() function in wiring.c.
This modification resets the timer value to 0xFFFFF800 every time the function is called.

To test rollover, the following modification at variable definition in wiring.c may be better.

Code:
//volatile unsigned long timer0_millis = 0;
volatile unsigned long timer0_millis = 0xFFFFF800;

My code has passed the test smiley
« Last Edit: January 08, 2009, 05:35:25 am by tasasaki » Logged

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

tasasaki, I don't think anyone was suggesting setting timer0_millis inside the millis() function itself.  I think the idea was just to set it wherever in the sketch it is most crucial to test rollover.

Mikal
Logged

Tokyo, Japan
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
Trackballer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

mikal, can you set the variable timer0_millis to a value in the sketch code (*.pde file)?
 When I assign a value to the timer0_millis in a *.pde file, compile error occurs like this;
Quote
In function 'void loop()':
error: 'timer0_millis' was not declared in this scope
How can I change the time0_millis in a sketch?
Logged

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

tasasaki,

If you simply declare it "extern" in your sketch like this:

Code:
extern volatile unsigned long timer0_millis;

then later in your sketch you can just do:

Code:
timer0_millis = 0xFFFFF800;

wherever you want!

Mikal
Logged

Tokyo, Japan
Offline Offline
Jr. Member
**
Karma: 0
Posts: 91
Trackballer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh I see. It's a common way of the C-like languages.
Logged

Pages: [1]   Go Up
Jump to: