messani / pico-lan8720

Creative Commons Zero v1.0 Universal
16 stars 1 forks source link

DP83848 doesn't want to work #3

Open MicroKoder opened 2 years ago

MicroKoder commented 2 years ago

Hi! I'm trying this example with another PHY - DP83848. It works well with this example: https://github.com/sandeepmistry/pico-rmii-ethernet It sends DHPC requests, i see it in wireshark and router logs, but it doesn't receive data. I tried to dump received data to serial port. All bytes is received and match with wireshark, but all packages have same size - 1518 bytes and they are not splitted. I always see this message in serial output: "invalid packet received (crc)" could you help me, what can be wrong?

messani commented 2 years ago

Hi... I don't think that I can help you. This was only an experiment. I do not have even tools to measure signals (I only have cheap 24MHz analyzer from china which only works at cca 8MHz). This code was made by method of trial and error.

I use this ethernet module in my another experiment and I found several bugs in this code. 1) It is probably necessarry to clear interrupts before call pio_sm_init() in lan8720_rx.pio

+    // Clear IRQ flag before starting
+    hw_clear_bits(&pio->inte0, 1u << sm);
+    hw_clear_bits(&pio->inte1, 1u << sm);
+    pio->irq = 1u << sm;

This was inspired by example code pio-examples/pio/i2c.pio

2) when reading data through RMII interface, bit must be read right after falling edge(). I do not know why this worked at this project, but I got readings which was shifted by 1 bit in another project.

I don't think that any of these thinks will help you. You wrote that all messages have 1518 bytes. Are they full of zeros (I suppose that there are no traffic at network)? Or are they padded to 1518 bytes? I guess there is something wrong with configuration of CRS pin.

MicroKoder commented 2 years ago

sorry, I was wrong. The package size is correct, but every received package fails crc check. Several bytes received is different with wireshark

messani commented 2 years ago

Try to increase RPi Pico clock. Or change wires between pico and DP83848. Or you can debug it and check what the problem is. Whether it is changed bit, or data are shifted. If data are shifted, increasing clock could help. If a bit is changed, there can be problem with wiring.