@tellurium
Jyst FYI ...
I tried mongoose today, and was scratching my head a lot ... Using linux mint
It didn't work.
I have this board & programmer
https://www.aliexpress.com/item/1005005021450761.htmlCH32V307 EVT (by SCDZ, close to official W.CH board)
I tried a "blinky" ... worked
And then i discovered that the programmer also registers as /dev/ttyACM0
I fired up putty @115200 on ttyACM0
When programmed i see this
0 2 main.c:88:main Starting, CPU freq 144 MHz
6 2 main.c:102:main MAC: 02:38:32:38:39:e3. Waiting for IP...
3f5 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
7dd 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
bc5 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
fad 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
1395 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
177d 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
1b65 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
1f4d 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
2335 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
271d 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
2b05 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
2eed 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
32d5 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
36bd 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
3aa5 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
3e8d 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
4275 2 main.c:35:timer_fn Ethernet: down, IP: 0.0.0.0, rx:0, tx:0, dr:0, er:0
Nothing happened besides the above ....
Then i disconnected the Ethernet Jack , and reconnected
And it saw a mac address , and after a few seconds it got an IP
That method works .... Sometimes
What always work , is to press reset when it "doesn't see (show) the ethernet MAC.
0 2 main.c:88:main Starting, CPU freq 144 MHz
6 2 main.c:102:main MAC: 02:38:32:38:39:e3. Waiting for IP...
3ee 3 stm32.c:193:mg_tcpip_driver_st Link is 10M half-duplex
3f3 1 net_builtin.c:202:onstatechang Link up
3f7 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
3ff 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:0, tx:1, dr:0, er:0
7d6 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
7dd 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:0, tx:2, dr:0, er:0
bbe 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
bc5 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:0, tx:3, dr:0, er:0
fa6 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
fad 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:0, tx:4, dr:0, er:0
138e 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
1395 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:0, tx:5, dr:0, er:0
1776 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
177d 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:1, tx:6, dr:0, er:0
1b5e 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
1b65 3 net_builtin.c:281:tx_dhcp_requ DHCP req sent
1b6a 2 net_builtin.c:407:rx_dhcp_clie Lease: 6210 sec (6217)
1b70 2 net_builtin.c:197:onstatechang READY, IP: 10.117.10.210
1b75 2 net_builtin.c:198:onstatechang GW: 10.117.10.1
1b7b 2 net_builtin.c:199:onstatechang MAC: 02:38:32:38:39:e3
1b81 2 main.c:35:timer_fn Ethernet: ready, IP: 10.117.10.210, rx:4, tx:9, dr:0, er:0
1b8a 2 main.c:107:main Initialising application...
1b90 3 net.c:195:mg_listen 1 0 http://0.0.0.0
1b95 2 main.c:110:main Starting event loop
1f4d 2 main.c:35:timer_fn Ethernet: ready, IP: 10.117.10.210, rx:4, tx:9, dr:0, er:0
1adbd 2 main.c:35:timer_fn Ethernet: ready, IP: 10.117.10.210, rx:4, tx:8, dr:0, er:0
1b1a5 2 main.c:35:timer_fn Ethernet: ready, IP: 10.117.10.210, rx:4, tx:8, dr:0, er:0
1b58d 2 main.c:35:timer_fn Ethernet: ready, IP: 10.117.10.210, rx:4, tx:8, dr:0, er:0
1b975 2 main.c:35:timer_fn Ethernet: ready, IP: 10.117.10.210, rx:4, tx:8, dr:0, er:0
1bd5d 2 main.c:35:timer_fn Ethernet: ready, IP: 10.117.10.210, rx:4, tx:8, dr:0, er:0
1c145 2 main.c:35:timer_fn Ethernet: ready, IP: 10.117.10.210, rx:4, tx:8, dr:0, er:0
0 2 main.c:88:main Starting, CPU freq 144 MHz
6 2 main.c:102:main MAC: 02:38:32:38:39:e3. Waiting for IP...
3ee 3 stm32.c:193:mg_tcpip_driver_st Link is 10M half-duplex
3f3 1 net_builtin.c:202:onstatechang Link up
3f7 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
3ff 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:0, tx:1, dr:0, er:0
7d6 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
7dd 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:0, tx:2, dr:0, er:0
bbe 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
bc5 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:0, tx:3, dr:0, er:0
fa6 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
fad 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:0, tx:4, dr:0, er:0
138e 3 net_builtin.c:302:tx_dhcp_disc DHCP discover sent. Our MAC: 02:38:32:38:39:e3
1395 2 main.c:35:timer_fn Ethernet: up, IP: 0.0.0.0, rx:0, tx:5, dr:0, er:0
I see same issue when doing a Power Reset.
It doesn't see the link-up (Ethernet link) , until i press Reset button.
Does the ethernet link check start too fast ??Edit:
I have attached my Makefile (had to append .txt - to upload)
It uses the linux (wch clone) programmer :
https://github.com/cnlohr/ch32v003fun/tree/master/minichlink"clone" , build , and copy to "somewhere on path"
Note: There seems to be an issue w minichlink - It resets the chip to 288K/32K Flash/Ram partitioning
But ATM that's fine for mongoose.
https://blog.dan.drown.org/ch32v307-dev-board-part-5/I finally figured out that it was how minichlink was talking with the debugger. If I use wlink, the option bytes don't get overwritten. But wlink leaves my debugger hardware in some unknown state and I have to power cycle it to get the debugger working again. I've opened a github issue, and I want to try reverse engineering the WCH-LinkE protocol to see if I can figure out how to fix this.
There's a hack/fix here
https://www.eevblog.com/forum/microcontrollers/ch32v307-risc-v-minicore-with-ethernet/msg5195862/#msg5195862Edit2:
ddrown's lwip demo also needs an extra button reset to get an ip.
So it could be board related ... I'm using a HP 1820 switch, and have no issues w. that
/Bingo