Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}

Expand All @@ -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);
}
Expand Down Expand Up @@ -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 */
Expand Down