LPC43xx MAC Frame filter options have no effect

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC43xx MAC Frame filter options have no effect

771 次查看
shrutisen
Contributor I

I am using lpc18xx_43xx_emac.c Mac driver for LWIP from NXP. I wish to set up frame filtering for a multicast MAC address on my LPC4357. As a first step, I tried to set the MAC frame filter register to pass all multicast messages by setting the MAC_FF_PM bit (pass-all-multicast bit) in the MAC_FRAME_FILTER register. According to the datasheet, this should allow all multicast packets, irrespective of any hash filter settings. This does not work - only unicast packets arrive at the application.
I went ahead and tried to do the MAC frame filter hash table calculations as suggested in the LPC43xx user manual. This had no effect either.
I can however, receive all network traffic if I set the MAC_FRAME_FILTER to receive all packets or to the promiscuous mode.
The only two possibilities, it seems, are - to receive unicast packets OR receive all packets with no filtering.

Am I missing information? Has anyone tried and seen MAC frame filtering work on this chip?

Thanks.

标签 (1)
0 项奖励
2 回复数

492 次查看
shrutisen
Contributor I

Ok, since I posted this message yesterday, I have had better luck with frame filtering.

Previously, I followed the example of the MAC driver and set the frame filter and hash tables etc. in the low level initialization of the Mac driver. The settings themselves were successful as I could read and verify the settings in the ethernet registers.

Now, I have moved the hash table and mac frame filter register setting to after all low level initialization was finished. In fact, I do this now after my application has started up entirely. I made the change by accident.

So my question changes to this: why does this work? I am not too happy with the idea that something works by chance and would like to know why it does now and did not previously. 
Thanks.

I have included just the MAC driver's low level init call (from lpc18xx_43xx_mac.c) with the detail of where the non-working settings changes were made previously

/* Low level init of the MAC and PHY */
static err_t low_level_init(struct netif *netif)
{
    struct lpc_enetdata *lpc_netifdata = netif->state;

    /* Initialize via Chip ENET function */
    Chip_ENET_Init(LPC_ETHERNET);

    /* Save MAC address */
    Chip_ENET_SetADDR(LPC_ETHERNET, netif->hwaddr);

    /* Initial MAC configuration for checksum offload, full duplex,
       100Mbps, disable receive own in half duplex, inter-frame gap
       of 64-bits */
    LPC_ETHERNET->MAC_CONFIG = MAC_CFG_BL(0) | MAC_CFG_IPC | MAC_CFG_DM |
                               MAC_CFG_DO | MAC_CFG_FES | MAC_CFG_PS | MAC_CFG_IFG(3);

    /* Setup filter */
#if IP_SOF_BROADCAST_RECV
    LPC_ETHERNET->MAC_FRAME_FILTER = MAC_FF_PR | MAC_FF_RA; /* <<This is where I my  frame filter settings go. (Yes, IP_SOF_BROADCAST_RECV is set ) . The changed line looked like this:   LPC_ETHERNET->MAC_FRAME_FILTER = MAC_FF_PM; This was the setting that does not work*/
#else
    LPC_ETHERNET->MAC_FRAME_FILTER = 0;    /* Only matching MAC address */
#endif

    /* Initialize the PHY */
#if defined(USE_RMII)
    if (lpc_phy_init(true, msDelay) != SUCCESS) {
        return ERR_IF;
    }

    intMask = RDES_CE | RDES_DE | RDES_RE | RDES_RWT | RDES_LC | RDES_OE |
              RDES_SAF | RDES_AFM;
#else
    if (lpc_phy_init(false, msDelay) != SUCCESS) {
        return ERR_IF;
    }

    intMask = RDES_CE | RDES_RE | RDES_RWT | RDES_LC | RDES_OE | RDES_SAF |
              RDES_AFM;
#endif

    /* Setup transmit and receive descriptors */
    if (lpc_tx_setup(lpc_netifdata) != ERR_OK) {
        return ERR_BUF;
    }
    if (lpc_rx_setup(lpc_netifdata) != ERR_OK) {
        return ERR_BUF;
    }

    /* Flush transmit FIFO */
    LPC_ETHERNET->DMA_OP_MODE = DMA_OM_FTF;

    /* Setup DMA to flush receive FIFOs at 32 bytes, service TX FIFOs at
       64 bytes */
    LPC_ETHERNET->DMA_OP_MODE |= DMA_OM_RTC(1) | DMA_OM_TTC(0);

    /* Clear all MAC interrupts */
    LPC_ETHERNET->DMA_STAT = DMA_ST_ALL;

    /* Enable MAC interrupts */
    LPC_ETHERNET->DMA_INT_EN =
#if NO_SYS == 1
        0;
#else
        DMA_IE_NIE | DMA_IE_AIE | DMA_IE_RIE | DMA_IE_TIE;
#endif

    /* Enable receive and transmit DMA processes */
    LPC_ETHERNET->DMA_OP_MODE |= DMA_OM_ST | DMA_OM_SR;

    /* Enable packet reception */
    LPC_ETHERNET->MAC_CONFIG |= MAC_CFG_RE | MAC_CFG_TE;

    /* Start receive polling */
    LPC_ETHERNET->DMA_REC_POLL_DEMAND = 1;

    return ERR_OK;
}

0 项奖励

492 次查看
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Shruti Sen,

The Promiscuous Mode and Receive all bits affect different levels of address filtering, the first one goes to the address check block of the MAC, which performs the first level of address filtering. The second level of filtering is performed on the incoming frame.


Hope it helps!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 项奖励