diff --git a/.vscode/settings.json b/.vscode/settings.json index df05f40..a06ac45 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,6 +16,7 @@ "dhcp.h": "c", "debug.h": "c", "systick.h": "c", - "timer.h": "c" + "timer.h": "c", + "stdint.h": "c" } } \ No newline at end of file diff --git a/README.md b/README.md index 4e01787..46aec66 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/main.c b/src/main.c index 01aa937..1e75545 100644 --- a/src/main.c +++ b/src/main.c @@ -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();