This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM46L852: Does LwIP works on polling instead of EMAC Tx and Rx interrupt?

Part Number: RM46L852
Other Parts Discussed in Thread: HALCOGEN

Hello,

In our application, we are not using the any kind of interrupt. and we need to implement/use TI LwIP ethernet stack. But, i think this stack comes in interrupt based. 

my question is, will it be feasible to use the Polling method for EMAC module instead of interrupt? is there any application OR code is available for regarding the same?

   

  • Hello Pramod,

    Theoretically it is feasible to use polling mode in lwip, but we don't have sample project using polling mode. Are you going to keep polling the flag to check the incoming package?
  • QJ,

    Yes. in main loop we are polling the Incoming package.

    We are studying the stack. But it will be helpful if you please guide us where are the changes required in stack for polling.

  • QJ,

    In our Application, We have configured PLL1 and PLL2 clock as 220Mhz.

    Now we have to merge the Ethernet EMAC and MDIO module in our code. We are following below guideline given for Ethernet.

    http://processors.wiki.ti.com/index.php/HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration

    Configuring EMAC and MDIO using HALCoGen GUI

    1.    Under the ‘PLL’ tab, change the multiplier for both PLLs to a value of 120, such that the output frequency in both cases is 160.00 MHz. 

    2.    Under the ‘GCM’ tab, change the value of the VCLKA4 Divider to 2, such that the output of VCLKA4( or VCLKA4_DIVR_EMAC in case of RM46x/TMS570LS12x Devices) is 40.00 MHz.

    is this necessary to configure the Clock for 160Mhz for Ethernet Working? if  we keep the clock to 220Mhz, does Ethernet module work?

     

     

  • Hello,

    It is ok to configure vclka4 to 40MHz for EMAC.

    I don't have sample code for polling mode. It is straightforward for modify current project for your application. The RX ISR is:

    hdkif_rx_inthandler(struct netif *netif){....} in hdkif.c

    RXPENDn is the flag of receive packet completion interrupt for receive channels 0 through 7:

    if ( intr_flags & EMAC_MACINVECTOR_RXPEND ) {..}

  • QJ,

    Thanks for your reply. i will use while developing the Ethernet polling code.

    We are using the example given by TI HALCoGen EMAC Driver with lwIP Demonstration/v00.03.00(ethernet interrupt based) to test the HDK board (RM46) and tested with our Desktop machine using static IP , but we observed control returns IPAdr value as '0'.

    what would be the possible reasons?

  • Hello Pramod,

    If you use the option of "IPADDR_USE_STATIC", you have to assign a IP address to the board. You can use "IPADDR_USE_DHCP" first to get the IP address assigned to your board, then use the STATIC option.

    1. ipAddr = lwIPInit(0, macAddress, 0, 0, 0, IPADDR_USE_DHCP); --> to get IP Address
    2. Use ipconfig in your CMD window to get the ip address of your PC and the netlask/gateway, then
    3. ipAddr = lwIPInit(0, macAddress, ip_addr, netmask, gateway, IPADDR_USE_STATIC);
  • Thanks for your reply.

    We forgot to turn on S2-4 switch, so that HDK hardware can support the Ethernet.

    now on example software v00.03.00, we get the IP address. 

  • Hello QJ,

    We integrated the V00.03.00 lwIp stack into our Software. Also added the patch for known issues of V00.03.00 .

    1. Then we tried to run the code with Halcogen generated ethernet Tx and Rx Isr. after the function call to :
    lwIPInit(0, emacAddress, *((uint32_t *)Static_IpAddr), *((uint32_t *)NetMask), *((uint32_t *)Gateway), IPADDR_USE_STATIC);
    we observed that code get stuck into Tx Handler at
    while(((curr_bd->flags_pktlen) & EMAC_BUF_DESC_OWNER) == EMAC_BUF_DESC_OWNER)

    2. After that, we updated the ISR as per the demo application and we run the code, after the function call to :
    lwIPInit(0, emacAddress, *((uint32_t *)Static_IpAddr), *((uint32_t *)NetMask), *((uint32_t *)Gateway), IPADDR_USE_STATIC);
    we observed that it doesn't get stuck in Tx ISR but Tx ISR gets called continuously and it never returns from the lwIPInit.

    3. Assume that we get the Static IP address and we want to check connection between PC and HDK Board. can we use 'ping' command from PC? do we need to call any function periodically to handle this incoming ping request?

    4. same question for webserver, once we init httpd() , do we need to call any function to handle the incoming request?
  • QJ,

    Any update on above queries

  • QJ,

    Thanks for your support.

     Our code works as expected, get both Static and DHCP IP respectively. and TI web server page gets open after placing respective IP address at URL.

    Issue was, in our code we used IRQ Dispatcher method for interrupt handling and Halcogen provides the #pragma EMAC RX and TX interrupt.

  • QJ,

    In current interrupt based LwIP protocol, DHCP OR Static IP get through interrupt.

    For LwIP polling , Currently in while loop we are polling respective TX and RX flags and it works properly. For IP Ping, we get the response as well as for TI hercules web page gets open.

    Can you please help us to identify the changes required in LwIP stack, for getting the DHCP IP on polling (in function lwip_init()) ?

  • QJ,

    In current LwIP stack, both DHCP and Static IP is get through interrupt and call back function.

    Can you please help us to identify the changes required for getting the DHCP IP by polling Ethernet Tx and RX flags?
  • QJ,

    In current LwIP stack, both DHCP and Static IP is get through interrupt and call back function.

    Can you please help us to identify the changes required for getting the DHCP IP by polling Ethernet Tx and RX flags?
  • QJ,

    In current LwIP stack, both DHCP and Static IP is get through interrupt and call back function.

    Can you please help us to identify the changes required for getting the DHCP IP by polling Ethernet Tx and RX flags?