cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F769BIT custom board - Ethernet issue

Sayan
Associate II

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

 

17 REPLIES 17
mbarg.1
Senior III

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.

 

Sayan
Associate II

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

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 !!

STackPointer64
ST Employee

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,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.
Andrew Neil
Super User

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

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Sayan
Associate II

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.

Sayan
Associate II

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?

 

Sayan
Associate II

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.


@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.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.