cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate uIP stack on stm32?

BChav.1
Associate III

Hi,

I am working on stm32 device which is interfaced to LAN9250 using SPI.i want to integrate the stack(i am not considering the lwIP due to very less RAM available on MC.)Has anyone ported uIP stack on stm devices? i want to send UDP packets from MC to host. Please share any example project or links that will help me to port uIP on my MC.

///////////////////////////////////////////////////////////////////////////////////

void uIPInit()

{

 uip_init();

 uip_ipaddr_t ipaddr;

 uip_ipaddr(ipaddr, 0,10,2,0);

 uip_sethostaddr(ipaddr);

 uip_ipaddr(ipaddr, 0,10,5,0);

 uip_setdraddr(ipaddr);

 uip_ipaddr(ipaddr, 255,255,255,0);

 uip_setnetmask(ipaddr);

}

uint8_t my_udp_buf[] = {0x00, 0xAA, 0xBB, 0xCC};

uint8_t data[] ="Data transmit";

uint32_t my_udp_buf_len = 4;

uint8_t ui32Temp;

uip_ipaddr_t addr;

  struct uip_udp_conn *c;

  uip_ipaddr(&addr, 10,0,0,5);

  c = uip_udp_new(&addr, HTONS(12345)); // setting up a new UDP connection to 172.16.23.1:12345 here

    uip_udp_conn = c; // set your connection

     uip_slen = sizeof(data); // set the length of data to send

     memcpy(&uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN], data, sizeof(data) > UIP_BUFSIZE? UIP_BUFSIZE: sizeof(data)); // copy to the buffer

     uip_process(UIP_UDP_SEND_CONN); // tell uip to construct the package

     uip_arp_out(); // attack Ethernet header

     SendETH_Frame(uip_buf, uip_len); // send the packet

     uip_len = 0; // reset length to 0

     uint8_t ret;

ret = Read32Bit(0x058);

if(ret & 0x0008)/*check if data received flag set*/

{

uip_len = tapdev_read();

uip_arp_ipin();

uip_input();

}

This is the code i am using which is not sending the actual data .It is continuously sending ARP request(observed on wireshark).Please share your experience on this.

Thanks

0 REPLIES 0