2020-08-20 04:33 AM
We have migrated our project from STM32F7 to STM32H7 MCU and found that there's no support for PTP IEEE 1588 protocol in MAC Ethernet driver (HAL).
Here is a message written in stm32h7xx_hal_eth.c file:
-@- The PTP protocol offload APIs are not supported in this driver.
Is it ever going to be supported?
2023-02-06 02:01 AM
Oops, put in the wrong gpio file, not so difficult anyway... ;)
/* PTP pulse output ON / OFF on GPIO B5 */
void GPIO_PPS_OnOff(uint8_t u8PpsOn)
{
GPIO_InitTypeDef GPIO_InitStruct = { 0 };
if( u8PpsOn )
{
/* GPIO B: 5-PPS_OUT */
GPIO_InitStruct.Pin = PTP_PPS_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
HAL_GPIO_Init(PTP_PPS_GPIO_Port, &GPIO_InitStruct);
u8GpioPpsActive = 1;
}
else
{
HAL_GPIO_DeInit(PTP_PPS_GPIO_Port, PTP_PPS_Pin);
u8GpioPpsActive = 0;
}
}
2023-02-06 05:38 AM
@Community member tank you very mutch for sharing this code i will have a look.
If there are silicon bug in the H7 i can use the stm767zi i used so far.
Having a loock at you other questions i know u used the mcu as well have you managed to get freeRTOS+LWIP+DHCP+IEEE1588 PTP to run with an cubeMX project ?
If yes cann you give me an ioc file or the source code.
I need FreeRTOS and LWIP anaways so this dependecies are not a problem for me.
https://github.com/BeSeeTek/STM32F767zi_PTP_FreeRTOS/tree/main/Firmware this is what if got as blank cube MX code so far.
Is it normal that
#define ETH_RX_BUF_SIZE /* buffer size for receive */
in Core/Inc/stm32f7xx_hal_conf.h is empty an the code generated from cubeMX does not compile with out manualy patching that ?
2023-02-06 06:15 AM
I am using CubeMX only for very basic IO and clock setup, maybe for UART or ADC when I'm lazy...
And NOT using any OS.
F767:
I had some problems when TX streaming TCP, I had to set memory alignment to 8 (64 bit, makes sense for some parts), but still had problems when http / SSI / CGI worked with some short and odd-numbered pbufs.
These problems are completely gone with the H723 and the adapted driver.
2023-03-02 01:27 AM
If i try to configure the PPS Output in CUMEMX its PG8 and cant be chaned why is it B5 in your example and how have you configured the TIM2 timer with ITR4 ?
2023-03-02 02:04 AM
Learn to write code without CubeMX, sorry...
I don't get why people always think that you can click a little in CubeMX and get a complete and complex application working.
Cube was originally supposed to do basic CPU, RCC, GPIO and peripheral setup, and that's the only thing it's reliable and good at.
And even only that is a big help. In 2011 I started working with a STM32 briefly, no CubeMX, no HAL, and I remember that even the basic setup took me some days.
Setting some GPIOs shouldn't be a problem.
Important: check what else might be using PB5.
And the timers are actually not needed to get PPS output, another Cube flaw.
2023-03-02 03:48 AM
@Community member Thank for your reply.
"""And the timers are actually not needed to get PPS output, another Cube flaw. """
I'm reading the reference manual RM0433 at the moment an there was absoluty no mention of ann timers needed for PPS output.
Only that i can configute the PPS output via PPS control register (ETH_MACPPSCR) but let it stay at 0x0000 seams to gernerate an 50% DC PPS Signal.
But in this old document by st http://www.bdtic.com/download/ST/AN3411.pdf the PPS event generation was used to trigger an timer...
Having a look in the datasheet of the H743Zi shows that PB5 and PG8 have the alternate functions ETH_PPS_OUT witch your code activates using GPIO_AF11_ETH defined in stm32h7xx_hal_gpio_ex.h
Having a look in the H743xI reference manual Table 11. Port B alternate functions.
Was this the way how you got this information?
For the actual implementation off PTP i will follow the steps given in
Starting BY
58.9.9 Programming guidelines for IEEE 1588 timestamping Initializing the System time generation
And using wireshark and an linux PC with ptpD.
But we will see how long this may takes.
2023-03-02 03:56 AM
It's no simple stuff, so be patient and learn.
You basically need 2 documents:
The documentation about timer and PPS connection wasn't clear to me, it's actually only an interrupt event on PPS that can be used as a trigger for a timer.
ETH_MACPPSCR
I only set the PPSCCTRL for the frequency I need.
Keeping these bits at 0 will give you a 1 Hz square signal with 50% duty cycle.