Hi,
I have written a ethernet server based on the code found in net.
Sakura is not responding for the ethernet frames from client. I am using offline compiler
Code ::
#include <rxduino.h>#include <Ethernet.h>#define INTERVAL 100byte mac[] = {0x08, 0x09, 0x3c, 0x12, 0x34, 0x56};byte ip[] = {192,168,0,2};TEthernet Ethernet;EthernetServer server (80);void setup(){ pinMode(PIN_LED0,OUTPUT); pinMode(PIN_LED1,OUTPUT); pinMode(PIN_LED2,OUTPUT); pinMode(PIN_LED3,OUTPUT); Serial.begin(115200,SCI_SCI0P2x); Ethernet.begin(mac,ip); Serial.write("Ethernet done \n");Serial.print("My IP address is: "); Serial.println(Ethernet.localIP()); server.begin(); Serial.write("Server begin done \n"); /*speed: Baud rateThe port: port to be used (if omitted, use the virtual COM port of USB0)I use a virtual COM port USB0: SCI_USB0I use the (TxD) (RxD), pin 30 pin 31 SCI_SCI2AI use the (RxD) (TxD), pin 26 SCI_SCI2B pin 24. Used to access XBeeI use the (RxD) (TxD), Pin 6 Pin 7 SCI_SCI6BI use the (TxD) (RxD), pin 1 SCI_SCI0P2x pin 0Select the one it received for the first time in USB0 or SCI_AUTO pin 0,1*/Serial.write("Setup done \n");}void loop(){EthernetClient client; client = server.available (); if (client) { // got client? boolean currentLineIsBlank = true; digitalWrite(PIN_LED0, 1); delay(INTERVAL); while (client.connected()) { digitalWrite(PIN_LED1, 1); delay(INTERVAL); if (client.available()) { // client data available to read char c = client.read(); // read 1 byte (character) from client // last line of client request is blank and ends with \n // respond to client only after last line received digitalWrite(PIN_LED2, 1); delay(INTERVAL); if (c == '\n' && currentLineIsBlank) { digitalWrite(PIN_LED3, 1); delay(INTERVAL); // send a standard http response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); client.println(); // send web page client.println("<!DOCTYPE html>"); client.println("<html>"); client.println("<head>"); client.println("<title>GK-Sakura Web Page</title>"); client.println("</head>"); client.println("<body>"); client.println("<h1>Hello from GK-Sakura!</h1>"); client.println("<p>A web page from the GK-Sakura server</p>"); client.println("</body>"); client.println("</html>"); break; } // every line of text received from the client ends with \r\n if (c == '\n') { // last character on line of received text // starting new line with next character read currentLineIsBlank = true; } else if (c != '\r') { // a text character was received from client currentLineIsBlank = false; } } // end if (client.available()) } // end while (client.connected()) delay(1); // give the web browser time to receive the data client.stop(); // close the connection } // end if (client)// Serial.write("LOOP\n");}
Hi I cant really help with the software side, but just a few thoughts
It would be useful to explain how you are using the Ethernet interface without having to look through all the code
This would help someone to understand in more detail the problem and for the users who are using the Ethernet interface see if it is similar to your design
Make sure that if you are using the internal hardware Ethernet and PHY that all the connections, jumpers and interfaces etc. are set correctly (especially if you have been using the board for any other functions)
Also that if you are porting code from the web many Arduino Ethernet implementations use an external shield board to provide the MAC and PHY and a serial interface between the MCU and the shield board
(often SPI as this is the fastest). The Ethernet interface on the GR-Sakuara board I am sure you are aware is connected directly to the RX63N MCU
Also there a number of posts in the forum and India design contexts about using Ethernet, which may be of some assistance with your problem
Sorry I can't be of more help
I too tried this out, and it didnt work out at all ... Been on it for a while now. Have you gotten it to work / any progress at all ?
seems you have a basic problem.
I'm not sure which OS you are using, but for Windows maybe this thread might help:
renesasrulz.com/.../508.aspx
or that with some additional explanations:
renesasrulz.com/.../3779.aspx
Sometimes, I made the experience that the USB serial port and connection to the USB terminal does not work immediately after uploading the code. So, try to remove the USB connection after uploading the sketch.bin and connect it again and try again then to connect via the USB terminal.
Hi Juergen Zimmer,
With online compiler ethernet is working for first time after reset.
With offline compiler ethernet is not working.
Please see the log connection is not getting closed in the second time and it is hang.
26/09/2013 05:26:29.042 [RX] - Get IP address from DHCP is success.<CR><LF>
Please access by browser at http://192.168.1.105<CR><LF>
new client<CR><LF>
GET / HTTP/1.1<CR><LF>
Host: 192.168.1.105<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Firefox/24.0<CR><LF>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8<CR><LF>
Accept-Language: en-US,en;q=0.5<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Connection: keep-alive<CR><LF>
<CR><LF>
client disconnected<CR><LF>
GET /favicon.ico HTTP/1.1<CR><LF>
Accept: image/png,image/*;q=0.8,*/*;q=0.5<CR><LF>
Serial port also works fine now with USB.
Ethernet hang does not happen everytime. tried with iexplore and firefox.
Is there any solution for offline. i might be depended on library we are using in offline compiler. skectch size is different between online and offline compiler for the same code.
Hello,
I have tried so many time in ON line and OFF line complier Ethernet doesn't work.Please tell me any hardware changes is there.
There is no hardware change involved. Whatever code runs on the ON line compiler will also run on the OFF line compiler.
yes Abdeali is correct.......code should run for both Offline and online
I suspect the libraries used will make the difference in case of offline and online compilers.
With offline size of the sketch.bin is 93kb
with online size was 97kb.
Is there any way to update the offline compiler lib to latest?
Please any one give me Ethernet udp code or give me some idea
How to find MAC ID of the module ?
Sorry to delay reply.
GR-SAKURA has no MAC address itself.
So in case of prototyping using them, specify your MAC like sample of Arduino.
www.arduino.cc/.../WebClient
U/L bit in 1st octet should be specified 1.
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
~~~~