11 years ago.

Error EthernetInterface Init function

I use board MCB1700 and Keil.

Compile TCPSocket_HelloWorld example in keil, I can't run it.

EthernetInterface eth; eth.init(); printf("Welcome!\n"); eth.connect();

Program loop forever in eth.init() function, can't run printf.

Question relating to:

3 Answers

11 years ago.

The mbed code retrieves the ethernet MAC address through the USB/programming interface using semihost calls. This interface is not available on the Keil board and the software will hang. See http://mbed.org/forum/mbed/topic/972/?page=1#comment-10318 for examples on how to overrule these semihost calls and replace them with your own MAC address.

extern "C" void mbed_mac_address(char * mac) {
 
// define your own MAC Address
  mac[0] = 0x00;  
  mac[1] = 0x01;  
  mac[2] = 0x02;  
  mac[3] = 0x03;  
  mac[4] = 0x04;  
  mac[5] = 0x05;           
  
};

Also note that their may be other hardware differences between the mbed and the Keil board that will prevent the mbed libs from working on the Keil.

Accepted Answer
11 years ago.

I tried it with mbed and it worked. Are you sure you don't have any connection problem with your LAN through your router ?

My system base on MCB1700 kit of keil.

Connection very good!

I also tried a example TCP client of TCP_CM3.lib keil, it wored and post data to server.

I tried library TCP - Ethernet Library mbed, example TCPSocket_HelloWorld, export to keil, compile , and it don't work.

Please me.

posted by thiencdcn thiencdcn 02 Dec 2013
11 years ago.

extern "C" void mbed_mac_address(char * mac) {
 
// define your own MAC Address
  mac[0] = 0x00;  
  mac[1] = 0x01;  
  mac[2] = 0x02;  
  mac[3] = 0x03;  
  mac[4] = 0x04;  
  mac[5] = 0x05;           
  
};

It's worked.

Thanks.