2018-04-13 02:06 AM
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 #ieee15882018-04-14 02:52 PM
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?
2018-04-17 03:57 AM
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 registerand 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 registerbit 1.7. Program the Time stamp high update and Time stamp low update registers with theappropriate 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 valuewritten 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?
2018-04-17 06:52 AM
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 ?
2018-04-17 07:48 AM
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? Thanks2018-04-18 04:46 AM
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
2018-04-22 07:49 AM
Thank you so much for your help ... I'm working on the first example let's see where it gets me