Skip to content

Ethernet PTP timestamp retrieval is entirely wrong #63

Open
@chris1seto

Description

@chris1seto

Caution
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the ST Community/STM32 MCUs forum

Describe the set-up
Custom board or nucleo,

Describe the bug
In HAL_ETH_ReadData(), the ptp timestamp retrieval is completely incorrect. If timestamping is enabled, is at least one descriptor is given by DMA which is the normal descriptor. Then, the next descriptor following it will be the context descriptor. The way the HAL_ETH_ReadData() function is written, it will exit as soon as it sees a normal descriptor (rxdataready will be set to 1). The next call of the function would then read the context, but one single call to this function should read both the normal packet information AND the timestamp data for that packet.

How To Reproduce
NA

  1. How we can reproduce the problem
    Enable timestamping, notice you need two calls to HAL_ETH_ReadData() to get the packet first, then the timestamp second

Additional context
ST needs to pay attention when writing peripheral drivers. The reason for this issue is that the MAC IP block for the Stm32F7 (and similar parts) works differently. The timestamp comes in as an extension to a normal descriptor (An "enhanced" descriptor"). This means that it's not an extra descriptor which is generated, which is unlike the Stm32H7's MAC IP block (which makes an additional "context" descriptor"). This is clearly a copy and paste error. Additionally, this is evidence that ST didn't test the PTP functionality, because they would have immediately noticed this issue.

Screenshots
If applicable, add screenshots to help explain your problem.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingethEthernet MAC (Media Access Controller)halHAL-LL driver-related issue or pull-request.

Type

No type

Projects

Status

Analyzed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions