This commit is contained in:
2024-10-14 13:44:21 +06:00
parent ff161486e1
commit 38bc6e225c
3 changed files with 11 additions and 9 deletions

View File

@@ -16,6 +16,7 @@
"dhcp.h": "c",
"debug.h": "c",
"systick.h": "c",
"timer.h": "c"
"timer.h": "c",
"stdint.h": "c"
}
}

View File

@@ -1,17 +1,19 @@
# ch32-node fw
fw for a ch32v203 node w/ w5500 ethernet
## current pain
## current
### 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??
[Enabling](https://git.hye.su/mira/ch32-node/src/branch/master/src/main.c#L54) the SysTick IRQ leads to a permanent hang of the socket.
- With a 1ms IRQ interval, the hang occurs at `DHCP_ACK` during the `check_DHCP_leasedIP` -> `sendto()` [ARP request](https://git.hye.su/mira/ch32-node/src/branch/master/lib/ioLibrary_Driver/socket.c#L563).
- With a 100ms interval, the hang occurs during the DNS request.
- With a 1s interval it works
- [Disabling SPI DMA](https://git.hye.su/mira/ch32-node/src/branch/master/src/w5500.c#L62) solves it (just commenting out `reg_wizchip_spiburst_cbfunc`), so it's most likely DMA related?
- SPI DMA only works with [prescalers](https://git.hye.su/mira/ch32-node/src/branch/master/src/spi_dma.c#L140) 8 and 64?
TODO: LA?...
## ~~previous pain (DNS Processing)~~
## ~~previous (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

View File

@@ -51,7 +51,6 @@ int main(void) {
// TODO: enabling any kind of SysTick IRQ literally causes the socket to hang forever
// with 1ms interval the hang is on DHCP_ACK, on check_DHCP_leasedIP -> sendto() ARP req
// with 1s it happens somewhere on DNS req
// wtf?
init_systick();
tim2_init();