Using BLE to TCP wiznet example and library does not set up IP, GW, Subnet mask correctly on W5100

Dear community,

This is my first post on this forum so hopefully my post is good and you can understand it.

Using these examples:

I want to setup a ethernet connection with my nRF52840 using my Wiznet5100 (arduino)
ethernetshield. I am going to use SPI for the communication between the chips. The nRF52840 is arduino shield compatible so I can directly plug the shield on the board.

Using this layout of the ethernet shield : I changed the SPI pins as following:

#define ARDUINO_13_PIN NRF_GPIO_PIN_MAP(1, 15) // SCK Digital pin 13
#define ARDUINO_12_PIN NRF_GPIO_PIN_MAP(1, 14) // MISO Digital pin 12
#define ARDUINO_11_PIN NRF_GPIO_PIN_MAP(1, 13) // MOSI Digital pin 11
#define ARDUINO_10_PIN NRF_GPIO_PIN_MAP(1, 12) // CSN Digital pin 10

And edited these pins in the spi0_master_init() function:

void spi0_master_init()
SPIConfig_t spi_info = {.Config.Fields.BitOrder = SPI_BITORDER_MSB_LSB,
.Config.Fields.Mode = SPI_MODE3,
.Frequency = SPI_FREQ_8MBPS,

I hooked up a logic analyzer to these pins and I can see data going over all pins. But here comes to the problem. When I call user_ethernet_init(); function which is defined in user_ethernet.c library the network_init(); function is called in the same file. Here it sets up a MAC, IP, GW, Subnetmask and DNS. But when the result of this function is printed only the DNS is configured correctly.

Below is the function that is written in user_ethernet.c file

void network_init(void)
uint8_t tmpstr[6];
ctlnetwork(CN_SET_NETINFO, (void*)&gWIZNETINFO);
ctlnetwork(CN_GET_NETINFO, (void*)&gWIZNETINFO);

// Display Network Information
printf("\r\n=== %s NET CONF ===\r\n",(char*)tmpstr);
printf("MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n",gWIZNETINFO.mac[0],gWIZNETINFO.mac[1],gWIZNETINFO.mac[2],
printf("SIP: %d.%d.%d.%d\r\n", gWIZNETINFO.ip[0],gWIZNETINFO.ip[1],gWIZNETINFO.ip[2],gWIZNETINFO.ip[3]);
printf("GAR: %d.%d.%d.%d\r\n",[0],[1],[2],[3]);
printf("SUB: %d.%d.%d.%d\r\n",[0],[1],[2],[3]);
printf("DNS: %d.%d.%d.%d\r\n", gWIZNETINFO.dns[0],gWIZNETINFO.dns[1],gWIZNETINFO.dns[2],gWIZNETINFO.dns[3]);


I posted about this on the github library someone else said he had the same problem. That can be seen here: Network_init(); not setting the Mac, IP, Subnet , Gw, DNS · Issue #17 · Wiznet/ioLibrary_Driver · GitHub

So my question is actually. Has anyone else had this problem, and what can I do to solve it?

Thanks for any help in advance.

I was able to fix this myself, by reading the complete data sheet of the wiz5100 I found out I needed to change the SPI mode.

My bad sorry :slight_smile: