diff --git a/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp b/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp index 356576dd21..a7c521f4a8 100644 --- a/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp +++ b/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp @@ -46,6 +46,14 @@ // #undef TRACE_LEVEL_DEBUG // #define TRACE_LEVEL_DEBUG 0 +/* To get trace from every packet, enable deep trace macro */ +// #define STM32xx_DEEP_TRACE +#ifdef STM32xx_DEEP_TRACE +#define tr_debug_deep(...) tr_debug(__VA_ARGS__) +#else +#define tr_debug_deep(...) +#endif + #if defined(ETH_IP_VERSION_V2) #include "lan8742/lan8742.h" #include "lwip/memp.h" @@ -310,7 +318,7 @@ bool STM32_EMAC::low_level_init_successful() EthHandle.Init.RxMode = ETH_RXINTERRUPT_MODE; EthHandle.Init.ChecksumMode = ETH_CHECKSUM_BY_SOFTWARE; EthHandle.Init.MediaInterface = MBED_CONF_STM32_EMAC_ETH_PHY_MEDIA_INTERFACE; - tr_info("PHY Addr %u AutoNegotiation %u", EthHandle.Init.PhyAddress, EthHandle.Init.AutoNegotiation); + tr_info("power_up: PHY Addr %u AutoNeg %u", EthHandle.Init.PhyAddress, EthHandle.Init.AutoNegotiation); tr_debug("MAC Addr %02x:%02x:%02x:%02x:%02x:%02x", MACAddr[0], MACAddr[1], MACAddr[2], MACAddr[3], MACAddr[4], MACAddr[5]); tr_info("ETH buffers : %u Rx %u Tx", ETH_RXBUFNB, ETH_TXBUFNB); @@ -576,7 +584,7 @@ int STM32_EMAC::low_level_input(emac_mem_buf_t **buf) /* get received frame */ if (HAL_ETH_GetReceivedFrame_IT(&EthHandle) != HAL_OK) { - tr_debug("low_level_input no frame"); + tr_debug_deep("low_level_input no frame"); return -1; } @@ -588,7 +596,7 @@ int STM32_EMAC::low_level_input(emac_mem_buf_t **buf) dmarxdesc = EthHandle.RxFrameInfos.FSRxDesc; if (len > 0 && len <= ETH_RX_BUF_SIZE) { - tr_debug("low_level_input len %u", len); + tr_debug_deep("low_level_input len %u", len); /* Allocate a memory buffer chain from buffer pool */ *buf = memory_manager->alloc_pool(len, 0); } @@ -877,8 +885,6 @@ void mbed_default_mac_address(char *mac) bool STM32_EMAC::power_up() { - tr_info("power_up"); - sleep_manager_lock_deep_sleep(); /* Initialize the hardware */