2019-04-29 06:16 AM
Hello! I'm trying to connect my STM32F429 via ethernet to a PLC. It seems that this board is supporting a LAN8742A PHY. I generated the code with CubeMX selecting my nucleo board, then, I think that the initialitzation of all of the peripherials ( GPIO, DMA, USART... ) are correct.
I create a tcp_pcb like this:
struct tcp_pcb *echo_pcb;
echo_pcb = tcp_new();
then, if this tcp_pcb is not NULL I bind it:
err_t err;
err = tcp_bind(echo_pcb,IP4_ADDR_ANY,502);
and finally, if not exists an error, I put the tcp_pcb in LISTENING state.
echo_pcb = tcp_listen_with_backlog(echo_pcb,0xff);
The error comes when I try to bind a tcp_pcb. In my live watch debugger I see that the tcp_pcb doesn't have any ip addres. And when I put this tcp_pcb on LISTENING state, the ipaddres still 0. What this meens that I can't connect with my PC because I haven't any addres to connect.
After all of that, I put in my while(1) this function, waiting for a Client:
tcp_accept(echo_pcb);
Can anyone tell my what happen?
Thank you so much.
PS: sorry for my bad english.