8 years ago.

DHCP not working with FRDM-K64F

I have two FRDM-k64F board. Tried basic DHCP code to get IP from router on both the board. But the issue is one board is returning an error (-1) while other board with the same code is getting IP address.

inmage of code is attached /media/uploads/schadawar/dhcp.jpg

Boot loader Version: 0226 in both the board.

revision number written in back of the boards are

Board 1 (DHCP not working ) : 700-28163 REV D SCH-28163 REV E3

Board 2 (DHCP working): 700-28163 REV B SCH-28163 REV D1

as the REV is different for both the board.

Why Board 1 is not getting IP? Is it that because REV is different ?

Please any one if having any clue or answer then reply to my query ASAP.

1 Answer

8 years ago.

Sanket,

Can you please link to the code you are using for this example? If you are using an existing example please provide a link, if this is a program in your online workspace please publish the program so we can import and try to debug it. Without having access to your code it is very hard to debug this issue.

Is it possible the usb_init() function is causing problems? Also have you tried updating the mbed and ethernet libraries to the latest versions?

I have confirmed that the following code is working with the latest mbed libraries on my K64F board (Schematic revision E3)

#include "mbed.h"
#include "EthernetInterface.h"
 
 
int main (void) {
    EthernetInterface eth;
    eth.init(); //Use DHCP
    eth.connect();
    printf("\n Device IP Address is %s\n", eth.getIPAddress());
    while(1){;}
}

Hi,

Thank you for your solution. But some of the things I found

Initially I was using Ethernet_UDP_client sample code ( https://developer.mbed.org/teams/Freescale/code/Ethernet_UDP_client/ ) and modified that code only to get the IP address.

Now after your suggestion, 1- I have updated this code, and replaced main( ) with your main() function Result: No IP address from Board1 (REV E3) Got IP address from Board 2

NOte: also 'EthernetInterface eth' replaced with 'EthernetInterface eth1' (because 'eth' already is defined globally)

2- In Sample code of TCPSocket_HelloWorld ( https://developer.mbed.org/handbook/Ethernet-Interface ) also main() function is replaced with your main() Result: successfully Got the IP address from Board1

would you please check at your end with these sample codes and let me know what exactly the issue is. and also which sample base I should use to start my coding?

posted by sanket chadawar 20 Apr 2016