Repository navigation
Conversation
74f0fe0 to
1789180
Compare
It works similar to `wifi` but the singleton is on the `board` module instead of `wifi`.
# Conflicts: # ports/zephyr-cp/internal-modules/circuitpython-kconfig/Kconfig
dhalbert
left a comment
There was a problem hiding this comment.
Thanks! Very clean code. A few things to address, including documentation.
| // This file is part of the CircuitPython project: https://circuitpython.org | ||
| // | ||
| // SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries | ||
| // | ||
| // SPDX-License-Identifier: MIT | ||
|
|
There was a problem hiding this comment.
The lines 1-6 header seems to have been deleted inadvertently.
| CFLAGS += -DCIRCUITPY_IO_IOBASE=$(CIRCUITPY_IO_IOBASE) | ||
|
|
||
| CIRCUITPY_IPADDRESS ?= $(CIRCUITPY_WIFI) | ||
| CIRCUITPY_IPADDRESS ?= $(call enable-if-any,$(CIRCUITPY_WIFI) $(CIRCUITPY_MII)) |
There was a problem hiding this comment.
how about making a CIRCUITPY_NETWORKING or CIRCUITPY_NETWORK which is $(call enable-if-any,$(CIRCUITPY_WIFI) $(CIRCUITPY_MII)) ? That can be used a number of places.
| //| """ | ||
| //| The `mii` module provides necessary low-level functionality for managing | ||
| //| wired ethernet connections through a Media-indepentent interface (MII) | ||
| //| bus. Use `socketpool` for communicating over the network. | ||
| //| | ||
| //| The `mii.Ethernet` object(s) are available as ``board.ETHERNET`` on boards | ||
| //| with onboard ethernet. The interface is enabled and DHCP is started | ||
| //| automatically. | ||
| //| """ | ||
| //| |
There was a problem hiding this comment.
This documentation should mention RMII.
| //| Boards with onboard ethernet provide it as ``board.ETHERNET``. On | ||
| //| Espressif ports, further interfaces can be created by wiring an external | ||
| //| RMII PHY and constructing `mii.RMII` from its wiring. The interface | ||
| //| is enabled and DHCP is started automatically. |
There was a problem hiding this comment.
This could use more explanation of MII vs RMII, including definitions and maybe what might be found on a board.
| //| """External RMII bus wiring for the built-in ethernet MAC. | ||
| //| | ||
| //| Pass the pins the PHY is wired to: ``mdc`` and ``mdio`` for its SMI, | ||
| //| ``rxd0``, ``rxd1`` and ``rx_dv`` into the MAC, ``txd0``, ``txd1`` and | ||
| //| ``tx_en`` out of it, ``refclk`` for the 50 MHz reference clock and, | ||
| //| optionally, ``reset`` for its active-low reset. The bus can be shared | ||
| //| by two `mii.Ethernet` interfaces on chips with more than one MAC; | ||
| //| the PHYs are distinguished by their MDIO ``device`` number. |
There was a problem hiding this comment.
Define RMII, and MDIO some more. This may be opaque to the average user.
| // The object is not zeroed on allocation. Without this, cert_buf.buf holds | ||
| // heap garbage, wrap_socket() takes that for a client certificate and feeds | ||
| // it to mbedtls_pk_parse_key(), which fails with MBEDTLS_ERR_PK_BAD_INPUT_DATA | ||
| // -- surfacing as the confusing "invalid key" on every default-context TLS | ||
| // connection (garbage is usually small ints; the exception only appears | ||
| // when the heap happens to hold nonzero junk, e.g. after other network use). |
There was a problem hiding this comment.
This is overly explanatory and sounds like "I fixed this bug". The point is that it's not initialized on allocation, but the fields must be initialized or bad values will be used.
MII is the family of bus protocols used to connect a SoC's MAC to an Ethernet PHY.
It works similar to
wifibut the singleton is on theboardmodule instead ofwifi.