cancel
Showing results for 
Search instead for 
Did you mean: 

Bus error on Ethernet DMA when receiving timestamped PTP datagrams

edgarj
Visitor

Hi,

I am implementing PTP slave on bare metal H743II with firmware 1.12.1 and LwIP 2.1.2.

After receiving the first timestamped datagram, the network communication stops. In the DMACSR register the FBE (fatal bus error) bit is set, and REB (rx DMA error bits) is 0x4 (bus error: error during data transfer by rx DMA).

The problem seems to be handling of rx context descriptors in stm32h7xx_hal_eth.c:ETH_UpdateDescriptor(). In a context descriptor, the buffer is still allocated and BackupAddr0 contains the buffer address, so no new buffer is allocated. But DESC0 contains the timestamp and not the buffer address, which causes error next time the descriptor is used.

If I modify the function to always update DESC0 when an allocated buffer exists, the bus error does not occur.

Code change:

@@ -1182,12 +1182,12 @@ static void ETH_UpdateDescriptor(ETH_HandleTypeDef *heth)
       else
       {
         WRITE_REG(dmarxdesc->BackupAddr0, (uint32_t)buff);
-        WRITE_REG(dmarxdesc->DESC0, (uint32_t)buff);
       }
     }
 
     if (allocStatus != 0U)
     {
+      WRITE_REG(dmarxdesc->DESC0, dmarxdesc->BackupAddr0);
 
       if (heth->RxDescList.ItMode != 0U)
       {

 

0 REPLIES 0