Skip to main content
Explorer II
July 16, 2025
Question

STM32F769BIT custom board - Ethernet issue

  • July 16, 2025
  • 13 replies
  • 1469 views

Hi Team,

I made a custom board using STM32F769BIT microcontroller using with the DP83867 PHY in MII mode, but I am not able to ping it. What could be the possible reasons? 

I did Memory configurations for TxDecrip, RxDecrip, LwipHeap like this.

.lwip_sec (NOLOAD) :

. = ABSOLUTE(0x2007C000);

*(.RxDecripSection)

. = ABSOLUTE(0x2007C0A0);

*(.TxDecripSection)

. = ABSOLUTE(0x2007C140);

*(.LwIPHeap)

also my SRAM configuration is like this_

MEMORY

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 496K

SRAM2 (xrw) : ORIGIN = 0x2007C000, LENGTH = 16K

FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K

I am using the 10pin STM32 debugger, but I am not able to see the stack usage there, when I press the debug button.

Is it due to code or due to the debugger? For this should I need the 20pin debugger?

 

Thanks,

Sayan Das

 

    This topic has been closed for replies.

    13 replies

    Graduate
    July 16, 2025

    Does you code work on a validated board, like a Nucleo one (obvious, with legacy PY interface)?

    This should tell if is a PHY problem or a coding problem.

     

    Graduate
    July 16, 2025

    A) your board is defective

    B) your code is wrong

    which one is your case?

    Get one board 100% tested and test your code - later you can test your hw !!

    Super User
    July 25, 2025

    @mbarg.1 wrote:

    A) your board is defective

    B) your code is wrong


    Or both!

    @Sayan  Hence the importance of starting on a known-good board - such as a Nucleo.

    The advantage of using an ST board in particular is that it will be well-known by people here.

    SayanAuthor
    Explorer II
    July 16, 2025

    I don't have nucleo board. Is there any way to debug? 

    Technical Moderator
    July 16, 2025

    Hello @Sayan, and Welcome to the community!

    To maximize your chances of finding a solution, please refer to How to write your question to maximize your chances to find a solution for best practices.

    In particular, please include the following details in your post:

    • A schematic showing how your device is connected since you are using a custom board
    • Clear photos of your setup
    • A description of the testing, investigation, or debugging you have performed so far
    • (Optional) STM32CubeMX configuration file (.ioc)

    Providing this information helps the community assist you more effectively.

    Best regards,

    Super User
    July 16, 2025

    As @STackPointer64 said, more info is needed.

    You haven't said what IP stack you're using - they usually have options for diagnostic output to help debug...

     


    @Sayan wrote:

    I am using the 10pin STM32 debugger


    But have you correctly wired it?

    That's why showing your schematic is essential!

     

    How have you validated your DP83867 design? Previous discussions relating to DP83867:

    https://community.st.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false&q=DP83867%20

     

    PS:

    Have you checked-out TI's Product Page for the DP83867 - I can see a couple of debugging/troubleshooting guides there:

    https://www.ti.com/product/DP83867E#tech-docs

    https://www.ti.com/product/DP83867E#software-development

    SayanAuthor
    Explorer II
    July 25, 2025

    I am attaching my hardware schematic for the board. The HW is fine. I used LWIP for getting the ethernet. I am sharing in details. The issue isn't solved yet.

    SayanAuthor
    Explorer II
    July 25, 2025

    I am describing my settings here -  in ETH, my mode is MII. In the Eth parameter settings, Tx and RX Descriptor Lenth is 4 and Rx Descriptor address is 0x2007c000, and Tx Descriptor address is 0x2007c0a0. The RX mode is Interrupt.

    I have varrified the GPIOs. The GPIO connection is fine.

    In the NVIC interupt table the Ethernet Global Interrupt is checked, but ethernet wake-up interrupt through EXTI line 19 is not checked.

     

     

    In the FREERTOS, CMSIS_V1 interface is selected. Else others are as it is.

     

     

    In LWIP Settings, in general settings, LWIP_DHCP is disabled and I put the static IP. IP_Address is 172.16.000.100, Netmask_Address is 255.255.000.000 and gateway_address is 172.16.0.1. I incresead the heap memory size to 16000 bytes and the address of LWIP_RAM_HEAP_POINTER is 0x2007c140. From the checksum option the CHECKSUM_BY_HARDWARE is enabled. The only platform option was DP83848. Other things are unchanged.

     

     

    After that I generate the code. 

    This is the configuration.

    Is everything fine?

     

    SayanAuthor
    Explorer II
    July 25, 2025

    My main.c looks like this.

    #include "main.h"
    
    #include "cmsis_os.h"
    
    #include "lwip.h"
    
    
    
    UART_HandleTypeDef huart6;
    
    
    
    osThreadId defaultTaskHandle;
    
    
    
    void SystemClock_Config(void);
    
    static void MPU_Config(void);
    
    static void MX_GPIO_Init(void);
    
    static void MX_USART6_UART_Init(void);
    
    void StartDefaultTask(void const * argument);
    
    
    
    int main(void)
    
    {
    
    
    
    MPU_Config();
    
    
    
    HAL_Init();
    
    
    
    SystemClock_Config();
    
    
    
    MX_GPIO_Init();
    
    MX_USART6_UART_Init();
    
    
    
    osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 256);
    
    defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
    
    
    
    osKernelStart();
    
    
    
    void SystemClock_Config(void)
    
    {
    
    RCC_OscInitTypeDef RCC_OscInitStruct = {0};
    
    RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
    
    
    
    HAL_PWR_EnableBkUpAccess();
    
    
    
    __HAL_RCC_PWR_CLK_ENABLE();
    
    __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
    
    
    
    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
    
    RCC_OscInitStruct.HSIState = RCC_HSI_ON;
    
    RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
    
    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
    
    RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
    
    RCC_OscInitStruct.PLL.PLLM = 8;
    
    RCC_OscInitStruct.PLL.PLLN = 216;
    
    RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
    
    RCC_OscInitStruct.PLL.PLLQ = 2;
    
    RCC_OscInitStruct.PLL.PLLR = 2;
    
    
    
    if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
    
    {
    
    Error_Handler();
    
    }
    
    
    
    if (HAL_PWREx_EnableOverDrive() != HAL_OK)
    
    {
    
    Error_Handler();
    
    }
    
    
    
    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
    
    |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
    
    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
    
    RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
    
    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
    
    RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
    
    
    
    if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK)
    
    {
    
    Error_Handler();
    
    }
    
    }
    
    
    
    static void MX_USART6_UART_Init(void)
    
    {
    
    
    
    huart6.Instance = USART6;
    
    huart6.Init.BaudRate = 115200;
    
    huart6.Init.WordLength = UART_WORDLENGTH_8B;
    
    huart6.Init.StopBits = UART_STOPBITS_1;
    
    huart6.Init.Parity = UART_PARITY_NONE;
    
    huart6.Init.Mode = UART_MODE_TX_RX;
    
    huart6.Init.HwFlowCtl = UART_HWCONTROL_NONE;
    
    huart6.Init.OverSampling = UART_OVERSAMPLING_16;
    
    huart6.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
    
    huart6.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
    
    if (HAL_UART_Init(&huart6) != HAL_OK)
    
    {
    
    Error_Handler();
    
    }
    
    }
    
    
    
    static void MX_GPIO_Init(void)
    
    {
    
    
    
    __HAL_RCC_GPIOE_CLK_ENABLE();
    
    __HAL_RCC_GPIOC_CLK_ENABLE();
    
    __HAL_RCC_GPIOI_CLK_ENABLE();
    
    __HAL_RCC_GPIOH_CLK_ENABLE();
    
    __HAL_RCC_GPIOA_CLK_ENABLE();
    
    __HAL_RCC_GPIOB_CLK_ENABLE();
    
    __HAL_RCC_GPIOG_CLK_ENABLE();
    
    
    
    }
    
    
    
    void StartDefaultTask(void const * argument)
    
    {
    
    
    
    MX_LWIP_Init();
    
    
    
    for(;;)
    
    {
    
    osDelay(1);
    
    }
    
    }
    
    
    
    void MPU_Config(void)
    
    {
    
    MPU_Region_InitTypeDef MPU_InitStruct = {0};
    
    
    
    HAL_MPU_Disable();
    
    
    
    MPU_InitStruct.Enable = MPU_REGION_ENABLE;
    
    MPU_InitStruct.Number = MPU_REGION_NUMBER0;
    
    MPU_InitStruct.BaseAddress = 0x0;
    
    MPU_InitStruct.Size = MPU_REGION_SIZE_4GB;
    
    MPU_InitStruct.SubRegionDisable = 0x87;
    
    MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
    
    MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS;
    
    MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
    
    MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
    
    MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
    
    MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
    
    
    
    HAL_MPU_ConfigRegion(&MPU_InitStruct);
    
    
    
    HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
    
    
    
    }
    
    
    
    void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
    
    {
    
    
    
    if (htim->Instance == TIM6)
    
    {
    
    HAL_IncTick();
    
    }
    
    }
    
    
    
    void Error_Handler(void)
    
    {
    
    __disable_irq();
    
    while (1)
    
    {
    
    }
    
    
    
    }
    
    #ifdef USE_FULL_ASSERT
    
    
    
    void assert_failed(uint8_t *file, uint32_t line)
    
    {
    
    }
    
    #endif /* USE_FULL_ASSERT */

    Edited to apply source code formatting - please see How to insert source code for future reference.

    See also: How to write your question to maximize your chances to find a solution, linked earlier.

    Technical Moderator
    July 29, 2025

    Hello @Sayan, and welcome to the community!

    Could you please answer the following questions to help me better understand the issue?

    • Are you sure that the static IP you assigned is not already in use elsewhere?
    • Did you correctly import your PHY drivers and modify the ethernetif.c source file to enable seamless communication with the PHY, including reading/writing registers and resetting the PHY when necessary?
    • Have you tried stepping through your code to check if the application hangs or returns any errors during execution?

    The more details you provide about your debugging steps and investigations, the better I can assist you in resolving the issue.

    Best regards,

    SayanAuthor
    Explorer II
    July 30, 2025
    • Dear Sir, we tested with multiple static IPs, to confirm that it is not IP matching issue.
    • The ethernet.c is mostly generated automatically along with the configuration in the stmcube. I only used that file and the changes I did in memory configuration, sir, which I mentioned above.
    • How to do stepping in the code?
    Super User
    July 30, 2025

    @Sayan wrote:
    • How to do stepping in the code?

    See the documentation for whatever IDE you're using.

    For STM32CubeIDE:

    https://www.st.com/resource/en/user_manual/um2609-stm32cubeide-user-guide-stmicroelectronics.pdf

    https://wiki.st.com/stm32mcu/wiki/Category:STM32CubeIDE#Videos_related_to_STM32CubeIDE - links to videos & tutorials.

    Technical Moderator
    August 1, 2025

    Hello @Sayan,
    Have you verified that the PHY is properly clocked? The PHY is sensitive to clock settings.

    I suggest placing a breakpoint at line 307 in the ethernetif.c file and stepping through the code in debug mode to check which speed and duplex mode are selected. This will help rule out issues related to improper PHY clocking and initialization.

     

    switch (PHYLinkState)

    Also, ensure your MPU configuration prevents memory corruption, something similar to the figure below, and make the necessary adjustments to the linker file.

    +----------------------+-------------------------------------------------+-------+
    | 0x00000000 | Strongly Ordered Region (Not defined regions) | 4 GB |
    | | Access Permission: No Access | |
    | | Bufferable: No | |
    | | Cacheable: No | |
    | | Shareable: Yes | |
    | | TEX Level: 0 | |
    | | SubRegion Disable: 0x87 | |
    | | Instruction Access: Disabled | |
    +----------------------+-------------------------------------------------+-------+
    | 0x20078000 | Ethernet Buffers | 16 KB |
    | | Access Permission: Full Access | |
    | | Bufferable: No | |
    | | Cacheable: No | |
    | | Shareable: No | |
    | | TEX Level: 1 | |
    | | SubRegion Disable: 0x00 | |
    | | Instruction Access: Enabled | |
    +----------------------+-------------------------------------------------+-------+
    | 0x2007C000 | Ethernet Descriptors | 1 KB |
    | | Access Permission: Full Access | |
    | | Bufferable: Yes | |
    | | Cacheable: No | |
    | | Shareable: Yes | |
    | | TEX Level: 0 | |
    | | SubRegion Disable: 0x00 | |
    | | Instruction Access: Enabled | |
    +----------------------+-------------------------------------------------+-------+

    Stepping through the MX_LWIP_INIT() function will help confirm whether LwIP initializes correctly or if the program halts during initialization. Please make sure you 

    Please make sure to test the steps I mentioned and provide me with updates so we can proceed further.

    Best regards,