README.md
1# Scope
2This is a driver and network middleware for the MSP432E401Y microcontroller
3with built-in Ethernet MAC.
4
5# Prerequisites
6
7Ensure that driverlib for the MSP432E4 is installed and added to the include
8path for the project.
9
10# Recommendation
11When a MAC address changes or when there is a change in the network setup,
12it is recommended to perform a hard reset of the microcontroller in lieu
13of resetting only the MAC hardware.
14
15# List of Tasks
16
17The tasks listed in the table below are implemented internally by the driver (NetworkInterface.c).
18
19| Task Name | Purpose |
20|---------------------------------------|-------------------------------------------------------------------|
21| prvEMACDeferredInterruptHandlerTaskRX | RX Task |
22| prvEMACDeferredInterfaceOutputTaskTX | TX Task |
23| prvCheckLinkUpOrDownNetStateTask | Network State Checking Task (link up/down, network state & reset) |
24
25The tasks listed in the table below are implemented by additional code provided as an example
26related to how the driver might be used in an application (NetworkMiddleware.c).
27The additional code does not have to be used and is only provided to be useful.
28
29| Task Name | Purpose |
30|---------------------------------------|-------------------------------------------------------------------|
31| prvNetworkResetTask | Task to periodically reset the network (if required)
32
33# Example Code
34
35```
36#include "NetworkInterface.h"
37#include "NetworkMiddleware.h"
38
39void setup_wired_ethernet()
40{
41 struct InternalNetworkInterfaceMSP432EConfig config;
42 vGetInternalNetworkInterfaceMSP432EConfigDefaults(&config);
43 config.setMACAddrInternal = false; /* true if the MAC address is to be read from microcontroller flash */
44 config.MACAddr[0] = 0x70; /* replace with a custom MAC address */
45 config.MACAddr[1] = 0xFF;
46 config.MACAddr[2] = 0x76;
47 config.MACAddr[3] = 0x1C;
48 config.MACAddr[4] = 0xC1;
49 config.MACAddr[5] = 0xD0;
50 vPublicSetupEMACNetwork(config);
51
52 /* setup the network stack middleware */
53 const char *devname = "device";
54 struct InternalNetworkMiddlewareData setupData;
55 strncpy(setupData.deviceName, devname, strlen(devname));
56 setupData.resetNetworkTaskEveryXSeconds = 86400; /* Restart the network every 24 hours (86400 seconds) only when setupData.resetNetworkTaskRunning == true */
57 setupData.resetNetworkTaskRunning = false; /* Run the network task to reset the network every so often (i.e. to periodically obtain a new IP address) */
58
59 /* set the static IP address */
60 vConvertOctetsToAddr(setupData.ucIPAddress, 192, 168, 1, 9);
61 vConvertOctetsToAddr(setupData.ucNetMask, 255, 255, 255, 0);
62 vConvertOctetsToAddr(setupData.ucGatewayAddress, 192, 168, 1, 1);
63 vConvertOctetsToAddr(setupData.ucDNSServerAddress, 192, 168, 1, 1);
64
65 vPublicSetupFreeRTOSTasks(setupData);
66 /*
67 Start the RTOS scheduler by calling vTaskStartScheduler()
68 Use publicPreventNetworkReset() to block the network reset during a critical section of the code
69 Set the device name using vPublicSetupDeviceName()
70 */
71}
72
73```
74# Contact
75Nicholas J. Kinar (n.kinar@usask.ca) or FreeRTOS Forums
76