K66 Ethernet initialize

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

K66 Ethernet initialize

1,377 Views
matyb
Contributor II

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.

Labels (1)
Tags (1)
0 Kudos
4 Replies

650 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi matyb:

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.

boards\frdmk66f\lwip_examples\lwip_udpecho

Regards

Daniel

0 Kudos

650 Views
mjbcswitzerland
Specialist V
0 Kudos

650 Views
matyb
Contributor II

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. */
#ifdef ENET_ENHANCEDBUFFERDESCRIPTOR_MODE
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 reserved0;
uint16_t controlExtend2; /*!< Extend buffer descriptor control2. */
uint32_t timestamp; /*!< Timestamp. */
uint16_t reserved1;
uint16_t reserved2;
uint16_t reserved3;
uint16_t reserved4;
#endif /* ENET_ENHANCEDBUFFERDESCRIPTOR_MODE */
} enet_rx_bd_struct_t;

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.

0 Kudos

650 Views
mjbcswitzerland
Specialist V

Hi

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.

Regards

Mark

0 Kudos