---
title: "Problems with io6Library"
url: "https://maker.wiznet.io/forum/14255"
markdown_url: "https://maker.wiznet.io/forum/14255/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "phischl"
created: "2021-06-07T17:05:37+09:00"
last_activity: "2021-06-15T12:22:10+09:00"
language: "en"
views: 881
replies: 5
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# Problems with io6Library

## Question

Asked by phischl on 2021-06-07 in Ethernet Chips.

Hi,
I am trying to use the io6Library with a PIC24 and MPLAB X IDE.

I followed the " How to use" steps on the github page but cannot get the chip ID read out:
ctlwizchip(CW_GET_ID,&chip_id); // Check WIZCHIP ID value for read test

Do I need to call wizchip_init() or ctlwizchip(CW_SYS_UNLOCK,&syslock) before reading the chip ID?
When these functions I can see some SPI communication with an logic analyzer.
If ctlwizchip(CW_GET_ID,&chip_id) is called, I cannot see any SPI communication.

Anyone who can help me or point me in the right direction?

Thank you!

## Replies

### Reply 1 by taylor, 2021-06-08

Hello,

The CW_GET_ID means static strings of `_WIZCHIP_ID_` defined in wizchip_config.h.

[There are examples of W6100EVB](https://github.com/WIZnet-ioLibrary?q=W6100&type=&language=&sort=). [This is Loopback](https://github.com/WIZnet-ioLibrary/W6100EVB-Loopback) one of W6100 examples.

Thank you.

### Reply 2 by phischl, 2021-06-08

Thanks taylor for your reply.

I included the wizchip_conf.h but I can’t see any SPI activity on the SPI pins.

Thanks for the link, I will try one of the examples.

### Reply 3 by phischl, 2021-06-09

Unfortunately I didn’t manage to get the loopback example to run.

The output in the terminal looks like this:

> PHY OK.
> Register value after W6100 initialize!
> Mac address: 01:02:03:61:00:46
> IP address : 1.2.3.97
> SM Mask : 1.2.3.97
> Gate way : 1.2.3.97
> DNS Server : 168.126.63.1
> GW6 : 0102:0361:0046:6110:0B00:0000:0000:0000
> LLA : 0102:0361:0046:6110:0B00:0000:0000:0000
> GUA : 0102:0361:0046:6110:0B00:0000:0000:0000
> SUB6 : 0102:0361:0046:6110:0B00:0000:0000:0000
>
> NETCFGLOCK : 0

I copied everything from the main file into my main.c file and also the function calls:

> W6100Initialze();
> ctlwizchip(CW_SYS_UNLOCK,& syslock);
> ctlnetwork(CN_SET_NETINFO,&gWIZNETINFO);
> printf(“Register value after W6100 initialize!\r\n”);
> print_network_information();
> while(1)
> {
> loopback_udps(0,ethBuf0,50000,AS_IPV4);
> loopback_tcps(1,ethBuf3,50003,AS_IPV4);
> loopback_tcps(2,ethBuf4,50004,AS_IPV6);
> loopback_tcps(3,ethBuf5,50005,AS_IPDUAL);
> }

I attached some screenshots of the SPI communication, does this look right?

![Capture1](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/4/478f0302f1d41effd058d881ef0a9cf5d4085e1b.jpeg)

[![Capture2](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/9/91aed12633556cfffdb8b9bad000d986505a8810.jpeg) Capture21576×448 107 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/9/91aed12633556cfffdb8b9bad000d986505a8810.jpeg)

[![Capture2_2](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/8/858cd5a01dae765d910ca93b29a56c4cef9cb9dc.jpeg) Capture2_21761×453 122 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/8/858cd5a01dae765d910ca93b29a56c4cef9cb9dc.jpeg)

Thanks for your help.

### Reply 4 by phischl, 2021-06-10

The output in my serial monitor looks like this:
![Capture](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/8/8e7a2887349e8436cd559d72728c3d748d19520a.jpeg)

I am not sure why the IP address can’t be set.

Does someone know where the problem is or point me in the right direction?

Thank you!

### Reply 5 by phischl, 2021-06-15

I found the problem:
I am using a 16bit MCU while the library is written for a 32bit MCU.

In the w6100.h file I had to add some type casting for the address registers:
#define *SIPR* (*W6100_IO_BASE* + ( **(uint32_t)** 0x4138 &lt;&lt; 8) + WIZCHIP_CREG_BLOCK)

Now I can read out chip ID, network parameters and also the loopback example works.

---

Source: https://maker.wiznet.io/forum/14255
