I am having a problem sending simple messages using this library. I am hoping eventually to send files I have stored on a memory card to a PC on my LAN, but my simple test program fails.
The symptoms are:
If I set wait to 100ms, then it successfully sends around 6 messages and then hangs.
If I set wait to 3000ms, then it successfully sends around 30-40 messages, reports that it has sent the rest at -1 bytes and reaches the end of the loop.
I am very much a novice, but have ran Wireshark which reports that the "Ethernet Frame Check Sequence" is incorrect on every packet sent by the mbed. This appears to be a sequence of 8 bytes with a value of 0.
Ideally I would prefer not to have a wait command at all as this would obviously have a large impact if sending large files.
Any ideas?
I have spent many hours trying to understand the code, but practically all of it is way above my level. I notice that there is the ability to show debug info in the lwip libraries but I cannot see how enable this so that I can see the debug info through the serial connection to my PC (like the pc.printf commands in main). If anyone can give me simple instructions on how this can be done, then I can at least try and find the point at which the mbed hangs.
I've had days at this now (got printf working by not altering standard pc.baud), is it just me that cannot get this to work? - could I have a damaged Mbed? - is it a cabling problem? (I can get an IP address and send a few messages, so I thought not, but perhaps?).
Anyone?, this is starting to drive me crazy ;-(
Regards,
Phil
#include "mbed.h"
#include "EthernetInterface.h"
Serial pc(USBTX, USBRX); // set serial comms to PC
int main()
{
pc.baud(921600); // set baud for comms
pc.printf("Connecting\n");
EthernetInterface eth; // set up the interface
eth.init(); //Use DHCP
eth.connect(); // connect
pc.printf("IP Address aquired: %s\n", eth.getIPAddress());
TCPSocketConnection sock; // set up a socket
sock.connect("192.168.1.200", 55555); // connect to server
pc.printf ("Connected to Server\n");
char *testmessage = "Hello";
int bytes;
int i;
for (i=0;i<100;i++)
{
bytes = sock.send_all(testmessage, strlen(testmessage));
pc.printf("Message %d - Bytes sent: %d\n",i,bytes);
wait_ms(3000);
}
pc.printf("Finished\n");
}
Hi Everyone,
We are progressing on creating the new EthernetInterface library, and we would be glad to get your bug reports/feature requests here!
The documentation of the library can be found in the handbook:
Cheers,
Donatien