Pages: [1]   Go Down
Author Topic: Ethernet shield: client read random value  (Read 434 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,

I'm sending data to google whith the ethernet shield, the official one.
My program works for some minutes, It sends the same POST message and read the same server answer for 10 to 100 times, then it starts to read random values and stops working.

I looked inside the library and I found a strange behavior in the function:

void W5100Class::send_data_processing(SOCKET s, uint8_t *data, uint16_t len)

  uint16_t ptr = readSnTX_WR(s);
  uint16_t offset = ptr & SMASK;
  uint16_t dstAddr = offset + SBASE[s];

  if (offset + len > SSIZE)
    // Wrap around circular buffer
    uint16_t size = SSIZE - offset;
    write(dstAddr, data, size);
    write(SBASE[s], data + size, len - size);
  else {
    write(dstAddr, data, len);
   if(ptr!=readSnTX_WR(s)) Serial.println("Argghhhhh! who change TXWR?"); //     <----------------  Look here!  
   ptr += len;
   writeSnTX_WR(s, ptr);

The register TX_WR changed its value while Arduino was writing the sending message. It was not expected to do that!

After this behavior the wiz5100 stop working well.

In a deeper analysis I found that this behavior is not deterministic and errors arise after a random time from the restart.

I also notice that many registers are corrupted and were changing their value very fast. This happen after calling the write function. Registers are ok just before the call, but, after the SPI send, they are corrupted.

Could someone help me?
« Last Edit: May 29, 2011, 04:00:21 pm by marsangola » Logged

Pages: [1]   Go Up
Jump to: