48 lines
2.5 KiB
Markdown
48 lines
2.5 KiB
Markdown
ENC28J60 requires SPI clk <= 20MHz
|
|
src.: [p.82] https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/39662e.pdf
|
|
|
|
You cannot attempt to send any information for ~300us after startup (7500 cycles of int osc).
|
|
|
|
"After a Power-on Reset, or the ENC28J60
|
|
is removed from Power-Down mode, the
|
|
CLKRDY bit must be polled before
|
|
transmitting packets, enabling packet
|
|
reception or accessing any MAC, MII or
|
|
PHY registers."
|
|
|
|
"four
|
|
banks, selectable by the bank select bits, BSEL<1:0>,
|
|
in the ECON1 register"
|
|
|
|
ENC28J60 has 8kB of RAM for in/out data buffers
|
|
We set the start/end addresses of the in/out sections manually (in the example: TX[0,0x600],RX[0x600,0x1fff])
|
|
|
|
The links to the microtechnics tutorial:
|
|
https://microtechnics.ru/stm32-i-ethernet-chast-1-podklyuchenie-i-nastrojka-enc28j60/
|
|
https://microtechnics.ru/stm32-i-ethernet-chast-2-enc28j60-priem-i-peredacha-frejmov/
|
|
https://microtechnics.ru/stm32-i-ethernet-chast-3-kanalnyj-uroven-protokol-arp/
|
|
https://microtechnics.ru/stm32-i-ethernet-chast-4-setevoj-uroven-protokoly-ip-i-icmp/
|
|
https://microtechnics.ru/stm32-i-ethernet-chast-5-transportnyj-uroven-protokol-udp/
|
|
|
|
Report errors detected by if((ReadControlReg(EIR) & EIR_TXERIF_BIT) != 0) in ENC28J60_TransmitFrame (desc. on p.5, Part 2 .pdf)
|
|
|
|
Wake-on-LAN can be configured for ENC28J60
|
|
|
|
ENC28J60 can somehow detect it's in a VLAN or that a frame was sent as multicast or broadcast (there's a bit in hte status bytesof a new frame)
|
|
|
|
For ENC28J60, probably, the frame length cannot exceed 1500B
|
|
|
|
In the IP header there's a field with information about network congestion (ECN - Explicit Network Congestion)
|
|
|
|
The ENC28J60 couldn't keep up, or synchronise the SPI3 clock at 11.25MHz (only the first ping succeeded), first tried reducing the SPI3 prescaler from 4 to 8, and it helped (though got 3000ms pings only),
|
|
but decided that 5.6MHz won't most likely be enough, so reconfigured the clock distr. to have 32MHz instead of 45MHz on APB1 bus,
|
|
so that the SPI3 clock would be 8MHz - worked perfectly, pings in 1.5ms.
|
|
|
|
IP and MAC addresses can be found in Libs/ENC28J60/src/lib_enc28j60.c
|
|
|
|
There appeared to be some extensive issues with the enc driver handling larger packets
|
|
the messages arrived in huge chunks - most of the enc's internal buffer got read.
|
|
It was determined that some known issues with the module existed, which were noted
|
|
in an errata to the docs. After quickly rewriting the driver - all the issues were
|
|
resolved and pings lied stably at 1.2ms without printfs and 34.4ms with debug messages.
|