Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 7 months ago.
W5500 with Nucleo-F103
Dear all,
I want to receive data via Ethernet on my F103 with W5500 shield. First I want to make a webserver and after that i want to add the functionality to receive the other data.
But i can't get my webserver working.. It's not getting the right ip adress, not via DHCP (tried a server on my PC and router), not with fixed ip addresses.
Is there anybody that can help me to solve this?
Thank you in advance!
Kind regards
Question relating to:
3 Answers
7 years, 7 months ago.
This is a board combination that I use and do not see any particular issues. Can you be more specific about what is happening. Feel free to share your code that doesn't work...otherwise it's very difficult to guess the problem.
I tried several example projects and another shield, but they won't make the ethernet connection. My enc26j60 adapter is working, but the combination with W5500 doesn't like me.
Thank you in advance.
#include "mbed.h" #include "W5500Interface/EthernetInterface.h" #include "HTTPClient.h" int main() { // EthernetInterface eth; Serial pc(USBTX, USBRX); pc.baud(115200); wait(5); printf("spi init\r\n"); SPI spi(PA_7, PA_6, PA_5); // mosi, miso, sclk wait(1); // 1 second for stable state EthernetInterface eth(&spi, PB_6, PA_9);//scs(D10), nRESET(PTA20) printf("App Start\r\n"); wait(1); // 1 second for stable state const char * IP_Addr = "192.168.0.194"; const char * IP_Subnet = "255.255.255.0"; const char * IP_Gateway = "192.168.0.1"; eth.init(); //Use DHCP wait(1); eth.connect(); printf("IP Address is %s\r\n", eth.getIPAddress()); char str[512]; char get_msg[512]= "http://api.openweathermap.org/data/2.5/weather?q=Seoul"; HTTPClient http; printf("Send get Message to openeathermap.org\r\n"); printf("msg : %s\r\n",get_msg); int ret = http.get(get_msg, str, sizeof(str)); if(!ret) { printf("\r\nPage fetched successfully - read %d characters\r\n", strlen(str)); printf("Result: %s\r\n", str); } else { printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); } }
7 years, 7 months ago.
Hello Peer,
As I know the W5500 does not have a built in MAC number. So you have to set up one by yourself. You can test this demo:
https://developer.mbed.org/users/hudakz/code/WebSwitch_WIZ550io/
To use W5500 uncomment line #49. The MAC number must be unique within the connected network so modify it as appropriate.
7 years, 7 months ago.
Here is a short code to get the mbed internal mac address
#include "mbed.h" extern "C" void mbed_mac_address(char *mac); int main() { char mac[6]; mbed_mac_address(mac); printf("MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); }