Skip to content

RMII 100M support#43

Open
soypat wants to merge 15 commits intomainfrom
rmii3
Open

RMII 100M support#43
soypat wants to merge 15 commits intomainfrom
rmii3

Conversation

@soypat
Copy link
Collaborator

@soypat soypat commented Jan 25, 2026

So last byte is processed weirdly, but rest of frame is transmitted via loopback correctly! We have working RMII in TinyGo!

 tinygo flash -target=pico -monitor -scheduler=tasks .
Connected to /dev/ttyACM0. Press Ctrl-C to exit.
=== RMII Loopback Test ===
PHY addr: 1 id: 7 49393 bmsr: 0x0000780d bmcr: 0x00002100
forced linkmode  100M-F
waiting for link...
.link up!
rx: got frame length  24
  MATCH: all bytes sent also received identically! length match: true
rx: got frame length  24
  MATCH: all bytes sent also received identically! length match: true
rx: got frame length  24
  MATCH: all bytes sent also received identically! length match: true
rx: got frame length  24
  MATCH: all bytes sent also received identically! length match: true
rx: got frame length  24
  mismatch, first 24 bytes
rx: 255 255 255 255 255 255 2 0 0 0 0 1 136 181 115 61 0 0 0 5 78 54 246 219 
tx: 255 255 255 255 255 255 2 0 0 0 0 1 136 181 115 61 0 0 0 5 78 54 246 243 
rx: got frame length  24
  MATCH: all bytes sent also received identically! length match: true
rx: got frame length  24
  mismatch, first 24 bytes
rx: 255 255 255 255 255 255 2 0 0 0 0 1 136 181 115 61 0 0 0 7 160 56 151 31 
tx: 255 255 255 255 255 255 2 0 0 0 0 1 136 181 115 61 0 0 0 7 160 56 151 223 
rx: got frame length  24
  MATCH: all bytes sent also received identically! length match: true
rx: got frame length  24
  MATCH: all bytes sent also received identically! length match: true
rx: got frame length  24
  MATCH: all bytes sent also received identically! length match: true
rx: got frame length  24
  MATCH: all bytes sent also received identically! length match: true

@soypat soypat mentioned this pull request Jan 25, 2026
@soypat soypat changed the title RMII try 3 RMII 100M support Jan 25, 2026
// Copyright (c) 2026 Patricio Whittingslow
asm.Pull(false, true).Side(0).Encode(),
asm.Set(pio.SetDestPins, mskTXEN).Side(0).Encode(),
// asm.WaitPin(polRising, 0).Encode(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have been removed?

// cfg.RefClk.Configure(pinCfg)
// Create state machine configuration.
txcfg := asm.DefaultStateMachineConfig(txoff, txprog[:])
// txcfg.SetInPins(cfg.RefClk, 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this left in intentionally?

// Use powers of two for freq to avoid slow divisions and rounding errors.
func ClkDivFromFrequency(freq, cpuFreq uint32) (whole uint16, frac uint8, err error) {
if freq == 0 {
return 1, 0, errors.New("ClkDiv: zero frequency")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

predefine error here?

@deadprogram
Copy link
Member

Is there a specific reason the examples/_rmii directory is named with an underscore?

@soypat
Copy link
Collaborator Author

soypat commented Feb 5, 2026

Is there a specific reason the examples/_rmii directory is named with an underscore?

To exclude it from the Go build system at the top module level. This prevents lneto appearing as a dependency of the pio package. Is there a better way?

Will address the rest of your comments in time. Still trying to figure out a way to go from 8% to ~0% packet loss regarding the PIO program comments

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments