Hello, I was wondering if someone could point me to an example of how to initialize Ethernet to talk to my computer. I understand the basics of UDP (which is what I'm trying to use), however I can't figure out how to implement it. And I can't find much information out there about the fsl_enet.h, which is what I am attempting to use.
You can refer to the udpecho demo under the MCUXpresso SDK installation folder , it demonstrates a UDP echo demo on the lwip TCP/IP stack with bare metal KSDK or FreeRTOS. The application sends back the received UDP packets from the PC, which can be used to test whether a UDP connection is available.
Function description for UDP interface:
http://www.utasker.com/docs/Code.html -> TCP/IP -> udp.c
UDP multicast/IGMP: http://www.utasker.com/docs/uTasker/uTasker_IGMP.pdf
Including FRDM-K66 Ethernet simulator.
I downloaded it and been looking over it, however they're not using any of the libraries provided by freescale, which is what I'm attempting to do. They have quite a bit of code, too much. For example, I have this structure,
/*! @brief Defines the receive buffer descriptor structure for the little endian system.*/
typedef struct _enet_rx_bd_struct
uint16_t length; /*!< Buffer descriptor data length. */
uint16_t control; /*!< Buffer descriptor control and status. */
uint8_t *buffer; /*!< Data buffer pointer. */
uint16_t controlExtend0; /*!< Extend buffer descriptor control0. */
uint16_t controlExtend1; /*!< Extend buffer descriptor control1. */
uint16_t payloadCheckSum; /*!< Internal payload checksum. */
uint8_t headerLength; /*!< Header length. */
uint8_t protocolTyte; /*!< Protocol type. */
uint16_t controlExtend2; /*!< Extend buffer descriptor control2. */
uint32_t timestamp; /*!< Timestamp. */
#endif /* ENET_ENHANCEDBUFFERDESCRIPTOR_MODE */
But that's all I have, I'm not sure what control is supposed to be and I can't find any documentation about this. I am also only trying to find information about the K66 microcontroller, not the FRDM or TEENSY boards.
1. The Freecale libraries use an external TCP/IP stack, whereby the uTasker project has a fully integrated TCP/IP stack. These are therefore different code bases.
2. enet_rx_bd_struct_t is the Ethernet buffer descriptor which is described in the K66 user's manual in the Ethernet section. To use the enhanced buffer descriptor mode (which you show) it also needs to be configured by enabling it in the ECR register, after which you can also configure checksum offloading, which gives a performance advantage over software based IP/UDP check sums. You need to configure a series of such buffer descriptors in SRAM for transmitter and receiver (the manual also explains how to do it and it is essentially the same as Coldfire parts use to do it, but you will need to experiment to get it right if you don't use a working reference or simulation model).
3. The FRDM-K66F uses the K66 (as do teensy and tower boards) so they use the exact same code for Ethernet in all cases - in any case you also need an Ethernet PHY (the K66 doesn't include this), which also needs to be configured (including MII or RMII pin connections, plus a 25MHz or 50MHz synchronised clock) so you will certainly need to define the board (complete HW that you are using) before being able to do any such work with a K66.