3 years, 10 months ago.

set mac address of Ethernet shield by using FRDM kl25z

I am not able to set mac address of Ethernet shield by using FRDM kl25z. I checked my output over the tera term and i also added the image of output at end./media/uploads/Mangesh98/max.jpg

my code is:-

  1. include "mbed.h"
  2. include "WIZnetInterface.h"

unsigned char MAC_Addr[6] = {0xDE,0x01,0xBE,0xEF,0xFE,0xEE}; int motionfront; char* Update_Key = "DUKIIHPI784HV24M";

Serial pc(USBTX, USBRX); SPI spi(PTD2,PTD3,PTD1); WIZnetInterface ethernet(&spi,PTD0,PTA20);

DigitalIn motion_front(PTB0, PullUp);

int main() { Set serial port baudrate speed: 19200 pc.baud(9600); pc.printf("Start\r\n");

while(1) {

motionfront=motion_front.read(); wait(0.2); pc.printf("motion = %d\n\r", motionfront);

int ret = ethernet.init(MAC_Addr);

if (!ret) { pc.printf("Initialized, MAC: %s\r\n", ethernet.getMACAddress()); ret = ethernet.connect(); if (!ret) { pc.printf("IP: %s, MASK: %s, GW: %s\r\n", ethernet.getIPAddress(), ethernet.getNetworkMask(), ethernet.getGateway()); } else { pc.printf("Error ethernet.connect() - ret = %d\r\n", ret); exit(0); } } else { pc.printf("Error ethernet.init() - ret = %d\r\n", ret); exit(0); }

TCPSocketConnection sock; sock.connect("", 80); if(sock.is_connected()) pc.printf("Socket Connected\n\r"); else pc.printf("Socket NoT Connected\n\r");

char buffer[300]; int ret_t;

char http_cmd[256]; sprintf(http_cmd,"GET/update?key=DUKIIHPI784HV24M&field1=%d HTTP/1.0\n\n",motionfront); printf("Running - %s\r\n",http_cmd); sock.send_all(http_cmd, sizeof(http_cmd)-1);

ret_t = sock.receive(buffer, sizeof(buffer)-1); buffer[ret_t] = '\0'; printf("Received %d chars from server:\n%s\r\n", ret_t, buffer);


ethernet.disconnect(); printf("Socket Closed");


} }


Question relating to:

This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500, W5200 and W5100. One of them can be selected by enabling it in wiznet.h. ethernet, tcp/ip, w5100, W5200, W5500, Wiznet
Be the first to answer this question.