2024-03-13 05:00 AM
I am using the STM32F107VCT6 controller. use STMcubeIDE.
I write the code of the UDP Server. but when I change the IP, subnet, and Gateway using TCP and reset the device. I do not get Broadcast info or the udp_recv function not working.
void udpServer_init(void)
{
2024-03-13 10:37 AM
> err = udp_bind(upcb, IP_ADDR_ANY , 1225); // 7 is the server UDP port
Which is it - port 1225 or port 7?
What IP/mask/gateway values worked? What are the IP address/mask/gateway settings of the device sending the UDP broadcast?
2024-03-13 09:15 PM
IP : 192.168.4.111
Subnetmask : 255.255.255.0
Gateway : 192.168.4.1
and port : 1225
2024-03-15 07:08 AM
Maybe I mis-understood your original post because you re-posted the same IP address as in your first post. Did this code EVER work? To me it sounded like it worked, and then you changed the IP address and it stopped working.
If it DID work and now does not - provide BOTH the original IP address info and new IP address info
What is the IP address of the device that is sending the UDP broadcasts?
What does your program print on the serial port?
Do you call MX_LwIP_Process() somewhere in your main loop?
2024-03-20 02:48 AM
First, I Set the Value of IP: 192.168.4.111, SUBNET: 255.255.255.0, GATEWAY: 192.168.4.1.
and Using TCP, I Change the IP:10.10.10.11, SUBNET: 255.0.0.0, GATEWAY: 10.10.10.1. I change the value in LWIP. C file (Call MX_LWIP_Init() Function). then I Call UDP function. First Bind the UDP, then wait for receive DATA. But not get any Receive data.
For Data Sending I Use Docklight Application and for UDP connect I set The Docklight IP (example UDP:255.255.255.255:1225).
2024-03-21 11:04 AM
OK - you answered ONE of my questions.
(1) So your code receives UDP broadcasts with IP = 192.168.4.111 and does not receive UDP broadcasts with IP = 10.10.10.11, is that correct?
(2) What is the IP address of the device SENDING the UDP packets (I presume this is you PC)?
(3) What network equipment is between the SENDER and your STM32 board? An ethernet switch? A router/firewall? The 'company intranet"?
(4) What does your program output on its serial/console port?
2024-03-21 10:13 PM
1.So your code receives UDP broadcasts with IP = 192.168.4.111 and does not receive UDP broadcasts with IP = 10.10.10.11, is that correct?
Ans - Yes. Does not receive UDP Broadcast with 10.10.10.11.
2. What is the IP address of the device SENDING the UDP packets (I presume this is your PC)?
Ans - Yes, it is my PC. and The IP address is range same as 192.168.4.121.
3. What network equipment is between the SENDER and your STM32 board? An ethernet switch? A router/firewall? The 'company intranet"?
Ans - The Network equipment is between the Sender and STM32 Board is Ethernet Switch.
4. What does your program output on its serial/console port?
Ans - I just check on serial port receive data.
2024-03-22 12:58 PM
Can't explain it. Grasping at straws - make sure the interface is up on the STM32 with 10.10.10.11 IP address. Don't know why it wouldn't, but worth checking. Run wireshark on your PC and make sure the packet actually gets sent. Again, I don't know why it wouldn't, but worth checking.