Hello,
I want to send data to my PC form my board by UDP. My code doesn't work:
struct pbuf *p;
int main(void)
{
unsigned char macArray[6] = MAC_ADDRESS;
unsigned int ipAddr;
/* Set up the UART2 peripheral */
UartSetUp();
/* Set up the pin multiplex for EMAC and MDIO and enable PSC */
EMACPinMuxSetup();
PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_EMAC, PSC_POWERDOMAIN_ALWAYS_ON,
PSC_MDCTL_NEXT_ENABLE);
EMACIntrSetUp();
/* Initialze the lwIP library, using DHCP.*/
#if STATIC_IP_ADDRESS
ipAddr = lwIPInit(0, macArray, STATIC_IP_ADDRESS, 0, 0, IPADDR_USE_STATIC);
#else
ipAddr = lwIPInit(0, macArray, 0, 0, 0, IPADDR_USE_DHCP);
#endif
IpAddrDisplay(ipAddr);
LocatorConfig(macArray, "evmAM1808 enet_lwip");
struct udp_pcb * pcb;
/* get new pcb */
pcb = udp_new();
udp_bind(pcb, IP_ADDR_ANY, 1235);
udp_recv(pcb, udp_echo_recv, NULL);
char tab="TEST";
memcpy(p->payload, tab, strlen(tab));
// udp_connect(pcb, ipAddr,2000);
while(1)
{
udp_sendto(pcb, p,IP_ADDR_BROADCAST,1234);
delay(500);
pbuf_free(p);
}
}
I'm using UDP test tool but nothing received. In cmd window I ping IP and I get responses. I change settings in firewall. What should I do to connect with PC?
Regards,