dear e2e ,
We are working on tms570ls3137 processor for one of our project and ide we are using is ccs v 6.0 .
We are using Ethernet communication by using UDP protocol . I have attached a file containing our code . In that code we are sending 60 bytes of data by using udp_send() function . In our program all function are executing successfully . But we are not getting any data on the other side . can you tell the there any changes are required in our code?
void main(void)
{
/* USER CODE BEGIN (3) */
unsigned char macArray[6] = MAC_ADDRESS;
err_t result = ERR_OK;
for(cnt=0;cnt<9999;cnt++)
{
printf(".");
}
swi_enable_fiq_irq();
add_device("sciPrn", _SSA, sciPrnOpen, sciPrnClose, sciPrnRead,
sciPrnWrite, sciPrnLseek, sciPrnUnlink, sciPrnRename);
if (!freopen("sciPrn:stdoutFile", "w", stdout))
{
while (1);
}
if (setvbuf(stdout, (char *)s_myIOBuf, _IOLBF, 256))
{
// failed to setvbuf stdout
while (1);
}
// initialize RTI (to 1ms Tick count)
rtiInit();
rtiEnableNotification(1);
rtiStartCounter(0);
result = lwIPInit(0, macArray, STATIC_IP_ADDRESS, 0xFFFFFF00, 0, IPADDR_USE_STATIC);
if (result != ERR_OK)
{
printf("Test aborted...\n\r");
while( 1 );
}
struct udp_pcb *pcb;
err_t error;
struct pbuf *p;
struct netif hdkNetIF;
uint8_t data[60],i=0;
for(i=0;i<60;i++)
data[i]= 66;
printf("Link established...\n\r");
p = pbuf_alloc(PBUF_IP, UDP_HLEN, PBUF_RAM);
p->next = 0 ;
p->len = 60 ;
p->tot_len = 60 ;
p->payload = (void *)data;
struct ip_addr ip_des;
struct ip_addr ip_src;
struct ip_addr net_mask;
struct ip_addr gw_addr;
ip_src.addr = 0xC0A80003;
ip_des.addr = 0xC0A80005;
net_mask.addr = 0xFFFFFF00;
gw_addr.addr = 0 ;
unsigned int InstNum=0;
pcb = udp_new();
//(void)netif_add(&hdkNetIF, ip_src, net_mask, gw_addr, &InstNum ,hdkif_init, ip_input);
error = udp_bind(pcb,&ip_src,8000);
error = udp_connect(pcb,&ip_des,8001);
while(1)
{
delay();delay();delay();delay();delay();delay();delay();delay();delay();delay();delay();delay();delay();delay();delay();delay();delay();delay();
printf("Data sending...\n\r");
error = udp_send(pcb,p);
// error = udp_sendto(pcb,p,&ip_des,3200);
// udp_recv(pcb ,);
}
/* USER CODE END */
/* USER CODE END */
}