How to set K60's IP address during using the ETHERNET function?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set K60's IP address during using the ETHERNET function?

1,159 Views
dingzhang
Contributor III

How to set K60's IP address during using the ETHERNET function?

Labels (1)
Tags (2)
17 Replies

155 Views
dingzhang
Contributor III

Really thanks all the bros to apply me~!

Here is my solution:

     Finally, I use the RT-OS call RT-Thread which is a Chinese MIT Lisence RTOS, carrying LWIP1.4.1 (this is an IP stack).

     Using this RTOS and the IP stack it includes, i managed to use the IPv4 protocol including TCP and UDP

Thanks agagin

0 Kudos

155 Views
trilokjt
Contributor III

Hi Ding

I have similar issue/problem I don't know much about Stack. Can you please tell me how you sorted out your problem. I only done Ethernet initialization part,Putting data into the buffer and enabling transmission & reception. How can I include TCP/IP stack in my project?

Thanks/Regards

Trilok JT

0 Kudos

155 Views
dingzhang
Contributor III

Hi bro,

     an ip stack is necessary. i suggest you finding an OS  with Lwip which is a kind of ip stack. An OS with an ip stack can help you

0 Kudos

155 Views
soledad
NXP Employee
NXP Employee

Hello Ding Zhang,

Are you using MQX or any Stack??

If you are using MQX, please chech the below threads

Retrieving dynamic IP using DHCP

How do you make a web server reachable through DNS (by name, not IP)


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

155 Views
dingzhang
Contributor III

Hello

     But I'm not using any OS or stack. I'm just using K60+Mac-PHY Chip+RJ45 Net Interface.

     How can I change the IP address of the K60 device in this situation?

     thx a lot.

ZHANG DING

0 Kudos

155 Views
mjbcswitzerland
Specialist V

Hi

The device doesn't have an IP address - the IP address is a software networking concept and can be IPv4 and/or IPv6.

Do you have any network stack at all?

Regards

Mark

Kinetis: µTasker Kinetis support

K60: µTasker Kinetis TWR-K60N512 support  / µTasker Kinetis TWR-K60D100M support  / µTasker Kinetis TWR-K60F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos

155 Views
dingzhang
Contributor III

Hello,

     When I want to send some IP Protocol Data from computer to K60, but in the IP Protocol Frame data, I need a aim IP address to send the data to.

     How can I do so without an aim IP address ( which is the IP address of K60 device)?

     I'm not using any network stack. just the PC linked to the K60 device via a PHY to MAC chip.

thanks a lot.

ZHANG DING

0 Kudos

155 Views
dave408
Senior Contributor II

Ding, if you are not using any network stack, how are you expecting to be able to make a connection to your K60?  There are several examples in the KSDK folder that you can use as a starting point.  For example, if you are using KDS 3.0 with KSDK 1.2, you can load the demo found at C:\Freescale\KSDK_1.2.0\middleware\tcpip\rtcs\examples\eth_to_serial\build\kds\eth_to_serial_twrk60d100m.  I don't know if your chip is the same as the one in the tower board, but this might still get you started.  Then you'd go to the project properties dialog, and change the CPU preprocessor definition to exactly match the one you are using on your board.  Are you using a custom PCB or a development / tower system?

155 Views
dingzhang
Contributor III

THANKS a lot for replying me.

     pastedImage_0.png

  1. this is the way I'm linking the net line from PC to my K60 PCB board. This PCB board is not officially developed.

      U can see the big DP83848c Chip in the middle, it is a chip for changing bit stream into a RMII data, which can fit K60's RMII interface. Is this something u call as the network stack?

  2. Can I set K60's IP address in this PCB or situation?

  3. By the way, I'm using IAR as developing environment.

0 Kudos

155 Views
dave408
Senior Contributor II

Hi Ding, first of all, I think you should unmark my answer as correct.  I haven't solved your problem, nor do I think I'm capable of offering a correct answer.  mjbcswitzerland or someone from FSL will be able to give you more detailed suggestions.

Some side comments:

  1. If your PCB is not one from FSL, you will probably have a hard time debugging anything unless you pick up a JTAG programmer
  2. IP addresses aren't set in hardware.  Using the network stack, which is software, you can set the IP address.  Since I don't know enough about ethernet programming, I have to use whatever FSL provides to me through the KSDK.  It looks like they support two PHY chips -- KSZ8041 and KSZ8081, so I use the KSZ8081.  Mark will be able to tell you for sure since his uTasker framework handles so many different peripherals.
  3. IAR has an ethernet demo available.  When I evaluated that IDE, I used it and it worked for my FRDM-K64F board.
0 Kudos

155 Views
dingzhang
Contributor III

Really thank you for your answering.

I've searched and read the datasheet and K60 Sub-Family Reference Manual for the whole day. I still can't find any clue for setting IP address.

So i believe i need an OS(like MQX) to run on K60 to set the IP address.

BTW, can you give me a link of the IAR Ethernet demo?

Thank you again for your help !

ZHANG DING

0 Kudos

155 Views
tsi-chung_liew
NXP Employee
NXP Employee

