what
This commit is contained in:
81
README.md
Normal file
81
README.md
Normal file
@@ -0,0 +1,81 @@
|
||||
```
|
||||
Registering W5500 callbacks...
|
||||
Calling wizchip_init()...
|
||||
Calling DHCP_init()...
|
||||
W5500 VERSIONR: 0x04
|
||||
Registering DHCP callbacks...
|
||||
Calling DHCP_run()...
|
||||
> Send DHCP_DISCOVER
|
||||
DHCP message : 192.168.102.1(67) 311 received.
|
||||
> Receive DHCP_OFFER
|
||||
> Send DHCP_REQUEST
|
||||
DHCP message : 192.168.102.1(67) 311 received.
|
||||
> Receive DHCP_ACK
|
||||
|
||||
> Check leased IP - OK
|
||||
Callback: IP assigned! Leased time: 10 sec
|
||||
IP: 192.168.102.113
|
||||
GW: 192.168.102.1
|
||||
Net: 255.255.255.0
|
||||
DNS: 192.168.102.1
|
||||
Calling wizchip_setnetinfo()...
|
||||
Calling DNS_init()...
|
||||
Resolving domain name "hye.su"...
|
||||
> DNS Query to DNS Server : 192.168.102.1
|
||||
> Receive DNS message from 192.168.102.1(53). len = 21
|
||||
> Partial DNS message: 11 23 81 82 00 01 00 00 00 00 00 00 03 68 79 65 00 00 00 02 73
|
||||
DNS_run() failed, res = 0
|
||||
```
|
||||
w/ ch32v003fun
|
||||
> Partial DNS message: `11 23 81 82 00 01 00 00 00 00 00 00 03 68 79 65 00 00 00 02 73`
|
||||
**DNS_run() failed, res = 0**
|
||||
|
||||
w/ WCH HAL (none-os).. I get a full response
|
||||
> Receive DNS message from 192.168.102.1(53). len = 56
|
||||
> Partial DNS message: `11 23 81 80 00 01 00 02 00 00 00 00 03 68 79 65 02 73 75 00 00 01 00 01 C0 0C 00 01 00 01 00 00 01 2C 00 04 68 15 33 7F C0 0C 00 01 00 01 00 00 01 2C 00 04 AC 43 B4 9A `
|
||||
Result: 172.67.180.154
|
||||
|
||||
```c
|
||||
// Initialize GPIO for W5500 CS
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
||||
GPIO_InitStructure.GPIO_Pin = W5500_CS_Pin;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(W5500_CS_GPIO_Port, &GPIO_InitStructure);
|
||||
|
||||
// ...
|
||||
static void MX_SPI1_Init(void) {
|
||||
/* SPI1 parameter configuration*/
|
||||
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
||||
SPI_InitTypeDef SPI_InitStructure = {0};
|
||||
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
|
||||
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
|
||||
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
|
||||
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; // SPI Mode 0 (CPOL=0, CPHA=0)
|
||||
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; // SPI Mode 0 (CPOL=0, CPHA=0)
|
||||
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
|
||||
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4;
|
||||
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
|
||||
SPI_InitStructure.SPI_CRCPolynomial = 7;
|
||||
SPI_Init(SPI1, &SPI_InitStructure);
|
||||
|
||||
SPI_Cmd(SPI1, ENABLE);
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user