Skip to content

Commit e4e2f79

Browse files
author
Arto Kinnunen
committed
Update stm32xx_emac traces
- Make packet trace optional, can be enabled by enabling macro STM32xx_DEEP_TRACE - Shorten traces during driver initialisation to avoid problems with driver startup when soft reset is used.
1 parent 57a6fe3 commit e4e2f79

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
// #undef TRACE_LEVEL_DEBUG
4747
// #define TRACE_LEVEL_DEBUG 0
4848

49+
/* To get trace from every packet, enable deep trace macro */
50+
// #define STM32xx_DEEP_TRACE
51+
#ifdef STM32xx_DEEP_TRACE
52+
#define tr_debug_deep(...) tr_debug(__VA_ARGS__)
53+
#else
54+
#define tr_debug_deep(...)
55+
#endif
56+
4957
#if defined(ETH_IP_VERSION_V2)
5058
#include "lan8742/lan8742.h"
5159
#include "lwip/memp.h"
@@ -310,7 +318,7 @@ bool STM32_EMAC::low_level_init_successful()
310318
EthHandle.Init.RxMode = ETH_RXINTERRUPT_MODE;
311319
EthHandle.Init.ChecksumMode = ETH_CHECKSUM_BY_SOFTWARE;
312320
EthHandle.Init.MediaInterface = MBED_CONF_STM32_EMAC_ETH_PHY_MEDIA_INTERFACE;
313-
tr_info("PHY Addr %u AutoNegotiation %u", EthHandle.Init.PhyAddress, EthHandle.Init.AutoNegotiation);
321+
tr_info("power_up: PHY Addr %u AutoNeg %u", EthHandle.Init.PhyAddress, EthHandle.Init.AutoNegotiation);
314322
tr_debug("MAC Addr %02x:%02x:%02x:%02x:%02x:%02x", MACAddr[0], MACAddr[1], MACAddr[2], MACAddr[3], MACAddr[4], MACAddr[5]);
315323
tr_info("ETH buffers : %u Rx %u Tx", ETH_RXBUFNB, ETH_TXBUFNB);
316324

@@ -576,7 +584,7 @@ int STM32_EMAC::low_level_input(emac_mem_buf_t **buf)
576584

577585
/* get received frame */
578586
if (HAL_ETH_GetReceivedFrame_IT(&EthHandle) != HAL_OK) {
579-
tr_debug("low_level_input no frame");
587+
tr_debug_deep("low_level_input no frame");
580588
return -1;
581589
}
582590

@@ -588,7 +596,7 @@ int STM32_EMAC::low_level_input(emac_mem_buf_t **buf)
588596
dmarxdesc = EthHandle.RxFrameInfos.FSRxDesc;
589597

590598
if (len > 0 && len <= ETH_RX_BUF_SIZE) {
591-
tr_debug("low_level_input len %u", len);
599+
tr_debug_deep("low_level_input len %u", len);
592600
/* Allocate a memory buffer chain from buffer pool */
593601
*buf = memory_manager->alloc_pool(len, 0);
594602
}
@@ -877,8 +885,6 @@ void mbed_default_mac_address(char *mac)
877885

878886
bool STM32_EMAC::power_up()
879887
{
880-
tr_info("power_up");
881-
882888
sleep_manager_lock_deep_sleep();
883889

884890
/* Initialize the hardware */

0 commit comments

Comments
 (0)