cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746ZG+PHY+LwIP+Interrupts mode +without os

Em R
Associate
Posted on February 10, 2017 at 08:59

we are working on STM32F7 nucleo 144 board.we are successfully tested the LWIP+POLLING MODE with the help of example STM32Cube_FW_F7_V1.6.0\Projects\STM32756G_EVAL\Applications\LwIP_Tcp_Echo_Client.

we are using cubmx 4.19 and MDK keil without OS.

requirement :implement LWIP+PHY Rx-Tx interrupts

steps to be done :

    :enable Global_interrupts

    :for that the configuration should changed to POLLING_MODE TO ETH_RXINTERRUPT_MODE

    : NO_SYS 1

what process will be required for Interrupts mode with ref. to Polling mode.in polling mode the MX_LWIP_PROCESS() call in main ethernetif_input() read a received packet from the eth buffers.

but what about Interrupts mode how do I handle all these in Interrupts mode.

also in polling mode the call back functions are implemented in LWIP stack. send and receiving data condition handled by these call back functions.how do I implement these callback functions in interrupts mode or any other way.

I found demo code which is implemented in interrupts mode but with RTOS  :

 /* create the task that handles the ETH_MAC */

  osThreadDef(EthIf, ethernetif_input, osPriorityRealtime, 0, INTERFACE_THREAD_STACK_SIZE);

  osThreadCreate (osThread(EthIf), netif);

to achieved these without RTOS the following steps are done :

at current stage of development we implement interrupts ISR generated by Cubemx. when the data will received the application will enter in ISR.

we called HAL_ETH_RxcpltCallback(); rx transfer completed callback in ISR . means ones rx data received rx callback function will process for incoming data using following code :

void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *heth)

{

    ethernetif_input(&gnetif);

} //is that Ok...?

also changes in following code...

static struct pbuf * low_level_input(struct netif *netif)

{

struct pbuf *p = NULL;

struct pbuf *q = NULL;

uint16_t len = 0;

uint8_t *buffer;

  __IO ETH_DMADescTypeDef *dmarxdesc;

uint32_t bufferoffset = 0;

uint32_t payloadoffset = 0;

uint32_t byteslefttocopy = 0;

uint32_t i=0;

  /* get received frame */

  /*if (HAL_ETH_GetReceivedFrame(&heth) != HAL_OK)

    return NULL;*/

    if(HAL_ETH_GetReceivedFrame_IT(&heth) != HAL_OK) //interrupts mode

    return NULL;

.......

}

I also add some debug massages in HAL_ETH_GetReceivedFrame_IT(); but at point,

buffer = (uint8_t *)heth.RxFrameInfos.buffer;

the data will be wrong. actually we are sending and receiving some public keys to server and from server to board. our server is Ui on remote PC.

so what is the RIGHT steps for receiving buffer.

Before sending any data the tcp connection will be established these can be done by tcp_connect();

in tcp_connect() there is callback functions for rx and tx data.

what should we do with these callback functions in Interrupts mode.

one option is to customize the tcp_connect() according to tx and rx data separately.

any suggestions.... ?

thanks in advanced..

#stm32f746zg+lwip+interrupts-mode+-without-os
1 REPLY 1
Aurelien Robert
Associate III
Posted on June 27, 2017 at 00:39

Hello,

Did you solve your issues and adapt the drivers to get received data handled by interrupt ?

Aurelien