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", "dhcp.h": "c",
"debug.h": "c", "debug.h": "c",
"systick.h": "c", "systick.h": "c",
"timer.h": "c" "timer.h": "c",
"stdint.h": "c"
} }
} }

View File

@@ -1,17 +1,19 @@
# ch32-node fw # ch32-node fw
fw for a ch32v203 node w/ w5500 ethernet fw for a ch32v203 node w/ w5500 ethernet
## current pain ## current
### SysTick IRQ and DMA issue ### SysTick IRQ and DMA issue
Enabling the SysTick IRQ leads to a permanent hang of the socket. [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 interval, the hang occurs at `DHCP_ACK` during the `check_DHCP_leasedIP` -> `sendto()` ARP request. - 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 1s interval, the hang occurs during the DNS request. - With a 100ms 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? - With a 1s interval it works
- SPI DMA only works at SPI baud @ 8 or 64?? - [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) solved by [patching](https://git.hye.su/mira/ch32-node/commit/259d63197e06c1a92b979490d4cd8f0fdb98f8d0#diff-6ba50689ba55dac7cfe3e9b011e594098c931e21) the korean bloatlib (`dns_makequery` in DNS.c)
w/ ch32v003fun 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 // 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 1ms interval the hang is on DHCP_ACK, on check_DHCP_leasedIP -> sendto() ARP req
// with 1s it happens somewhere on DNS req // with 1s it happens somewhere on DNS req
// wtf?
init_systick(); init_systick();
tim2_init(); tim2_init();