Wiznet makers

teddy

Published August 31, 2023 ©

97 UCC

8 WCC

73 VAR

0 Contests

0 Followers

0 Following

STM32H723 W6100 BUS Loopback Program

STM32H723 W6100 BUS Loopback Program

COMPONENTS
PROJECT DESCRIPTION

1. Hardware setting

1) Physical connection picture

 

 

2) Pin connection

 

 

 

2. software setting

1) FMC set

Address and data pin settings are as follows. Write operation must be enabled to write data. It is possible to efficiently transmit and receive data by reducing the length of the signal by reducing the timing setting.

 

 

2) M7 Cache set

Enable CPU DCache and set MPU Control as follows.

Set Base Addr to 0x60000000, FMC addr, set size to 64KB, and change Access Permission as follows to make access possible.

 

 

3. code edit

1) Io6Library set

Right-click on the project and you will see the menu below. Click properties.

 

Under Source Location, select Link Folder

Select the check box for Link to folder. Press Variables to select PROJECT_LOC. From here, enter the location of the io6 Library. Type a folder name above.

 

Select the 'Includes' window and add the path as shown below.

 

2) main code

- include

#include "stdio.h"
#include "w6100.h"
#include "wizchip_conf.h"

- net info data

wiz_NetInfo gWIZNETINFO = { .mac = {0x00,0x08,0xdc,0x34,0x56,0x78},
.ip = {192,168,15,111},
.sn = {255, 255, 255, 0},
.gw = {192, 168, 15, 1},
.dns = {168, 126, 63, 1},
//.dhcp = NETINFO_STATIC,
.lla={0xfe,0x80,0x00,0x00,
0x00,0x00, 0x00,0x00,
0x02,0x08, 0xdc,0xff,
0xfe,0x57, 0x57,0x25}, ///< Source Link Local Address
.gua={0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00}, ///< Source Global Unicast Address
.sn6={0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 }, ///< IPv6 Prefix
.gw6={0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00} ///< Gateway IPv6 Address
};
uint8_t WIZ_Dest_IP_virtual[4] = {192, 168, 0, 230}; //DST_IP Address
uint8_t WIZ_Dest_IP_Google[4] = {216, 58, 200, 174}; //DST_IP Address
uint8_t mcastipv4_0[4] ={239,1,2,3};
uint8_t mcastipv4_1[4] ={239,1,2,4};
uint8_t mcastipv4_2[4] ={239,1,2,5};
uint8_t mcastipv4_3[4] ={239,1,2,6};
uint16_t WIZ_Dest_PORT = 15000; //DST_IP port
#define ETH_MAX_BUF_SIZE	1024

- W6100 R/W Function

void W6100BusWriteByte(uint32_t addr, iodata_t data)
{
(*(__IO uint8_t *)((uint32_t)(addr)) = (data));
}
iodata_t W6100BusReadByte(uint32_t addr)
{
ret = *(__IO uint8_t *)(addr);
return ret;
}

- W6100 Initialize

void W6100Initialze(void)
{
//W6100Reset();
#if _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_SPI_
/* SPI method callback registration */
#if defined SPI_DMA
reg_wizchip_spi_cbfunc(W6100SpiReadByte, W6100SpiWriteByte, W6100SpiReadBurst, W6100SpiWriteBurst);
#else
reg_wizchip_spi_cbfunc(W6100SpiReadByte, W6100SpiWriteByte, 0, 0);
#endif
/* CS function register */
reg_wizchip_cs_cbfunc(W6100CsEnable, W6100CsDisable);
#else
/* Indirect bus method callback registration */
#if defined BUS_DMA
reg_wizchip_bus_cbfunc(W6100BusReadByte, W6100BusWriteByte, W6100BusReadBurst, W6100BusWriteBurst);
#else
reg_wizchip_bus_cbfunc(W6100BusReadByte, W6100BusWriteByte, 0, 0);
#endif
reg_wizchip_cs_cbfunc(W6100CsEnable, W6100CsDisable);
#endif
uint8_t temp;
unsigned char W6100_AdrSet[2][8] = {{2, 2, 2, 2, 2, 2, 2, 2}, {2, 2, 2, 2, 2, 2, 2, 2}};
uint16_t RegTemp = 0;
//RegTemp = (uint16_t)WIZCHIP_READ(_CIDR_);
//printf("CIDR_ = %04x \r\n", RegTemp);
RegTemp = getCIDR();
printf("CIDR = %04x \r\n", RegTemp);
RegTemp = getVER();
printf("VER = %04x \r\n", RegTemp);
#if 0 //teddy st
do
{
if (ctlwizchip(CW_GET_PHYLINK, (void *)&temp) == -1)
{
printf("Unknown PHY link status.\r\n");
}
} while (temp == PHY_LINK_OFF);
#endif
printf("PHY OK.\r\n");
}

- main Function

W6100Initialze();
ctlwizchip(CW_SYS_UNLOCK,& syslock);
ctlnetwork(CN_SET_NETINFO,&gWIZNETINFO);
printf("Register value after W6100 initialize!\r\n");
print_network_information();

- loopback

loopback_tcps(0,ethBuf3,50003,AS_IPV4);

4. Test

1) Program log

 

 

2) hercules TCP Client Test

 

 


 

Documents
  • W6100 bus

Comments Write