Forum >Ethernet Shield v2.0 not working properly
ArduinoGeneral

Ethernet Shield v2.0 not working properly

userHead Account cancelled 2011-07-28 23:54:18 4004 Views1 Replies
Hi,

I use an Arduino Uno and the latest DFRobot Ethernetshield(inkl. microSD v2.0). Here's my Sketch:
[code]
#include <SPI.h>
#include <Ethernet.h>


byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
byte ip[] = {
172,20,162,33 };
byte gateway[] = {
172,20,161,1};
byte subnet[] = {
255, 255, 252, 0 };

byte server[] = {
172,20,162,32 };


Client client(server, 3009);

void setup() {
Ethernet.begin(mac, ip);
// give the ethernet module time to boot up:
delay(1000);
}

void loop() {
client.flush();
client.connect();
client.println("TEST");
client.flush();
client.stop();

}
[/code]
All it should do is send a simple "TEST". I wrote a Java-programm to display the send data. Here's the output
[code]
Program starting ...
EchoServer gestartet
Client> {)'W<?bY??|?mmZ;zf?????|????0?u?qS?????R????3?U?)[email protected]???m9??Hl7TB!??????$|?XW ???0??H???q??f????e\??Client> FP"??=u?6?
Client> R??(
Client> -3?`?5'??B???KOwtFH}xi?#???7D?íDt?Af?0? ?????j?????{??43?g????????E[?! ?
Client> | ?hM*
Client> p?;??98?A??w????FY?FYI?h???a????F?8t?? S?????7?K??C [????z?%;N???T?????d?f?*?4c??<#@??`m,BlaBla end ???w??TEST
Client> la enHost: www.pachube.com
Client> X-PachubeApiKey: YOUTEST
Client> HERE
Client> BlaBlTEST
Client> achubeATEST
Client> YOUR_KEY_HERE
Client> BlaBla eTEST
Client> P/1.1
Client> HoPUT /api/YOUR_FEED_HETESTsv HTTP/TEST
Client> st: PUT /TETEST
Client> _FEED_HERE.csv HTTP/1.1
Client> TEST
Client> www.pacTEST
Client> om
Client> X-PPUT /api/YOUR_FEED_HERE.csv HTTP/1.1
Client> ?/????{?;w?R??]??Client> p?;??98?A??w????FY?FYI?h???a????F?8t?? S?????7?K??C [????z?%;N???T?????d?f?*?4c??<#@??`m,BlaBla end ???w??TEST
Client> la enHost: www.pachube.com
Client> X-PachubeApiKey: YOUTEST
Client> HERE
Client> BlaBlTEST
Client> achubeATEST
Client> YOUR_KEY_HERE
Client> BlaBla eTEST
Client> P/1.1
Client> HoPUT /api/YOUR_FEED_HETEST
[/code]
It seems that my arduino sends the whole cache to my PC. The flush() only affects the RX-Buffer. As you can see i tried the Pachube-Example before and it still sends some of the data but it should only send the last 4 chars: TEST.
I tried this many times, it always send some random data with some messages from the previos examples and the last 4 chars are my desired "TEST" message.

If I modify the programm to send TEST every 2 seconds, it starts, prints out some weird stuff like the above containing some of the previous send messages and then starts to send TEST every 2 seconds as wished. But after 10 to 20 send TEST it sends the weird stuff again.

Any idea what goes wrong here?

Regards
Chris
2011-08-02 20:06:55 Hi Chrisbc,

Sorry for the late reply. Why are you using a java program? I used a hyper terminal and it works great.

All I got was a stream of "test".

You can try using the windows XP HyperTerminal or program called [url=http://"http://www.wiznet.dfrobot.kr/Sub_Modules/en/technical/Download_View.asp?PK_Num=368"]Device Terminal[/url]


Just set it to server mode and indicate the port.

Cheers,
Hector
userHeadPic Hector