STM32HG723使用RL-TCPnet的注意事项

SRAM1地址区间是0x30000000 - 0x30003FFF。

SRAM2地址区间是0x30004000 - 0x30007FFF。

不同于H743的地址分配,且没有SRAM3区域,网上的教程没有H723的,如果按H743的方式去做,就会错。

DMARxDscrTab DMATxDscrTab Rx_Buff 的地址都要位于这里,MXcube生成的GNU编译器代码

ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT] __attribute__((section(".RxDecripSection"))); /* Ethernet Rx DMA Descriptors */
ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT] __attribute__((section(".TxDecripSection")));   /* Ethernet Tx DMA Descriptors */
uint8_t Rx_Buff[ETH_RX_DESC_CNT][ETH_MAX_PACKET_SIZE] __attribute__((section(".RxArraySection"))); /* Ethernet Receive Buffers */

 然后在Option for Target-->Linker里取消选择Use Memory Layout form Target Dialog,编辑sct文件,加入地址分配

  SRAM1_RxDecripSection 0x30000000 0x60  {
        * (.RxDecripSection)
  }
  SRAM1_TxDecripSection 0x30000060 0x60  {
        * (.TxDecripSection)
  }
  SRAM1_RxArraySection  0x300000C0 0x2000 {
        * (.RxArraySection)
  } 

EMAC_STM32H7xx.c里默认的#define EMAC_TXBUF_ADDRESS      0x30042000也是不用的,这个也是与H723的地址不匹配的,

在Option for Target-->C/C++(AC6)-->Preprocessor Symbols-->Define里加入EMAC_TXBUF_ADDRESS=0x30002000或EMAC_TXBUF_ADDRESS=0x30004000来重新分配地址。

记得配置使能0x30000000的MPU和使能I-Cache和D-Cache。

 

2024.2.29更新

EMAC_STM32H7xx.c V1.6版 添加了Tx_Buff和Rx_Buff的定义,

#if defined ( __CC_ARM )  /* MDK ARM Compiler */
__attribute__((at(0x30040100))) static uint8_t Rx_Buff[ETH_RX_DESC_CNT][ETH_MAX_PACKET_SIZE]; /* Ethernet Receive Buffers */
__attribute__((at(0x30041900))) static uint8_t Tx_Buff[ETH_TX_DESC_CNT][ETH_MAX_PACKET_SIZE]; /* Ethernet Transmit Buffers */
#elif defined ( __GNUC__ ) /* GNU Compiler */
static uint8_t Rx_Buff[ETH_RX_DESC_CNT][ETH_MAX_PACKET_SIZE] __attribute__((section(".RxArraySection"))); /* Ethernet Receive Buffers */
static uint8_t Tx_Buff[ETH_TX_DESC_CNT][ETH_MAX_PACKET_SIZE] __attribute__((section(".TxArraySection"))); /* Ethernet Transmit Buffers */
#endif

这样就不需要添加EMAC_TXBUF_ADDRESS宏定义了,也不需要手动添加

uint8_t Rx_Buff[ETH_RX_DESC_CNT][ETH_MAX_PACKET_SIZE] __attribute__((section(".RxArraySection")));

只需要编辑sct文件,加入地址分配
SRAM1_RxDecripSection 0x30000000 0x60  {
        * (.RxDecripSection)
  }
  SRAM1_TxDecripSection 0x30000060 0x60  {
        * (.TxDecripSection)
  }
  SRAM1_RxArraySection  0x300000C0 0x2000 {
        * (.RxArraySection)
  SRAM2_TxArraySection  0x30004000 0x2000 {
        * (.TxArraySection)
}

LAN8742A支持热插拔修改,来自安富莱
PHY_LAN8742A.c V1.3存在问题,拔掉重插后会断联,需修改驱动文件。
136行注释掉

// PHY.bcr = BCR_POWER_DOWN;

// return (PHY.reg_wr(ETH_PHY_ADDR, REG_BCR, PHY.bcr));

然后添加
return ARM_DRIVER_OK;

优先级修改
Net_Config.c

// Core Thread Priority
#define NET_THREAD_PRIORITY osPriorityAboveNormal

Net_Config_ETH_0.h

// Interface Thread Priority
#define ETH0_THREAD_PRIORITY osPriorityAboveNormal1



 

posted @ 2022-02-11 15:43  smilingfrog  阅读(380)  评论(0编辑  收藏  举报