daniel-p-carvalho opened a new pull request, #20211:
URL: https://github.com/apache/nuttx/pull/20211

   ## Summary
   
   The Ethernet MAC of the STM32H7 has a time counter that stamps frames in 
hardware, but the driver never started it: `STM32_ETH_PTP` only printed a 
warning. This PR starts it, adds the pulse-per-second output and registers the 
counter as a PTP hardware clock, `/dev/ptp0`, the same way the legacy STM32 
driver does. It is the first step of the PTP support of the STM32H7; the 
timestamps of the frames come in later PRs.
   
   ### Commits
   
   1. `arch/arm/stm32h7: configure the PPS pin only with STM32_ETH_PTP_GPIO.` 
The driver configured the pin whenever `STM32_ETH_PTP` was set, so a board that 
only wanted the counter had to define `GPIO_ETH_PPS_OUT` and lost the pin. The 
STM32F4 driver uses `STM32_ETH_PTP_GPIO` for that, and the option could not be 
selected on the STM32H7.
   2. `arch/arm/stm32h7: add the PTP hardware clock of the Ethernet MAC.` 
Registers, system time, PPS output and `/dev/ptp0`.
   3. `Documentation/stm32h7: document the Ethernet PTP clock.`
   
   ## Impact
   
   - Everything new is under `STM32_ETH_PTP` (default n). No board of the tree 
selects it yet, so no existing configuration changes, including the change of 
the PPS pin in commit 1.
   - `STM32_ETH_PTP_GPIO` can now be selected on the STM32H7 and STM32H5.
   - No change to the network stack or to any public header.
   
   ## Testing
   
   Built for a custom board with an STM32H753, a DP83848 PHY and `HCLK` at 200 
MHz, with `STM32_ETH_PTP`, `STM32_ETH_PTP_GPIO` and `PTP_CLOCK`, and with each 
combination of `STM32_ETH_PTP_GPIO` and `PTP_CLOCK`, and with `STM32_ETH_PTP` 
off, without errors or warnings. `./tools/checkpatch.sh -g 
upstream/master..HEAD` passes.
   
   On hardware:
   
   - The system time advanced 10.0018 s while a host clock advanced 10.002 s, 
with the cable unplugged.
   - Through `/dev/ptp0`: reading, setting, steps of +0.5 s and -1.25 s, and a 
change of frequency of 100 ppm behaved as expected. A subtraction of time needs 
the encoding of the digital rollover, which was measured on the MAC.
   - The PPS output was seen on an oscilloscope: one pulse per second, half of 
it high, with the edges at the whole seconds of the system time, before and 
after setting and stepping the time.
   - The interrupt of the timestamp unit stopped the network when it was 
enabled together with the PPS output, hence it is not enabled.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to