cancel
Showing results for 
Search instead for 
Did you mean: 

Creating STM32CubMX ioc project for nucleo-F746ZG eval board with ethernet

nadavpp
Associate III

I'm trying to get the ethernet working on the nucleo-F746ZG eval board.

I've found the LwIP_HTTP_Server_Netconn_RTOS example which works great
(first time EVER for me, that code on embedded device actually worked without spending several days to fix things : )
Now, I'm trying to reproduce the functionality in a project generated for IOC file,
And I can't get the ethernet to work.
I can see that the link status is OK, but I don't get replies from ping messages.

I've been trying to compare the code generated from the IOC to the code in the example,
and change the IOC to generate the same code, but so far without success.

Is there someplace where I can get an IOC file for nucleo-F746ZG eval board with ethernet enabled?

Thanks,

Nadav

 

 

11 REPLIES 11
FBL
ST Employee

Hello @nadavpp,

 

You can simply create the project from board selector and configure Ethernet in CubeMX.

  • Enable Ethernet peripheral in pinout view in RMII mode.
  • Enable Ethernet interrupt and set preemption priority.
  • Check Ethernet signals pins and make sure they are correctly placed.
  • Configure LWIP middleware.

However, to get this example working, you need to align it to the example.

 

Hope this helps!

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

nadavpp
Associate III

Hi @F.Belaid,

Thanks for your reply,
I've looked at the LwIP_HTTP_Server_Netconn_RTOS example (which works) and it configures the ethernet as RMII (the user manual also says that you need to configure the ethernet as RMII)

The CubeMX will not let me configure the ethernet as MII because it conflicts with PB0 which configured as IO (led1)

I've looked at the code of the LwIP_HTTP_Server_Netconn_RTOS and I noticed two things:

1. the ethernet interrupt is configured with priority 7 , in the CubeMX project the property is configured as 5 (and you can't change it.
I tried to manually change the code to priority 7, but it did not change anything.

1. it configures pin PG2 (as RMII_MII_RXER)
The RMII_MII_RXER definition does not exist in the CubeMX project, and as far I can see from the STM32 documentation there is NO alternate functionality for the pin in AF11 mode.

 

/* Ethernet pins configuration ************************************************/

/*

RMII_REF_CLK ----------------------> PA1

RMII_MDIO -------------------------> PA2

RMII_MDC --------------------------> PC1

RMII_MII_CRS_DV -------------------> PA7

RMII_MII_RXD0 ---------------------> PC4

RMII_MII_RXD1 ---------------------> PC5

RMII_MII_RXER ---------------------> PG2

RMII_MII_TX_EN --------------------> PG11

RMII_MII_TXD0 ---------------------> PG13

RMII_MII_TXD1 ---------------------> PB13

*/

/* Configure PA1, PA2 and PA7 */

GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;

GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;

GPIO_InitStructure.Pull = GPIO_NOPULL;

GPIO_InitStructure.Alternate = GPIO_AF11_ETH;

GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;

HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);

 

/* Configure PB13 */

GPIO_InitStructure.Pin = GPIO_PIN_13;

HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);

 

/* Configure PC1, PC4 and PC5 */

GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;

HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);

 

/* Configure PG2, PG11, PG13 and PG14 */

GPIO_InitStructure.Pin = GPIO_PIN_2 | GPIO_PIN_11 | GPIO_PIN_13;

HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);

 

Thanks,

Nadav

 

 

nadavpp
Associate III

Regarding the priority of the ethernet IRQ, I found where it's configured in CubeMX

Changed it to 7, still does not work :(

Nadav

Pavel A.
Evangelist III

@nadavpp You can download the schema of the board here: https://www.st.com/en/evaluation-tools/nucleo-f746zg.html#cad-resources  Unpack the zip and extract MB1137.pdf.

From this schema, indeed the RMII has only 9 lines and RMII_MII_RXER does not belong there.

#bugreport

 

Hello @Pavel A. ,

Thank you for bringing this issue to my attention.

I confirm and I reported Internally.

CubeMX related issue tracked under the number 158834. 

These are internal tracking numbers and are not accessible or usable by customers.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @nadavpp,

According to Interrupt priority, it should be 5 - preemption and 0 - subpriority. This is required by default for FreeRTOS configuration.

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

The requirement is to not exceed the priority level defined by the configMAX_SYSCALL_INTERRUPT_PRIORITY macro, not set it exactly at that value. And the number 5 is also just an arbitrary number taken from FreeRTOS examples, not a requirement.

For the author...

https://community.st.com/t5/embedded-software-mcus/how-to-make-ethernet-and-lwip-working-on-stm32/m-p/261456

 

nadavpp
Associate III

Looks like the problem I have is with sending packets:
I've added debug to the LWIP and I see that I get ping messages:

[2023-08-10 10:00:17.166] nucleo2
[2023-08-10 10:00:17.167] netif: netmask of interface  set to 255.255.255.0
[2023-08-10 10:00:17.173] netif: GW address of interface  set to 10.0.0.138
[2023-08-10 10:00:17.182] netif_set_ipaddr: netif address being changed
[2023-08-10 10:00:19.190] netif: added interface st IP addr 10.0.0.200 netmask 255.255.255.0 gw 10.0.0.138
[2023-08-10 10:00:19.197] netif: setting default interface st
[2023-08-10 10:00:25.904] ip4_input: p->len 60 p->tot_len 60
[2023-08-10 10:00:25.908] icmp_input: ping
[2023-08-10 10:00:25.908] ip4_output_if: st0
[2023-08-10 10:00:25.916] IP header:
[2023-08-10 10:00:25.916] +-------------------------------+
[2023-08-10 10:00:25.919] | 4 | 5 |  0x00 |        60     | (v, hl, tos, len)
[2023-08-10 10:00:25.919] +-------------------------------+
[2023-08-10 10:00:25.919] |    33170      |000|       0   | (id, flags, offset)
[2023-08-10 10:00:25.929] +-------------------------------+
[2023-08-10 10:00:25.929] |  255  |    1  |    0x0000     | (ttl, proto, chksum)
[2023-08-10 10:00:25.939] +-------------------------------+
[2023-08-10 10:00:25.939] |   10  |    0  |    0  |  200  | (src)
[2023-08-10 10:00:25.939] +-------------------------------+
[2023-08-10 10:00:25.941] |   10  |    0  |    0  |  123  | (dest)
[2023-08-10 10:00:25.951] +-------------------------------+
[2023-08-10 10:00:25.951] ip4_output_if: call netif->output()
 
I've enabled DEBUG on NETIF_DEBUG,ICMP_DEBUG,IGMP_DEBUG,INET_DEBUGIP_DEBUG
 
Thanks,
Nadav

 

Pavel A.
Evangelist III

What do you see with wireshark?