_
This commit is contained in:
88
README.md
88
README.md
@@ -1,31 +1,18 @@
|
||||
```
|
||||
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
|
||||
# ch32-node fw
|
||||
fw for a ch32v203 node w/ w5500 ethernet
|
||||
|
||||
> 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
|
||||
```
|
||||
## current pain
|
||||
|
||||
### SysTick IRQ and DMA issue
|
||||
Enabling the SysTick IRQ leads to a permanent hang of the socket.
|
||||
- With a 1ms interval, the hang occurs at `DHCP_ACK` during the `check_DHCP_leasedIP` -> `sendto()` ARP request.
|
||||
- With a 1s interval, the hang occurs during the DNS request.
|
||||
- Disabling SPI DMA solves it (just commenting out `reg_wizchip_spiburst_cbfunc`), so it's most likely DMA related?
|
||||
- SPI DMA only works at SPI baud @ 8 or 64??
|
||||
|
||||
|
||||
## ~~previous pain (DNS Processing)~~
|
||||
solved by [patching](https://git.hye.su/mira/ch32-node/commit/259d63197e06c1a92b979490d4cd8f0fdb98f8d0#diff-6ba50689ba55dac7cfe3e9b011e594098c931e21) the korean bloatlib (`dns_makequery` in DNS.c)
|
||||
|
||||
w/ ch32v003fun
|
||||
|
||||
@@ -63,50 +50,3 @@ w/ WCH HAL (none-os).. I get a full response
|
||||
|
||||
- 27 bytes long
|
||||
- (Post `68 79 65`): `02 73 75 00 00 01 00 01`
|
||||
|
||||
## none-os
|
||||
|
||||
```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);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -59,7 +59,7 @@ void configure_network(void) {
|
||||
// Setup chip select and SPI callbacks
|
||||
reg_wizchip_cs_cbfunc(spi_select, spi_unselect);
|
||||
reg_wizchip_spi_cbfunc(spi_read_byte, spi_write_byte);
|
||||
reg_wizchip_spiburst_cbfunc(spidma_read_buffer, spidma_write_buffer);
|
||||
// reg_wizchip_spiburst_cbfunc(spidma_read_buffer, spidma_write_buffer);
|
||||
|
||||
uint8_t rx_tx_buff_sizes[] = {2, 2, 2, 2, 2, 2, 2, 2};
|
||||
wizchip_init(rx_tx_buff_sizes, rx_tx_buff_sizes);
|
||||
|
||||
Reference in New Issue
Block a user