cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 PTP Support

stevof12
Associate

Hello!,

I got a custom PCB with a STM32F76 MCU with a PHY chip.

Running Freetos CMSIS V1, and LwIP. 

I want to setup the MCU as a PTP slave/client. Is there a way to configure this in the .ioc file?

Looking through the drivers enabled HAL_ETH_USE_PTP in stm32f7xx_hal_conf.h 

Also added the following to HAL_ETH_Init() :

ETH_PTP_ConfigTypeDef *ptpconfig ;
HAL_ETH_PTP_GetConfig(heth,ptpconfig );// Get PTP actual configuration into ETH_PTP_ConfigTypeDef
HAL_ETH_PTP_SetConfig(heth,ptpconfig);

 

What is the proper way to enable PTP support in the .ioc file ? 

Do I need to know the IP of the PTP master? 

Thanks,

Steve

1 ACCEPTED SOLUTION

Accepted Solutions
LCE
Principal

AFAIK there is no PTP firmware support for any STM32, although the STM32 provides the necessary hardware (timestamp registers).

I think in the latest HAL updates they added some PTP functions, but that is far from a working client, no protocols whatsoever.

I have it working on a F767 and H723/H735, but with my own ethernet drivers and a modified version of the ptpd (originally for Linux, I think) as a base: 

https://github.com/hasseb/stm32h7_atsame70_ptpd

Lots of work... but the good news, it works. With the right tuning and not much network traffic I'm usually below +-100 ns (amazing how a scope check (PPS) and the values of ptpd match!).

View solution in original post

2 REPLIES 2
LCE
Principal

AFAIK there is no PTP firmware support for any STM32, although the STM32 provides the necessary hardware (timestamp registers).

I think in the latest HAL updates they added some PTP functions, but that is far from a working client, no protocols whatsoever.

I have it working on a F767 and H723/H735, but with my own ethernet drivers and a modified version of the ptpd (originally for Linux, I think) as a base: 

https://github.com/hasseb/stm32h7_atsame70_ptpd

Lots of work... but the good news, it works. With the right tuning and not much network traffic I'm usually below +-100 ns (amazing how a scope check (PPS) and the values of ptpd match!).

As I understand CubeMX (the tool):
it configures just your HW (pins) and maybe adds some additional SW stacks (e.g. FreeRTOS, USB stack).

But it never adds libraries (code) and even not functions when it comes to "Middleware" or even "higher layer protocols").

You have to study a PTP implementation and "bind" this "SW stack" to your system. Tough job, but because it so tough: CubeMX does not generate a full blown application for you.

Best is to find another reference/demo project and try to understand and follow.