Yesterday I was trying the TCP and UDP connection with my UBlox C027. I set a fixed IP address for my mbed and tried the UDP connection, everything went well. Suddenly, I was not able to connect any more or even ping my mbed. The same program is on another UBlox and it’s working fine.
Please find below the part of setting the IP address and my UDP client:
int main()
{
//printf("hello main\n\r");
static const char* PB_IP_1;
static const char* PB_IP_2;
GnssSerial gnss;
int gnssReturnCode;
int length;
char buffer[256];
//printf("Ethernet socket example\n\r");
/*sprintf(mbedIP,"192.168.220.45");
sprintf(mbedMASK,"255.255.252.0");
sprintf(mbedGATEWAY,"192.168.220.1"); */
sprintf(mbedIP,"192.168.1.101");
sprintf(mbedMASK,"255.255.252.0");
sprintf(mbedGATEWAY,"192.168.1.1");
nsapi_error_t set_network=eth.set_network(mbedIP,mbedMASK,mbedGATEWAY);
//printf ("Starting up...\n");
if (gnss.init())
{
// Bring up the ethernet interface
if (0 != eth.connect())
{
return -1;
//led_2= !led_2;
}
else
{
led_1= !led_1; // Ethernet connected.
}
}
If something stop working then just go back to basic and try to Mbed TCP example instead your one, if it works or not.
If you really not changed anything and same program works with one board and not with second one, then it seems like the board is broken.
I do not have personal experiences with this.
But how you can see here, there is a week function what can be overridden. That function also contains the Mac address what you wrote. So you can try to change the Mac address in this file (if you work offline) or try to place the whole function with new Mac address in the main.
You need to change it inside the function not pass it as parameter. Also you not need to call this function, it will be called somewhere in the driver probably.
From my understanding, when a device is the semihost then that function will try to read the Mac address from that device. If not, the array is used (from above).