---
title: "W5100S-EVB-Pico OLED/DHCP"
url: "https://maker.wiznet.io/eric_g/projects/W5100SEVBPico-OLEDDHCP/"
markdown_url: "https://maker.wiznet.io/eric_g/projects/W5100SEVBPico-OLEDDHCP/md"
type: "UCC: User Created Content"
author: "eric_g"
original_author: "eric_g"
original_url: "https://blog.naver.com/chcbaram/222633967817"
published: "2022-05-03"
language: "en"
hardware: ["W5500 Raspbery Pi Pico", "OLED Display"]
likes: 0
views: 166
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# W5100S-EVB-Pico OLED/DHCP

> W5100S-EVB-Pico OLED/DHCP

Original author: eric_g (source: https://blog.naver.com/chcbaram/222633967817)

## Components

- **W5500 Raspbery Pi Pico** x 1
- **OLED Display** x 1

## Article

## DETAILS

##### WIZnet의 W5100S-EVB-Pico 보드에 OLED를 추가하고 DHCP 동작 시험을 해 보았습니다.

##### 핀 구성은 아래 그림처럼 지난번 pico 보드에서 연결한 것과 동일하게 하였습니다.

![](https://maker.wiznet.io/uploads/2022/05/evbPicoOled-300x274.png)

##### 처음에 로고를 출력하고 multicore_launch_core1() 함수를 이용해서 이더넷 처리와 메인함수를 코어 2개에 분리해서 동시에 처리하도록 하였습니다. 그래서 이더넷 처리와 다른 OLED와 CLI등 동시에 실행 가능합니다.

```
void apInit(void)
{
? ? cliOpen(_DEF_UART1, 115200);
? ? canOpen(_DEF_CAN1, CAN_NORMAL, CAN_CLASSIC, CAN_1M, CAN_1M);

? ? for (int i=0; i<32; i+=1)
? ? {
? ? ? ? lcdClearBuffer(black);
? ? ? ? lcdPrintfResize(0, 40-i, green, 16, " -- WIZnet --"); 
? ? ? ? lcdDrawRect(0, 0, LCD_WIDTH, LCD_HEIGHT, white);
? ? ? ? lcdUpdateDraw();
? ? ? ? delay(10);
? ? }
? ? delay(1000);

? ? lcdClearBuffer(black);
? ? lcdPrintfResize(0, 0, green, 16, "Getting IP.."); 
? ? lcdUpdateDraw();

? ? //multicore_launch_core1(loopback_test_main);
? ? //loopback_test_main();
? ? //dhcp_test_main();
? ? multicore_launch_core1(dhcp_test_main);
}
```

##### apMain()에서는 dhcp로 ip를 받아오면 OLED에 출력하도록 하였습니다. 그리고 CLI를 위해서 cliMain()을 호출 하고 있습니다.

```
void apMain(void)
{
    uint32_t pre_time;
    bool pre_dhcp_init = false;

    while(1)
    {
        if (millis()-pre_time >= 500)
        {
            pre_time = millis();
            ledToggle(_DEF_LED1);
        }

       if (dhcpIsInit() != pre_dhcp_init)
       {
           lcdClearBuffer(black);
           if (dhcpIsInit() == true)
           {
               wiz_NetInfo net_info;

               dhcpGetNetInfo(&net_info);
               lcdPrintfResize(0, 0, white, 16, "IP %d.%d.%d.%d",
                                                 net_info.ip[0],
                                                 net_info.ip[1],
                                                 net_info.ip[2],
                                                 net_info.ip[3]); 
           }
           else
           {
               lcdPrintfResize(0, 0, white, 16, "dhcp is empty");
           }
           lcdUpdateDraw();
           pre_dhcp_init = dhcpIsInit();
       }
        cliMain();
    }
}
```

##### 실행을 해보면 처음에 로고를 출력하고 IP를 가져올때 까지 기다리다가 가져오게 되면 화면에 IP가 출력이 됩니다.

![](https://maker.wiznet.io/uploads/2022/05/oledOutput-182x300.png)

##### 해당 IP로 ping 해보면 정상적으로 응답이 오는 것을 알 수 있습니다.

![](https://maker.wiznet.io/uploads/2022/05/response-300x149.png)

## Code

<https://github.com/chcbaram/wiznet_can_gateway>

---

Source: https://maker.wiznet.io/eric_g/projects/W5100SEVBPico-OLEDDHCP/
