Can't send UDP packet with Infineon XMC 4500 RelaxKit

447 views Asked by At

i recently got an Infineon XMC4500 RelaxKit with an Ethernet Port to automate my house. I want to communicate from a server to the board (controlling different relays and such) through UDP. But i encountered an issue.

The board doesn't send anything, according to WireShark, but i can ping it successfully. Also, while pinging the board, the ethernet activity light doesn't flash at all, if that helps.

This is my code:

#include <DAVE.h>
int main(void)
{
    DAVE_Init();
    uint32_t button1;
    char str[512] = "Hello World!";
    ip_addr_t ip;
    ip.addr = 0xC0A8091;//192.168.0.145
    struct pbuf * pb;
    pb = pbuf_alloc(PBUF_TRANSPORT, 512, PBUF_REF);
    pb->payload = str;
    pb->len = pb->tot_len = 512;
    u16_t port = 5005;

    struct udp_pcb* pcb = udp_new();
    udp_connect(pcb, &ip, port);

    /* Placeholder for user application code. The while loop below can be replaced with user application code. */
    while(1U)
    {
        sys_check_timeouts();
        DIGITAL_IO_SetOutputLow(&DIGITAL_IO_0);
        button1 = DIGITAL_IO_GetInput(&DIGITAL_IO_1);
        if ( button1 == 1 ) {
            DIGITAL_IO_SetOutputLow(&DIGITAL_IO_0);
        }
        else {
            DIGITAL_IO_SetOutputHigh(&DIGITAL_IO_0);
            udp_send(pcb, pb);
        }
    }
}

The code is written in the DAVE IDE from Infineon.

1

There are 1 answers

2
Korvet On

ip.addr should be 0x9100A8C0 for 192.168.0.145