Dear community,
This is my first post on this forum so hopefully my post is good and you can understand it.
Using these examples:
http://wizwiki.net/wiki/doku.php?id=oshw_using_wiznet:bletoethernet
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 : http://i.stack.imgur.com/9mk4A.jpg 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,
.Pin_SCK = ARDUINO_13_PIN,
.Pin_MOSI = ARDUINO_11_PIN,
.Pin_MISO = ARDUINO_12_PIN,
.Pin_CSN = ARDUINO_10_PIN};
spi_master_init(SPI0,&spi_info);
}
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
ctlwizchip(CW_GET_ID,(void*)tmpstr);
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],
gWIZNETINFO.mac[3],gWIZNETINFO.mac[4],gWIZNETINFO.mac[5]);
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", gWIZNETINFO.gw[0],gWIZNETINFO.gw[1],gWIZNETINFO.gw[2],gWIZNETINFO.gw[3]);
printf("SUB: %d.%d.%d.%d\r\n", gWIZNETINFO.sn[0],gWIZNETINFO.sn[1],gWIZNETINFO.sn[2],gWIZNETINFO.sn[3]);
printf("DNS: %d.%d.%d.%d\r\n", gWIZNETINFO.dns[0],gWIZNETINFO.dns[1],gWIZNETINFO.dns[2],gWIZNETINFO.dns[3]);
printf("======================\r\n");
}
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.