cancel
Showing results for 
Search instead for 
Did you mean: 

i need to connect two stm32 udp with a switch to pc

TARHAN SAMAH
Senior
Posted on April 26, 2018 at 09:33

hello when i connect two stm32 one ip 1.1.88 port 88 the other one is 1.1.70 port 70 to a with switch device using udp to a remote pc ethernet ip 1.1.89 , if one send data the other stm cannot send ???? separatly they can work very good

on the same time they cannot work ??

do i need a special switch for that ??? which one

thanks

Note: this post was migrated and contained many threaded conversations, some content may be missing.
15 REPLIES 15
Posted on April 30, 2018 at 13:49

extern struct netif gnetif;

extern uint8_t IP_ADDRESS[4];//we bring it from lwip to change it by keypad it will be gdt num

struct netconn *conn;//the abstraction of a network connection.

struct netbuf *buf_rx;

uint8_t ETH_store[100];

uint8_t tx_store[40];

uint8_t tx_buf_size=0;

uint8_t local_port=60;

uint8_t remote_port=61;//or locip4+1; its my choice u can select differently

ip_addr_t local_ip;//master stm32 locip1.locip2.locip3.locip4

ip_addr_t remote_ip;//pc host remip1.remip2.remip3.remip4

/* USER CODE BEGIN 5 */

printf('\n\r OUR MAC adress:%d-%d-%d-%d-%d-%d-', gnetif.hwaddr[0], gnetif.hwaddr[1], gnetif.hwaddr[2], gnetif.hwaddr[3], gnetif.hwaddr[4], gnetif.hwaddr[5]);

printf('\r\n ETHERNET STM32F429ZI lwip init complete');

while(gnetif.ip_addr.addr==0) osDelay(1);//wait the ip to reach the structure

printf('\r\n OUR Static ip adress:%s',ip4addr_ntoa(&gnetif.ip_addr));

local_ip =gnetif.ip_addr;

printf('\r\n local port=%d-',local_port);

IP4_ADDR(&remote_ip,10, 1, 1,89);

printf('\r\n OUR remote ip adress:%s',ip4addr_ntoa(&remote_ip));

printf('\r\n remote port=%d-',remote_port);
Posted on April 30, 2018 at 13:52

hi i declare this way 

ip_addr_t local_ip;

ip_addr_t remote_ip;

then i fix it :

for local by cubemx if static 

0690X0000060Ap4QAE.png

and for remote this way in my application :

IP4_ADDR(&remote_ip,10, 1, 1,89); 

Posted on May 02, 2018 at 09:30

hi

doumandjisamah

my whatsapp is +918563078782

please connect with me i have still some problems.

Posted on May 02, 2018 at 13:18

hi

doumandjisamah

Very very thank you for your all support ,

Now i am able to connect my UDP port.

Done Successfully .

I want to stay connected with you for good relationship and friendship.

please contact me

pawan kumar sharma

whatsapp- +918563078782

phone - +918707394591

Posted on May 02, 2018 at 13:37

Consider using the Private Messaging, mouse over user name, or click thru to profile.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 02, 2018 at 15:03

happy for your success hope you understand the communication udp me too im begginer also in this field , its hard to find good support unfortenetly just people gives you half info and let you guess or tell you go look at docs

:(