RAW ethernet frames in MQX 4.1 in TWR-K70F120M

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RAW ethernet frames in MQX 4.1 in TWR-K70F120M

889 Views
maciejwdowiarz-
Contributor III

Hello,

I'd like to obtain level-2 Ethernet frame, beginning with MAC source/destination fields, etc (according to https://en.wikipedia.org/wiki/Ethernet_frame). For longer time, I'm browsing MQC code, especially files such us macnet_receive.c and enrecv.c. Like stated in other post https://community.freescale.com/thread/350082

I've started with interrupt function void MACNET_RX_ISR (void    *enet) which deals with ENET_CONTEXT_STRUCT_PTR    enet_ptr. This pointer is later processed in MACNET_process_rx_bds(ENET_CONTEXT_STRUCT_PTR    enet_ptr) function, where inside there is introduced buffer where both are being passed to ENET_find_receiver(ENET_CONTEXT_STRUCT_PTR  enet_ptr, ENET_HEADER_PTR      packet_ptr, uint32_t *length_ptr). I've 3-rd party code that requires just a pointer to Ethernet frame. Should I pass then a buffer or ENET_CONTEXT_STRUCT_PTR    enet_ptr ? Thank you for help. I couldn't find any info about this 2-layer in documentation.

Regards,

Maciej

Labels (1)
0 Kudos
2 Replies

506 Views
maciejwdowiarz-
Contributor III

Hi,

I've tried to use code from function VNIC_FEC_Init(). That is, initializing device and registering to protocol. However, no frames are calling the callback. Could you help me ?

Code below:

void Callback

   (

      PCB_PTR  pcb,     /* [IN] the received packet */

      void    *handle    /* [IN] the IP interface structure */

   )

{

    printf("\nreceived enet 0x0800 frame\n"); 

    PCB_free(pcb);

}

void Ethernet_task (uint32_t initial_data)

{

    _enet_address            enet_address;

    IPCFG_IP_ADDRESS_DATA    ip_data;

    uint32_t                  error;

    _enet_handle enet_ptr;

   ip_data.ip = ENET_IPADDR;

   ip_data.mask = ENET_IPMASK;

   ip_data.gateway = ENET_IPGATEWAY;

  

   ENET_get_mac_address (BSP_DEFAULT_ENET_DEVICE, ENET_IPADDR, enet_address);

   error = ENET_initialize (BSP_DEFAULT_ENET_DEVICE, enet_address, 0, &enet_ptr);

   if(error != ENET_OK)

   {

       printf ("ENET_Initialization Failed\n");

           _task_block();

   }

   

    printf("START Ethernet task\n");

    if (ENET_open(enet_ptr, 0x0800, Callback, ipcfg_get_ihandle(BSP_DEFAULT_ENET_DEVICE)) != ENET_OK)

    {

           printf("Registering an EtherType value for IPv4 protocol failed.\n");

    }

    _task_block();

    printf("ETHER TASK FINISHED\n");

}

0 Kudos

506 Views
soledad
NXP Employee
NXP Employee

Hello Maciej,

For MQX 4.1 only ENET driver and RTCS Ethernet media layer has VLAN-specific definition that has influence on Ethernet frame size.

It allocates additional 4 byte of space for IEEE802.1Q tag in Ethernet frame. But there is no VLAN-specific code in RTCS stack.

Please check the new MQX release (4.2).

You can find below the new feactures implemented in this release:

RTCS TCP/IPv4 and TCP/IPv6(optional) stacks - version 4.2.0 (same as in KSDK 1.2.0)

• The new TLSF best-fit memory allocators were added.

• LLMNR - RTCS newly support Link-Local Multicast Name Resolution (LLMNR) Server. This protocol allows resolving simple label names on local subnet without the necessity of having a DNS server.

• Added DHCP Client v6 client application protocol support (Available in MQX RTOS IPv6 Add-on for purchase).

• Added Telnet Client IPv6 protocol support; API of this component was changed (Available in MQX RTOS IPv6 Add-on for purchase).

• Added TFTP Client/Server IPv6 protocol support; API of this component was changed (Available in MQX IPv6 Add-on for purchase).

• Added support of WebSocket server as part of Http server code. The implementation was fully tested by AutoBahn test suite.

• HTTP server was extended by SSL support (Available in WolfSSL add-on for evaluation).

• Socket code has been updated by various BSD compatible options and flags.

• ARP cache handling was modified to protect RTCS against DoS Attack.

• For more details see complete change log in the <MQX>/rtcs/rtcs_changelog.txt file.


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos