Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support for RTL830xMB (RTL8304MB/RTL8306MB) (IDFGH-11144) #17

Open
DjordjeMandic opened this issue Sep 27, 2023 · 14 comments
Assignees

Comments

@DjordjeMandic
Copy link

I see good use for KSZ8863 driver. Similar driver for RTL8306MB would be nice because it is low cost and available and supports 100BASE-FX. Lot of 10/100M media converters use this chip. I see good use for integrated media converter and switch that also provides ethernet to ESP32. This is just cross post of IDFFGH-9043 because it doesn't belong there.

@github-actions github-actions bot changed the title [Feature Request] Support for RTL830xMB (RTL8304MB/RTL8306MB) [Feature Request] Support for RTL830xMB (RTL8304MB/RTL8306MB) (IDFGH-11144) Sep 27, 2023
@kostaond
Copy link
Collaborator

@DjordjeMandic thanks for the suggestion. Actually, I've been also thinking about extending the offer of supported switch chips. I'll investigate.

@kostaond
Copy link
Collaborator

@DjordjeMandic are you aware if any devbaord of RTL8306MB exists? It could potentially ease development otherwise custom board would have to be designed...

@DjordjeMandic
Copy link
Author

DjordjeMandic commented Sep 27, 2023

@kostaond it does not afaik. Currently biggest issue is that I just cannot find datasheet that contains description of registers for both RTL8304MB or RTL8306MB.

RTL8306E-CG seems to have well documented datasheet but its little bit different(2x RMII)
https://www.lcsc.com/product-detail/Ethernet-ICs_Realtek-Semicon-RTL8306E-CG_C129792.html
https://datasheet.lcsc.com/lcsc/1808291248_Realtek-Semicon-RTL8306E-CG_C129792.pdf

Maybe there is something on https://csdn.net/

@alexgoto
Copy link

@DjordjeMandic Hey. Were you unable to find the datasheet at the moment? I have same chip in one project and have the same problem. Link from lcsc.com not works for me, unfortunately. I use this as a reference datasheet and tried to check out registers manually, with gdb. First 5-or-6 registers have been the same as reference, but another values turned out to be different

@DjordjeMandic
Copy link
Author

I put this project on the hold for now because of missing documentation and free time.

Alternative that I found promising is Realtek-Unmanaged-Switch-Arduino-Library. Realtek_switch_hacking is good place to start. You might be able to find some useful info there.

Are you trying just to connect it and configure it as unmanaged or you're trying to use all of the features in it?

Gigabit ones have 8051 in them for managing(web interface and etc) but there is no RMII, only MII. (I don't know a lot about MII interface but I guess MII is pretty easy to implement but uses a lot of gpio. On other hand small cheap FPGA can bridge MII or even SMII from switch to RMII on ESP32)

@alexgoto
Copy link

alexgoto commented Mar 19, 2024

@DjordjeMandic thanks for reply. I'll study carefully into the links soon.

I trying to connect rtl8304mb to MCU with RMII for work with 2 ports. At the first view all works fine, but connection does not establish. And status register have 0 bit in Link Status.

image

I have found this project which includes realtek switch driver today. It contains some interesting addresses, which does not described in realtek datasheets. Additionally it have defines for RTL8305MB.

@alexgoto
Copy link

alexgoto commented May 3, 2024

@DjordjeMandic Hey. I have done work with the switch. Driver code from https://github.com/lloves/RTL8309M-RK3288-KERNEL-3.4 has been working fine for my purpose. In my free time I could try to contribute my results to the project. But unfortunately I don't have experience with ESP-IDF previously and I isn't having any ESP's chip at this moment, for testing. My project target MCU was Gigadevice.

@DjordjeMandic
Copy link
Author

That's awesome, at least we have confirmed info so porting should be easy. Does vlan tagging and untagging work?

@alexgoto
Copy link

alexgoto commented May 4, 2024

That's awesome, at least we have confirmed info so porting should be easy. Does vlan tagging and untagging work?

Yes. SDK API pdf at the link contains description for vlan functions of the driver. I used the default vlan config where PVID is 1 for all ports

@rikelme
Copy link

rikelme commented Dec 21, 2024

@alexgoto Hi there. We have a custom esp32 hw with the RTL8304MB chip on it. The ESP32 is connected to the RTL on 4th port (RMII Port), and there are 2 LAN connectors connected to the 1st and 2nd port. The first one would be used for the LAN connection, and the 2nd will allow other devices to connect to it and share the same LAN connection. In other words, a simple 2-port switch.
Would you be willing to help us make this work? Your contribution will remain in public domain, submitted here as a patch.

@rikelme
Copy link

rikelme commented Dec 22, 2024

@DjordjeMandic maybe you?

@alexgoto
Copy link

alexgoto commented Dec 22, 2024

@rikelme Hi. I can try to help you, but only "blindly" because I don't have a board with esp32 and rtl8304 at the moment.

@DjordjeMandic
Copy link
Author

Hi @rikelme,

I currently only have ESP32 NodeMCU modules, so I don’t have the necessary hardware for this project. Ideally, I would need a PCB with the RTL chip and ESP32, or a breakout board for the RTL chip with at least two RJ45 ports. Test points for the SMI interface would also be useful for debugging with a logic analyzer if needed.

It seems that @alexgoto has already identified some good reference materials, which is a great starting point. From my perspective, the next step would be to try configuring the RTL chip to see if RMII works correctly. If that works, writing a driver would be the logical next step to simplify future implementations.

By the way, have you tried anything yourself so far, or have you primarily focused on developing the hardware without diving into the software part yet? This would help us understand the current state of your project and where we might assist.

While I don’t have experience with ESP-IDF, I’m confident that the many available examples would make it feasible to learn. I’d be happy to assist with development where I can, but my availability is limited due to my current studies. Without the hardware, I won’t be able to test or debug directly, but I can offer guidance as needed.

@rikelme
Copy link

rikelme commented Dec 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants