Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Application for Network Interface through Ethernet with CYW943907AEVAL1F

lock attach
Attachments are accessible only for community members.

Application for Network Interface through Ethernet with CYW943907AEVAL1F

Anonymous
Not applicable

Introduction

This blog discusses about network interface through Ethernet with CYW943907AEVAL1F.

The CYW43907 integrates a high performance Ethernet MAC controller. The controller interfaces to an external PHY either over a

Media Independent Interface (MII) or a Reduced Media Independent Interface (RMII). The controller can transmit and receive data at

10 Mbps and 100 Mbps. Below table shows the signal descriptions for CYW43907 Ethernet MAC.

Signal Name
Type
Description
RMII_G_RXC I MII receive clock
RMII_G_COL I MII collision detection
RMII_G_CRS I MII carrier sense
RMII_G_TXC I MII/RMII transmit clock
RMII_G_TXD0 O MII/RMII transmit signal
RMII_G_TXD1 O MII/RMII transmit signal
RMII_G_TXD2 O MII transmit signal
RMII_G_TXD3 O MII transmit signal
RMII_G_RXD0 I MII/RMII receive signal
RMII_G_RXD1 I MII/RMII receive signal
RMII_G_RXD2 I MII receive signal
RMII_G_RXD3 I MII receive signal
RMII_MDIO I/O MII/RMII management data
RMII_MDC O MII/RMII management clock
RMII_G_TXEN O MII/RMII transmit enable
RMII_G_RXDV I MII/RMII receive data valid

 

Application

Download the attached zip file, extract to folder tcp_client_ethernet and add the folder to <WICED SDK>/43xxx_Wi-Fi/apps/snip.

tcp_client_ethernet.JPG

Open tcp_client_ethernet.c and follow application instructions mentioned in the source code.

Appl Instructions.JPG

Once the program is successfully compiled and downloaded. Observe the serial terminal for message logs.

serial terminal.JPG

At the same time observe the message logs of TCP echo server which looks as below,

tcp_server.JPG

Application Details

I. The macro TCP_SERVER_IP_ADDRESS in #define TCP_SERVER_IP_ADDRESS MAKE_IPV4_ADDRESS(192,168,1,2) definition contains the IP address of TCP echo server.

II. The device_init_ip_settings in the following declaration sets the provided IPv4 address to CYW943907AEVAL1F. Assign ip_address, netmask and gateway to device_init_ip_settings depending the on the gateway and netmask values of your AP/router.

      device_init_ip_settings.JPG

The netmask and gateway values can be found by using the command ipconfig  in the command window of PC (TCP Server) connected to the same AP as CYW943907AEVAl1F.

ipconfig_edited.jpg

III. wiced_core_init( ) initializes platform related APIs, RTOS functions and the device configuration table.

IV. wiced_network_init( ) initializes the network interface and creates packet pools for transmission and reception.

V. The API wiced_network_up( WICED_ETHERNET_INTERFACE, WICED_USE_STATIC_IP, &device_init_ip_settings ) brings up the network as WICED_ETHERNET_INTERFACE with the IP configuration as WICED_USE_STATIC_IP and initializes IP settings to device_init_ip_settings. IP configurations can be changed to WICED_USE_EXTERNAL_DHCP_SERVER_RESTORE or WICED_USE_EXTERNAL_DHCP_SERVER and NULL can be passed to wiced_network_up() instead of &device_init_ip_settings.

Note: The network IP configuration can be changed to WICED_USE_EXTERNAL_DHCP_SERVER_RESTORE or WICED_USE_EXTERNAL_DHCP_SERVER as below.

  1. wiced_network_up( WICED_ETHERNET_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER_RESTORE , NULL ), or
  2. wiced_network_up( WICED_ETHERNET_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER , NULL )

WICED_USE_EXTERNAL_DHCP_SERVER_RESTORE uses an external DHCP server and restores the last saved DHCP state. Since IP configuration is set to external DHCP server, NULL is passed instead of device_init_ip_settings in wiced_network_up () and device_init_ip_settings definition has to commented.

VI. The API wiced_tcp_create_socket( &tcp_client_socket, WICED_ETHERNET_INTERFACE ) creates a TCP socket over the network Ethernet interface.

VII. The API wiced_tcp_bind( &tcp_client_socket, TCP_SERVER_PORT ) binds tcp_client_socket to the local port TCP_SERVER_PORT (50007).

VIII. The API wiced_rtos_register_timed_event() registers a function that will be called at a regular interval.

IX. The API wiced_tcp_connect( &tcp_client_socket, &server_ip_address, TCP_SERVER_PORT, TCP_CLIENT_CONNECT_TIMEOUT ) establishes connection between client and server over predefined over defined ports.

X. The API wiced_packet_create_tcp(&tcp_client_socket, TCP_PACKET_MAX_DATA_LENGTH, &packet, (uint8_t**)&tx_data, &available_data_length) creates a TCP packet by automatically allocating memory for the tx_data.

XI. wiced_packet_set_data_end(packet, (uint8_t*)tx_data + strlen(tx_data)) sets the end of the data portion.

XII. The API wiced_tcp_send_packet(&tcp_client_socket, packet) sends the TCP data , if the data transmission fails the packet will be deleted by wiced_packet_delete(packet) and connection will be closed by wiced_tcp_disconnect(&tcp_client_socket).

XIII. The contents of the received packet will be retrieved by the API wiced_packet_get_data(). After retrieving the contents in rx_data[ ], packet will be deleted and connection will be disconnected.

XIV. AP and Ethernet could be brought up together by following the steps below.

     1. Define a variable for access point IP settings as below,

          ap_ip_settings.JPG

     2. Bring up network with interface as WICED_AP_INTERFACE, IP configuration as WICED_USE_INTERNAL_DHCP_SERVER and static IP interface as ap_ip_settings.

          ap network up.JPG

Attachments
2209 Views
Comments
Kevin_Lo
Employee
Employee
50 sign-ins 10 likes given First comment on KBA

Hi Everyone,

As requested from customer Is there someway that we can restrict the Ethernet speed to 100Mbps only from MII interface side?

Thanks and Regards,

Kevin

MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

The 43907 contains an Ethernet Mac only.  Within the customer's design, they should be able to strap the PHY to 10/100 mode.