cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO F429ZI Ethernet config on CubeMX

zamek42
Associate II
Posted on April 25, 2017 at 10:16

Hi All,

I am fighting with F429nucleo and ethernet interface. The example of firmware works well (lwip webserver).

There is a pin PG2 RMII_RXERR which I cannot configure with CubeMX.

On CubeMX PG2 cannot set to ethernet, but the firmware example does it set to ethernet alternate mode:

GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;

GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;

GPIO_InitStructure.Pull = GPIO_NOPULL;

GPIO_InitStructure.Alternate = GPIO_AF11_ETH;

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

  GPIO_InitStructure.Pin =  GPIO_PIN_2 | GPIO_PIN_11 | GPIO_PIN_13;

  HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);

Another problem is setting clocks. Example settings:

@brief  System Clock Configuration

  *         The system Clock is configured as follow :

  *            System Clock source            = PLL (HSE)

  *            SYSCLK(Hz)                     = 180000000

  *            HCLK(Hz)                       = 180000000

  *            AHB Prescaler                  = 1

  *            APB1 Prescaler                 = 4

  *            APB2 Prescaler                 = 2

  *            HSE Frequency(Hz)              = 8000000

  *            PLL_M                          = 8

  *            PLL_N                          = 360

  *            PLL_P                          = 2

  *            PLL_Q                          = 7

  When I set PLL_Q to 7, it has an error, at least 8 is acceptable, and the output clock will be 45Mhz instead of 48Mhz.

And example said:

*            VDD(V)                         = 3.3

  *            Main regulator output voltage  = Scale1 mode

  *            Flash Latency(WS)              = 5

Where can I set these properties in CubeMX?

thx Zamek

#ethernet #nucleo429
13 REPLIES 13
Flavio Alves
Associate II
Posted on May 07, 2017 at 05:38

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6s4&d=%2Fa%2F0X0000000bwz%2Fax9pHXr_XBH4YXlVlznwwmLdJVm80228MvcvHLvmHRQ&asPdf=false
Posted on May 11, 2017 at 08:12

Hi Flavio,

Yes this config works well:)

Thank you

Zamek

Posted on May 18, 2017 at 02:59

Hi Flavio

 I tried to use your .ioc for testing a simple tcp client with netconn api. I have started form the Demo project and I have tested my app and works fine. I am trying to implement the same application using cubemx for the obvious reasons and its been pretty painfull with all them bugs in lwip so far. Hope to provide some of your insight since you ve already been there. 

 First I generate code using your ioc file and I can succesfully ping the board. Then in the start thread after MX_LWIP_Init() I call my simple tcp client function inside a wile loop with a HAL_Delay of 1 sec

/* StartDefaultTask function */

void StartDefaultTask(void const * argument)

{

/* init code for LWIP */

MX_LWIP_Init();

/* USER CODE BEGIN StartDefaultTask */

HAL_Delay(1000);

while(1){

tcp_client_test();

HAL_Delay(1000);

}

/* Infinite loop */

for(;;)

{

osDelay(1);

}

/* USER CODE END StartDefaultTask */

}

My tcp_client_test function is as follows:

void tcp_client_test(){

unsigned char client_test_message[] = {

'T','E','S','T','M','S','S','G'};

struct netconn *conn;

err_t err;

/* Create a new TCP connection handle */

conn = netconn_new(NETCONN_TCP);

ip_addr_t ipaddr;

IP_ADDR4(&ipaddr,(uint8_t) 192,(uint8_t) 168,(uint8_t) 0,(uint8_t) 2);

/*connect to server*/

err = netconn_connect(conn, &ipaddr, 5001);

/*write a test message to server*/

netconn_write(conn, client_test_message, strlen((char*)client_test_message), NETCONN_COPY);

/* Close the connection */

netconn_close(conn);

/* delete connection */

netconn_delete(conn);

}

When the program reaches to 

conn = netconn_new(NETCONN_TCP) , It gets stuck. I did a trace of where the problem is, and the problem is when lwip_netconn_do_connect --calls--> tcp_output in line 1001  of tcp_output.c at: netif = ip_route(&pcb->local_ip, &pcb->remote_ip);

Any idea what the problem might or to what directio nI should probably look?

Thank you very much for your informative post and for your ioc file.

Aris

Posted on May 18, 2017 at 12:24

Hi there,

 As a reply to my self, so other people that come here wont do the same mistake, my obvious mistake was that I should have started a new thread for the tcp client function. Should have read UM1713 twice. I will make a small repo with the working tcp test client and share here later today. 

Cheers

Aris 

RBrag
Associate

Hi Flavio, your post can help me, I suppose, but has been removed...

It is possibile to get it back?

Flavio Alves
Associate II

Hello Roberto,

I don't think so, because I could't find it. :(

Sorry... Anyway, it seems to be an IOC file from STM32CubeMX.

For the above code, I believe that HAL_Delay() must be replaced by osDelay() or vTaskDelay(). I don't know if it is the cause of the problem...

I can use correctly a standard STM32CubeMX application using Nucleo-F429ZI and LWIP/FreeRTOS. I am using the latest version of everything (Cube, Hal, Atollic, ...).

And I am not using NETCONN library either. I am using socket api instead. Is it working very well.

Maybe it can help you.

Best regards,

Flavio

Hello,

I'm using STM32F429 nucleo-144 board trying to build and run the /home/user/en.STM32Cube_FW_F4_V1.24.0/STM32Cube_FW_F4_V1.24.0/Projects/STM32F429ZI-Nucleo/Applications/LwIP/LwIP_HTTP_Server_Netconn_RTOS application on target board.

I'm using eclipse IDE.

how to build and flash into target board?

how to configure the laptop IP and target board ?

Thanks in advance

chum
Associate II

Hello,

I'm using STM32F429 nucleo-144 board trying to build and run the /home/user/en.STM32Cube_FW_F4_V1.24.0/STM32Cube_FW_F4_V1.24.0/Projects/STM32F429ZI-Nucleo/Applications/LwIP/LwIP_HTTP_Server_Netconn_RTOS application on target board.

I'm using eclipse IDE.

how to build and flash into target board?

how to configure the laptop IP and target board ?

Thanks in advance

Hello,

Did you try to import the project on TrueStudio, compile and run the project to the target board?

It seems to work, if you do so.

Another approach would be create a new Cube project for your board and "manually import" the code related to the example to your new project.

Regards,

Flavio