Go Down

Topic: Ethernet shield: client read random value (Read 602 times) previous topic - next topic


May 27, 2011, 09:01 pm Last Edit: May 29, 2011, 11:00 pm by marsangola Reason: 1
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:

Code: [Select]

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?

Go Up