This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Some questions about Ethernet under Stm32f10x

Hi,
I have some basic questions that I will appropriate to answer and help me.

1)for a secure Ethernet connection , is this code sufficient for renewing disconnect , preventing from disconnection and hanging ? or I should some changes?



int32_t tcp_sock;
uint8_t *sendbuf;

uint32_t tcp_cb_func (int32_t socket, netTCP_Event event,const NET_ADDR *addr, const uint8_t *buf, uint32_t len) {
   switch (event) {
    case netTCP_EventConnect:return (1);
    case netTCP_EventData:
        //Save Received data
        netTCP_ResetReceiveWindow(tcp_sock);
                }
  return (0);
}


int main(){

        netInitialize ();

        tcp_sock = netTCP_GetSocket (tcp_cb_func);
                if (tcp_sock >= 0) {
                netTCP_Listen (tcp_sock, 9999);
                netTCP_SetOption (tcp_sock, netTCP_OptionTimeout, 30);
                }

 while(1)
  {
  // Do something


                if (netTCP_SendReady (tcp_sock)) {
                        if(netTCP_GetMaxSegmentSize (tcp_sock)>Maxlen){
                                sendbuf =  netTCP_GetBuffer (Maxlen);
                                memcpy (sendbuf, Message, Maxlen);
                                netTCP_Send(tcp_sock, sendbuf,Maxlen);
                                }
                }

  }


}

2)it is possible to send and receive data simultaneously?(it means when I call netTCP_Send can I receive new data and store them or it should transfer all data and after that it will be able to interrupt it's transmission )? how can detect that our chip is under receiving or transmitting mode?

3)The Network core + TCP/IP use systick timer for it's own interrupts with high priority? if I change NVIC group and set other interrupt with IRQ number more than 2 would it be possible the network work fine?(my mean is that other interrupt may cause fault for network? and whats is priority of " tcp_cb_func " interrupt ?)

4)does Network core use DMA for transmitting and receiving?

Thanks in advance