1
\$\begingroup\$

I installed RTX (rtos from Keil) and Ethernet library from STM for stm32f207 MC. I configured UDP using ethernet + LwIP as in examples from STM.

Without RTOS UDP works fine. I send and get packets without any problems, but with RTOS (RTX in my case) i can only send packets with ARP-request but can't get packets due to i have no ethernet interrupts on receiving packets (can't get ETH_DMA_FLAG_R flag). I know, that there are reciving packets because i see them in Wireshark.

So, that's how i configure Ethernet interrupts:

extern ETH_DMADESCTypeDef  DMARxDscrTab[ETH_RXBUFNB], DMATxDscrTab[ETH_TXBUFNB];

/* Ethernet Receive buffers  */
extern uint8_t Rx_Buff[ETH_RXBUFNB][ETH_RX_BUF_SIZE]; 

/* Ethernet Transmit buffers */
extern uint8_t Tx_Buff[ETH_TXBUFNB][ETH_TX_BUF_SIZE]; 

...
  ETH_DMATxDescChainInit(DMATxDscrTab, &Tx_Buff[0][0], ETH_TXBUFNB);

  /* Initialize Rx Descriptors list: Chain Mode  */
  ETH_DMARxDescChainInit(DMARxDscrTab, &Rx_Buff[0][0], ETH_RXBUFNB);

  /* Enable Ethernet Rx interrrupt */
    for(i=0; i<ETH_RXBUFNB; i++)
    {
      ETH_DMARxDescReceiveITConfig(&DMARxDscrTab[i], ENABLE);
    }

  for(i=0; i<ETH_TXBUFNB; i++)
  {
    ETH_DMATxDescTransmitITConfig(&DMATxDscrTab[i], ENABLE);
  }

  NVIC_EnableIRQ(ETH_IRQn);

...

void ETH_IRQHandler(void)
{
  /* CANNOT ENTER HERE */
  if (ETH_GetDMAFlagStatus(ETH_DMA_FLAG_R) == SET) 
  {
    /* Give the semaphore to wakeup LwIP task */
        sys_sem_signal(&s_xRxSemaphore);
  }

  /* Clear the interrupt flags. */
  /* Clear the Eth DMA Rx IT pending bits */
  ETH_DMAClearITPendingBit(ETH_DMA_IT_R);
  ETH_DMAClearITPendingBit(ETH_DMA_IT_NIS);
}

So, as i said, Wireshark shows me that there are answers with ARP-requests with mac-adress, but i can't enter in interrupt to process them.

\$\endgroup\$
  • \$\begingroup\$ I'm not familiar with your RTOS, but with the ones I am familiar with you have to call RTOS service functions to install interrupt handlers because all interrupts are funneled through the RTOS. You're treating the interrupts as though its still a bare-metal system. \$\endgroup\$ – brhans Mar 30 '16 at 11:14
1
\$\begingroup\$

Answer for my question is simple - i forgot about basic function for enabling DMA interrupts.

ETH_DMAITConfig(ETH_DMA_IT_NIS | ETH_DMA_IT_R, ENABLE);

where ETH_DMA_IT_NIS interrupt is necessary to include otherwise it wouldn't work for receive (and transmit if need)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.