cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Echo Client example for Nucleo-STM32F429ZI

Fahad Mirza
Associate II

I have Nucleo-STM32F429ZI board. STM32F4Cube only has one LwIP example for this board. But, I found more LwIP examples for the STM324x9I_Eval board. Now, I am trying to convert one of the Eval examples for the Nucleo board, specifically TCP Echo Client example.

Eval uses MII and DP83848, whereas Nucleo uses RMII and LAN8742A. I saw these are configured in the 'low_level_init()' (ethernetif.c).

Are these the only two configurations that I need to change? Or is there anything else I am missing?

Note: I was able to run the Nucleo example successfully. But that example uses RTOS. Right now, I am trying to use the RAW API, hence trying to convert the Eval example.

Disclaimer: I am new to Ethernet. So this might sound like a stupid question.

8 REPLIES 8
Geraldo Pereira
Associate II

0693W000004JxdaQAC.pngHi Mirza,

I´m trying run the the LwIP example in my board STM32F429ZI board. I following the steps:

1) In STM32CubeMX I selected the board STM32F429ZI and the example LwIP_HTTP_Server_Netconn_RTOS, using example selector. I export and import the project to a SW4STM32 workspace.

2) I can compile the project without error, but when I tryied run it I got the following error:

Configure inet adress 'Not IP fond' is not reachable

Please update correspondenting debug Configuration.

Did you get this error? Could you please, help me?

I´m working with this board and I´ll study and we can share experience.

Thanks,

Geraldo.

Fahad Mirza
Associate II

Hi Geraldo,

First of all I used STM32CubeIDE and not SW4STM32. But that shouldn't be a problem I hope. STM32CubeMX is integrated with the STM32CubeIDE and in there I chose Nucleo-F429ZI instead of the IC itself, STM32F429ZI. That will automatically initialize the required peripherals for that board.

Did you read the "readme.txt"?

How are you communicating with the PC from Nucleo Board? Directly (using crossover ethernet cable) or through router (using straight ethernet cable)?

Are you configuring a static IP address for your PC?

If you are interested about Raw API, I was able to convert an example for Nucleo-F429ZI:

https://github.com/mirzafahad/nucleo_stm32f429zi_lwip_examples

Geraldo Pereira
Associate II

Hi Misra,

I´ve tested a lot of IDE and now I´m using STM32CubeIDE. I have two boards: NUCLEO-F429ZI and NUCLEO-F767ZI. See bellow my tests and results:

1) I don´t have and I´m not using a crossover. Meu laptop and the board are connected through router (using straight ethernet cable). I´m using a USB cable to connect and communicating with the board from my laptop.

2) I´ve downloaded yours examples. I´ve just tested with static IP. But after load the code I can´t ping the static IP of the board. I´ve tested using DHCP, but it does´s run. In the router interface, I could not see the IP adress configured in the board.

3) Do you know this Piranha's program to tes F767 boards? See:

https://community.st.com/s/question/0D50X0000AhNBoWSQW/actually-working-stm32-ethernet-and-lwip-demonstration-firmware

When I use Piranha´s demonstration firmware with my board F767, the board get a dynamic IP and I can see it in the router interface. But I can´t run the same test with the LwIP examples. It doesn´t run in my machine. It compile, but the IP adress can´t be associate (static or dinamic). So I think there is a configuration problem with LwIP programs examples.

Do you have some hint?

And finally, I´m with a great problem. I´ve to do a program to read 3 ADCS using DMA. After I´ve to assebly a message in json format, for example, and send it to a remote server using sockets. Do you think I can get sucess using thises boards? F429 or F767? My time is wasting and I´ve to run this prototype to finish my PHD´s projetc. Today I´ve to finish other tasks, but I´ll continue testing the boards.

Thanks,

Geraldo.

Geraldo Pereira
Associate II

Hi Mirza,

I´ve just downloaded your examples, thanks. I could compile and load yours examples. But I could not see it run. I tried with static and dynamic IP, but it doesn´t run.

Are there any needed configuration in the board´s jumpers? I´m using he default jumpers configuration (JP6 ON and Jp7 ON).

Today I´ve reinstalled the "LwIP_HTTP_Server_Netconn_RTOS" example with meu board. It compiled and load sucessfull, but I could not run it. I can not see an IP adress assigned to the board.

Do you have any hint? My next step is test with a crossover cable.

Thanks,

Geraldo.

Fahad Mirza
Associate II

Hi Geraldo,

Did you have a chance to read the pdf that is in the "Doc" folder on my repo? Chapter 6 shows how to setup your hardware for the examples.

The example shows how you can communicate between server and client, using a tool called echotool, running on your PC (windows only). You can download the tool from here:

https://github.com/pbansky/EchoTool/releases/download/v1.5.0.0/echotool.exe

Let me know if that works.

Geraldo Pereira
Associate II

Hi Mirza,

I´ve downloaded the echotool.exe tool. But I could not run the example. It compile, load, but the IP address is not assigned. So I followed the tutorial:

https://github.com/martinbrickey/lwip/blob/master/STM32%20Ethernet%20Start%20Point%2020180307.pdf

And I could run the example with static and dynamic IP. So I´ll read the "Doc" document carefully again to compare and see what can be wrong. And I´ll repeat all process again.

Do yours examples implement TCP´s socket?

I´m reading the book "Mastering STM32" to learn more about the hardware. And I hope implement a full application with ADC, DMA, Socket and json with my F429ZI or F767ZI board. What do you think? Is it possible?

Thanks,

Geraldo.

Fahad Mirza
Associate II

If you have time constraint I would suggest you to utilize the STM32CubeMX. It comes with lots of examples for all the peripherals you mentioned. You can literally copy the examples and make necessary adjustments according to your needs. Instead of learning everything down to register level.

I have written an end-to-end application where the client (e.g. the Nucleo board) send information to a server (e.g. your pc) on a specified port. From there I had an Python application that utilizes the socket to read those information. Your requirements sound familiar to that. So, of course this is possible.

If you were able to run the example from the link you mentioned than you have done half the battle, congratulations.

Again, STM32CubeMX uses HAL(Hardware Abstraction Layer) libraries, that makes it easy to use STM32 microcontrollers and not bogged down to every details. HAL does what the name suggests, abstracting the hardware details from you, so that you can concentrate on your application. So go through that route and when you actually need to optimize something, than go through the datasheet or Mastering STM32.

Hope this helps.

Hi Mirza,

Thanks you by your help and hints. By now, I´m using STM32CubeMX and STM32CubeIDE. I´ll study the examples and try to make the necessary adjustments.

By the way. In your application using socket are using STM raw API or other implementation like Berkeley-alike socket API? I´m new with theses techologies, so its appeared some confunsing to me.

Do you have any tutorial to implement specific sockets program to STM32F429ZI or STM32F767ZI? I´m reading the standard doc of LwIp, but a lot of examples´s code doesn´t have familiar sintaxe, i.e, its appear to me that it was programmed and tested with another board.

Thanks in advanced,

Geraldo.