Can't send UDP packet with Infineon XMC 4500 RelaxKit

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
SandraLewisFrin
Level 1
Level 1
10 sign-ins 5 questions asked 5 sign-ins

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);
        }
    }
}

  posted code for the I/O board or for the server application? What is the I/O board expecting to receive over voojioshagle ethernet 

0 Likes
1 Solution
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @SandraLewisFrin,

Can you check if button1 is equal to zero when the input read at DIGITAL_IO_1  is low?

The packet will be sent only if the control enters the else condition 

else {
          DIGITAL_IO_SetOutputHigh(&DIGITAL_IO_0);
	  udp_send(pcb, pb);
     }

Regards,
Nikhil

View solution in original post

0 Likes
5 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Sandra,

Requesting you to create the thread in the right category(XMC) so that you could get a faster response. Currently this thread has been moved to the right category. Could you please share more details about your ethernet configuration.

Kindly check our example database while we look into the exact issue.

https://www.infineon.com/cms/en/product/promopages/aim-mc/dave_downloads.html

Best Regards,
Vasanth

0 Likes
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @SandraLewisFrin,

Wireshark and the ping activity are showing opposite observations in your case. Can you provide screenshots of your observations in Wireshark? Also, provide screenshots of the ping activity. 

Is there a minimal project which you can share to check the issue at our end?

Regards,
Nikhil

0 Likes
SandraLewisFrin
Level 1
Level 1
10 sign-ins 5 questions asked 5 sign-ins

the posted code seems to be trying to output the string "Hello World!" to your controller board, repeatedly, while one of the buttons is pressed. Does your controller board have any idea what to do with that string?

0 Likes
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @SandraLewisFrin,

Can you check if button1 is equal to zero when the input read at DIGITAL_IO_1  is low?

The packet will be sent only if the control enters the else condition 

else {
          DIGITAL_IO_SetOutputHigh(&DIGITAL_IO_0);
	  udp_send(pcb, pb);
     }

Regards,
Nikhil

0 Likes
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @SandraLewisFrin,

The thread was locked due to inactivity for a long time, you can continue the discussion on the topic by opening a new thread with reference to the locked one. The continuous discussion in an inactive thread may mostly be unattended by community users.

Regards,
Nikhil

0 Likes