EMAC driver for the ENC28J60 Ethernet controller. This is a simplified fork of https://github.com/tobiasjaster/ENC28J60-EMAC-Driver published by Tobias Jaster.
Dependents: MQTT_Hello MQTT_HelloENC28J60
EMAC driver for the ENC28J60 Ethernet controller
This is a fork (the INT and RST pins are not used) of the ENC28J60-EMAC driver published by Tobias Jaster at
https://github.com/tobiasjaster/ENC28J60-EMAC-Driver
Usage:
- Connect the ENC28J60 module to the Mbed board as follows:
- Import (add) this ENC28J60-EMAC library to your program.
- Add a "mbed_app.json" file with the following content to the root directory of your program:
{ "target_overrides": { "*": { "platform.callback-nontrivial": true, "enc28j60-emac.mosi": "D11", "enc28j60-emac.miso": "D12", "enc28j60-emac.sck" : "D13", "enc28j60-emac.cs" : "D10" } } }
- Replace "D11", ..., "D10" with the actual pin names you selected on the Mbed board to be used for the SPI communication.
- To set the MAC address define an array with the desired address bytes and call the "set_hwaddr(mac)" function before calling the network interface "connect" function.
For example:
const uint8_t MAC[6] = { 0, 1, 2, 3, 4, 5 }; EthernetInterface net; int main() { net.get_emac().set_hwaddr(MAC); // set MAC address if (net.connect() != 0) { printf("Error: Unable to connect to the network.\n"); return -1; } ...
mbed_lib.json@3:aa88808326b9, 2021-03-29 (annotated)
- Committer:
- hudakz
- Date:
- Mon Mar 29 08:37:01 2021 +0000
- Revision:
- 3:aa88808326b9
- Parent:
- 0:b599e748252c
Mbed OS Ethernet MAC (EMAC) driver for the ENC28J60 Ethernet controller. This a simplified fork of https://github.com/tobiasjaster/ENC28J60-EMAC-Driver published by Tobias Jaster.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:b599e748252c | 1 | { |
hudakz | 0:b599e748252c | 2 | "name": "enc28j60-emac", |
hudakz | 0:b599e748252c | 3 | "config": { |
hudakz | 0:b599e748252c | 4 | "mosi": { |
hudakz | 0:b599e748252c | 5 | "macro_name": "ENC28J60_MOSI", |
hudakz | 0:b599e748252c | 6 | "help": "Pin name connected to ENC28J60 SPI mosi", |
hudakz | 0:b599e748252c | 7 | "value": "SPI_MOSI" |
hudakz | 0:b599e748252c | 8 | }, |
hudakz | 0:b599e748252c | 9 | "miso": { |
hudakz | 0:b599e748252c | 10 | "macro_name": "ENC28J60_MISO", |
hudakz | 0:b599e748252c | 11 | "help": "Pin name connected to ENC28J60 SPI miso", |
hudakz | 0:b599e748252c | 12 | "value": "SPI_MISO" |
hudakz | 0:b599e748252c | 13 | }, |
hudakz | 0:b599e748252c | 14 | "sck": { |
hudakz | 0:b599e748252c | 15 | "macro_name": "ENC28J60_SCK", |
hudakz | 0:b599e748252c | 16 | "help": "Pin name connected to ENC28J60 SPI sck", |
hudakz | 0:b599e748252c | 17 | "value": "SPI_SCK" |
hudakz | 0:b599e748252c | 18 | }, |
hudakz | 0:b599e748252c | 19 | "cs": { |
hudakz | 0:b599e748252c | 20 | "macro_name": "ENC28J60_CS", |
hudakz | 0:b599e748252c | 21 | "help": "Pin name connected to ENC28J60 SPI cs", |
hudakz | 0:b599e748252c | 22 | "value": "SPI_CS" |
hudakz | 0:b599e748252c | 23 | } |
hudakz | 0:b599e748252c | 24 | } |
hudakz | 0:b599e748252c | 25 | } |