1.jpg
Let’s start the Internet radio project with WIZ550io
Please refer to YouTube
1. Block Diagram (main interface)
-       SPI1: WIZ550io 

-       SPI2: VS1033D

2.jpg
3.jpg

-       Define the VS1033D pin

4.jpg

-       Define the WIZ550io pin
5.jpg
2. Schematic & Source code & Compiler
- Refer to as below site
- STM32board (open the Schematic)
- WIZ550io Board $17.00 (http://www.shopwiznet.com/wiz550io)
- Compiler: EmIDE (http://www.emide.org/)
3. Protocol Analytics
To connect the Radio channel, we should check protocol between Radio Server and Client board.
-       Step #1 In order to analytics the network Packet, you should execute packet capture tool
        such as WireShark (www.wireshark.com)
-       Step #2: Running the Explore and access the Radio Channel
6.jpg
We’ll find as below web-page
Click the Listen button. And then, the PC will play the MP3 player as like Gom!!!
7.jpg
-       8.jpg
-       Step #3 Packet analytics
I omitted the Wireshark packet capture procedure. (Please find a google or YouTube)
Anyway, the below image displayed TCP client (PC part) connection procedure
è  Client PC: 192.168.1.100
è  Server Radio channel IP: 109.206.96.11
9.jpg
-       Keep in mind, the Key point packet is here “GET / HTTP/1.1”
That means when TCP Client connection was finished, the PC (Client) will send as below packets.
10.jpg
Instead of Client board, I used PC and Client p/g as like the Hercules_3-2-4 (www.HW-group.com)
-       Test Radio Channel IP and port number
IP / Port = 109, 206, 96, 11 / 80 (TOP FM Beograd 106,8  64-kpbs)
4. Source Code analytics
-       Total block diagram
11.jpg
-       Internet Radio TCP Client block Diagram

12.jpg
5. Implementation.
-       Initialize the WIZ550io and VS1033D SPI setting
è  VS1033D SPI Setting
13.jpg
è  WIZ550io SPI setting
14.jpg

-       main loop

/*********************************************************************

*

*  main()

*

*********************************************************************/

void main()

{

    //============================================================

    // Host MCU initialize

    //============================================================

    platform_init();

    //============================================================

    // WIZnet TCP/IP Chip initialize

    //============================================================

    WIZnet_init();

    //============================================================

    // Application code : DHCP Client

    // - DHCP IP allocation and check the DHCP lease time (for IP renewal)

    //============================================================

    while(DHCP_SUCCESS==0) DHCP_Routine();      //DHCP init Check

    VS1003_InitCheck();                               //VS1033D init check

    VS1003_SetVolume(0x00);

    Delay_ms(100);

    while (VS1003_Ready()==Bit_RESET)           //VS1033D play to Ready check

   {

        printf("VS1003_Ready=Bit Reset1");

    }

#ifdef MP3_Debugging

    MP3_Test();             //Play the sample Music (5Sec)

#endif

    while(1){

        //============================================================

        // Application code : Loopback

        // TCP Server

        //============================================================

        LoopBack_Routine();

        InternetRadio_tcpc(SOCK_RadioC, any_port);                      //Internet Radio Play

    }

}

uint8 RadioRequest[]= {


    0x47, 0x45, 0x54, 0x20, 0x2f, 0x20, 0x48, 0x54, 0x54, 0x50,

    0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x41, 0x63, 0x63, 0x65,

    0x70, 0x74, 0x3a, 0x20, 0x2a, 0x2f, 0x2a, 0x0d, 0x0a, 0x49,

    0x63, 0x79, 0x2d, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74,

    0x61, 0x3a, 0x31, 0x0d, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x2d,

    0x41, 0x67, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x47, 0x4f, 0x47,

    0x53, 0x20, 0x48, 0x54, 0x54, 0x50, 0x20, 0x4d, 0x50, 0x45,

    0x47, 0x28, 0x47, 0x4f, 0x4d, 0x41, 0x29, 0x0d, 0x0a, 0x48,

    0x6f, 0x73, 0x74, 0x3a, 0x20, 0x75, 0x6b, 0x32, 0x2e, 0x69,

    0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x2d, 0x72, 0x61,

    0x64, 0x69, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x0d, 0x0a, 0x43,

    0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a,

    0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x0d, 0x0a, 0x0d, 0x0a

};

Do you remember this packet?
Yes, this packet will be first sent to Radio Sever.
Please refer to ESTABLISED routine
ret = send(s, RadioRequest, sizeof(RadioRequest));
15.jpg
void InternetRadio_tcpc(uint8 s, uint16 port)
{
    int32_t ret;
    uint16 RSR_len;
    uint16 received_len;
    uint8 *data_buf = TX_BUF;
    uint16 sentsize=0, i=0;
    switch (getSn_SR(s))
    {
        case SOCK_ESTABLISHED:                 /* if connection is established */
            if(RadioSocket_status==1)
            {
                printf("\r\nConnected Socket: %d\r\n",s);

                //printf("\r\n RadioSocket_status=1\r\n");
                //Delay_ms(1000);
                ret = send(s, RadioRequest, sizeof(RadioRequest));
                printf("\r\n Send RadioRequest protocol\r\n");
                RadioSocket_status = 2;
            }

            if ((RSR_len = getSn_RX_RSR(s)) > 0)         /* check Rx data */
            {
                if (RSR_len > DATA_BUF_SIZE) RSR_len = DATA_BUF_SIZE;
                received_len = recv(s, data_buf, RSR_len);         /* read the received data */
                printf("\r\n Receive Data Num %d", received_len);
                sentsize =0;
                while(received_len != sentsize)
                {
                    while (VS1003_Ready()==Bit_SET)
                    {
                        //printf("\r\n VS1003 Data process start\r\n");
                        for (i=0; i<received_len; i++)
                        {
                            VS1003_WriteData(data_buf[i]);
                            Delay_us(250);
                            Delay_us(30);
                        }
                        //Delay_ms(10);
                        sentsize += received_len;
                        if (sentsize>=received_len) return;
                    }
                 }
            }
          break;
        case SOCK_CLOSE_WAIT:                     /* If the client request to close */
            printf("\r\n%d : CLOSE_WAIT", s);
            if ((RSR_len = getSn_RX_RSR(s)) > 0)         /* check Rx data */
            {
                 if (RSR_len > DATA_BUF_SIZE) RSR_len = DATA_BUF_SIZE;
                         ret = received_len = recv(s, data_buf, RSR_len);
            }
            RadioSocket_status = 0;
            disconnect(s);
            break;
        case SOCK_CLOSED:           /* if a socket is closed */
            if(!RadioSocket_status)
            {
                printf("\r\n%d : Loop-Back TCP Client Started. port: %d\r\n", s, port);
                RadioSocket_status = 1;
            }
            if(socket(s, Sn_MR_TCP, port++, 0x00) == 0)    /* reinitialize the socket */
            {
                printf("\a%d : Fail to create socket.",s);
                RadioSocket_status = 0;
                any_port=port;
            }
            break;
        case SOCK_INIT:     /* if a socket is initiated */
               connect(s, Dest_IP, Dest_PORT);
                break;
        default:
            break;
    }
}

6. Conclusion

First of all, this project is Beta version. I didn’t allocate the memory for saving internet radio server data. Therefore, It’s not perfectly working all internet radio channel.
But, WIZ550io is very easy solution for Internet Radio.
First, It’s easy to be porting in STM32F103RBT code. I just add 5~10 routine for SPI mapping.
Second, I have used the TCP Client example code. This is also open WIZnet homepage. I just added VS1033 play routine in TCP Client.
Anyway, when you open my source code, you’ll find what I mean.
If you want to IoT project or Network function, I would like to recommend a WIZnet solution.