cancel
Showing results for 
Search instead for 
Did you mean: 

1588 PTP on STM32F746ZG

Kamil Alkhouri
Associate II
Posted on April 13, 2018 at 11:06

hey,

I have a LWIP client/server application and I want to add the PTP synchronization feature to the communication. I'm using STM32F746ZGTx Nucleo and CubeMX. I'm trying to enable RMII_PTP_Synchro mode for ETH (after enabling TIM2) but cubeMX is displaying the following message:

'Warning: STM32CubeMX does not support the configuration of this IP's mode. You can configure it only manually'.

I can't start this configuration from scratches so is there any precoded sources I can relay on to activate and configure this feature?

Thanks.

#ptp #stm32f7 #cubemx #ieee1588
6 REPLIES 6
Joerg Wagner
Senior III
Posted on April 14, 2018 at 23:52

Okay, guess it would work - what are your next steps?

Did you already wrote code lines to implement/use this feature

and if not, did you deal with this subject?

Posted on April 17, 2018 at 10:57

according to the user manual RM0385, there are some programming steps for system time generation initialization and they are basically setting some register values:

1. Mask the Time stamp trigger interrupt by setting bit 9 in the MACIMR register.

2. Program Time stamp register bit 0 to enable time stamping.

3. Program the Subsecond increment register based on the PTP clock frequency.

4. If you are using the Fine correction method, program the Time stamp addend register

and set Time stamp control register bit 5 (addend register update).

5. Poll the Time stamp control register until bit 5 is cleared.

6. To select the Fine correction method (if required), program Time stamp control register

bit 1.

7. Program the Time stamp high update and Time stamp low update registers with the

appropriate time value.

8. Set Time stamp control register bit 2 (Time stamp init).

9. The Time stamp counter starts operation as soon as it is initialized with the value

written in the Time stamp update register.

10. Enable the MAC receiver and transmitter for proper time stamping.

I followed these steps and the register values are correctly set. But I'm still struggling to find a code to use this feature! any advice? is there a well-known library that solves my problem?

Posted on April 17, 2018 at 13:52

I don't know an existing library.

The point is: You have to modify and extend LwIP.

For example: The descriptors need twice more space.

Is it neccessary for your application to have such a fine precision

in comparison to NTP ?

Posted on April 17, 2018 at 14:48

Yes. My application is supposed to use IEEE1588v2 PTP and I don't think extending LWIP is something I can do as a beginner in embedded systems programming. I have found a nice application note AN3411 (

/external-link.jspa?url=http%3A%2F%2Fwww.bdtic.com%2Fdownload%2FST%2FAN34pdf

) that can solve my problem, however, I'm not able to find this note or the software related to it on ST website. Can you help me with that?

Thanks

Posted on April 18, 2018 at 11:46

In this PDF the application note AN3102 is mentioned with a software example.

I think they removed the ptp source files in the current version.

But nevertheless, it based on an old version LwIP 1.3 and AN3102 is 7 years old.

As I mentioned, the LwIP stack and the ethernetif.c driver have to be modified,

see page 14 section 5.2 in AN3411.

I hope you read the section the RAW api is the only one which can used for ptp needs

and has to be modified as well as some UDP source files.

But I found 2 links with ptp examples for STM32F4 and STM32F7:

htttp://pck338-242.feld.cvut.cz/scide/scide-fw-current.php

https://github.com/j123b567/ti-epl

 
Posted on April 22, 2018 at 14:49

Thank you so much for your help ... I'm working on the first example let's see where it gets me