To use the Ethernet module, you need to have a some background knowledge of Open software interconnection Model (short OSI model) which composes of 7 layers - Physical, Data Link, Network, transport, session, Presentation and Application Layer. The users above had mentioned about software stack or OS such as MQX had the OSI model implemented. The snapshot of schematic you provided is the Physical and data link combined, all they do is ensuring transmit and receive 1's and 0's. The IP addr, data etc are all embedded in the 1's and 0's, that's why you will need a software stack to encode and decode them. Information about IPv4 can be found here: IPv4 - Wikipedia, the free encyclopedia

Here is the link to obtain the Kinetis SDK: Software Development Kit for Kinetis MCUs|Freescale There is a Ethernet software example for TWR-K61 or TWR-K60 platform.

As for the snapshot of the schematic, you need to refer to our TWR MCU (K60D or K61) and TWR-SER2 for proper signals connection.

Regards,

TsiChung

155 Views
mjbcswitzerland
Specialist V

Hi

This is one of the wierdest threads I have seen.

First of all I think that it will be worth reading at least the first three or four chapters of the classic book "TCP IP Illiustrated" TCP/IP Illustrated, Vol. 1: The Protocols (Addison-Wesley Professional Computing Series): W. Richard... so that at the basic terms and concepts are understood.

A few pointers :

1. Ethernet works with MAC addresses and not IP adresses. There is no such thing as an IP address for Ethernet (and Ethernet protocol)
2. Networking doesn't need IP, although nowadays most traffic is based on IP and so IP addreses are required. In fact it is possible to communicate between HW and PCs without IP addresses - one example is just using an Ethernet protocol as is done by uNetwork: http://www.utasker.com/docs/uTasker/uNetwork.PDF  which is incorporated in the uTasker stack and allows distributed processing in local networks (that is, a software runs on multiple processors/nodes as a single OS without the tasks involved needing to know on which physical nodes other OS tasks in the networked software are actually running on. It is possible to also communicate with PCs like this, although not using the typical IP ports which the vast majority of applications make use of.

3. Ethernet may also use multiple MAC addresses (some EMACs include multiple unicast MAC address support, which helps in such situations). Multicast MAC addresses are also often used in addition (typically together with IP though).

4. A network node based on IP will need an IP address. In the simpest case an IPv4 address. However often there wil be multiple IP addresses - a node can have multiple IP unicast IPv4 and/or IPv6 addresses if it wants (not to mention multicast group addresses). IPv6 will tend to have multiple IPv6 addresses - at least a link-local address and usually a global address too.

Since WANs still often don't support native IPv6 some sort of tunneling is often in operation which may be carrying IPv6 inside IPv4: http://www.utasker.com/docs/uTasker/uTaskerIPV6.PDF

So essentially no IP is needed for communication but for standard practial networking it makes sense to have also an IP network stack that will just allow everything to work for you when needed. Stacks vary in the number of protocols, features, versions of protocols etc. they support (there are thousands which are possible and some which are essential). Before making decisions on embedded networking on does need to know what one wants to be able to do....

Regards

Mark

Kinetis: µTasker Kinetis support

K60: µTasker Kinetis TWR-K60N512 support  / µTasker Kinetis TWR-K60D100M support  / µTasker Kinetis TWR-K60F120M support

IPv6: http://www.utasker.com/docs/uTasker/uTaskerIPV6.PDF

Multi-homed networking: http://www.utasker.com/docs/uTasker/uTaskerNetworking.pdf

Distributed System Networking: http://www.utasker.com/docs/uTasker/uNetwork.PDF

For the complete "out-of-the-box" Kinetis experience and faster time to market

155 Views
dave408
Senior Contributor II

This is where it is on my system: C:\ProgramData\IARSystems\EmbeddedWorkbench\DownloadedExamples\arm\7.30.3\Freescale\Kinetis\TWR-K64F120M\rtcs\examples\httpsrv

0 Kudos

155 Views
ndavies
Contributor V

DING, The network stack is software that is run on the K60. It contains all the software to communicate over Ethernet. You cannot just set an IP address and talk over Ethernet. It's way more complicated than that. You need a network protocol software stack to do it.

It is called a stack since it is designed in layers, each layer doing a specific function. This protocol stack can either be written by you, purchased or found online in open source software. There's a network stack included in MQX and the Kinetis SDK.

Norm

155 Views
ndavies
Contributor V

Zhang Ding, The Network stack provides the mechanisms to communicate with all the layers involved in TCP/IP over Ethernet including the MAC layers and the correct formation of the IP datagram. Your application will need to correctly call the functions in the network stack.

The network Stack requires functions normally provided by an operating system. The stack will need operating system support functions like allocating memory buffers, allocating Timers and registering interrupt functions. These don't need to be an actual OS. You just need to provide the functions to support this functionality.

MQX is an OS. Specifically a Real Time Operating System(RTOS). It provides both the network stack as well as the operating system support functionality. It is just one way to create your application. There are several free and commercial RTOS available. You could also write your own OS.

You will also need to use or create a protocol that is recognized by the device you are trying to talk to. Just setting an IP address and stuffing data into a datagram is not enough to get communications up between 2 devices.

Norm

155 Views
dingzhang
Contributor III

So,

     My best way to set the IP address is to use the Kinetis SDK to develop the software on K60, and run the MQX system on K60, which can have the TCP/IP protocol controller to set IP address and do the data receiving and transmitting, right?

     But if I'm not running any OS on K60. After setting some register, the K60 can work with the function of RMII data receiving and transmitting. All I need is an OS to deal with the data from MAC layer, like IP datagram, right?

ZHANG DING

0 Kudos