I tried what you said but the code is getting stuck i don't know why can you please suggent what needs to be fixed
//==============================================================================================================
// Wifi station + UDP client side :
Code: Select all
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:6896
ho 0 tail 12 room 4
load:0x40078000,len:13076
load:0x40080400,len:3900
0x40080400: _init at ??:?
entry 0x40080688
I (31) boot: ESP-IDF v4.1.3-dirty 2nd stage bootloader
I (31) boot: compile time 12:58:09
I (31) boot: chip revision: 3
I (34) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (42) boot.esp32: SPI Speed : 40MHz
I (46) boot.esp32: SPI Mode : DIO
I (51) boot.esp32: SPI Flash Size : 4MB
I (55) boot: Enabling RNG early entropy source...
I (61) boot: Partition Table:
I (64) boot: ## Label Usage Type ST Offset Length
I (72) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (79) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (86) boot: 2 factory factory app 00 00 00010000 00100000
I (94) boot: End of partition table
I (98) boot_comm: chip revision: 3, min. application chip revision: 0
I (105) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x15ec0 ( 89792) map
I (148) esp_image: segment 1: paddr=0x00025ee8 vaddr=0x3ffb0000 size=0x03180 ( 12672) load
I (154) esp_image: segment 2: paddr=0x00029070 vaddr=0x40080000 size=0x00404 ( 1028) load
0x40080000: _WindowOverflow4 at /media/swapnil/Bibox/ESP_IDF/esp-idf/components/freertos/xtensa_vectors.S:1778
I (156) esp_image: segment 3: paddr=0x0002947c vaddr=0x40080404 size=0x06b9c ( 27548) load
I (176) esp_image: segment 4: paddr=0x00030020 vaddr=0x400d0020 size=0x6e1d8 (451032) map
0x400d0020: _stext at ??:?
I (348) esp_image: segment 5: paddr=0x0009e200 vaddr=0x40086fa0 size=0x0e1c4 ( 57796) load
0x40086fa0: spiflash_start at /media/swapnil/Bibox/ESP_IDF/esp-idf/components/spi_flash/esp_flash_api.c:85
I (385) boot: Loaded app from partition at offset 0x10000
I (385) boot: Disabling RNG early entropy source...
I (386) cpu_start: Pro cpu up.
I (389) cpu_start: Application information:
I (394) cpu_start: Project name: udp_client
I (399) cpu_start: App version: 1
I (404) cpu_start: Compile time: May 21 2022 12:57:59
I (410) cpu_start: ELF file SHA256: f7c6e5a6d69d77d1...
I (416) cpu_start: ESP-IDF: v4.1.3-dirty
I (421) cpu_start: Starting app cpu, entry point is 0x400812f4
0x400812f4: call_start_cpu1 at /media/swapnil/Bibox/ESP_IDF/esp-idf/components/esp32/cpu_start.c:276
I (0) cpu_start: App cpu up.
I (432) heap_init: Initializing. RAM available for dynamic allocation:
I (439) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (445) heap_init: At 3FFB80E8 len 00027F18 (159 KiB): DRAM
I (451) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (457) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (464) heap_init: At 40095164 len 0000AE9C (43 KiB): IRAM
I (470) cpu_start: Pro cpu start user code
I (488) spi_flash: detected chip: generic
I (489) spi_flash: flash io: dio
I (489) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (580) wifi:wifi driver task: 3ffc0680, prio:23, stack:6656, core=0
I (580) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (580) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (610) wifi:wifi firmware version: d333e55
I (610) wifi:config NVS flash: enabled
I (610) wifi:config nano formating: disabled
I (610) wifi:Init data frame dynamic rx buffer num: 32
I (620) wifi:Init management frame dynamic rx buffer num: 32
I (620) wifi:Init management short buffer num: 32
I (630) wifi:Init dynamic tx buffer num: 32
I (630) wifi:Init static rx buffer size: 1600
I (630) wifi:Init static rx buffer num: 10
I (640) wifi:Init dynamic rx buffer num: 32
I (640) wifi_init: rx ba win: 6
I (650) wifi_init: tcpip mbox: 32
I (650) wifi_init: udp mbox: 6
I (650) wifi_init: tcp mbox: 6
I (660) wifi_init: tcp tx win: 5744
I (660) wifi_init: tcp rx win: 5744
I (660) wifi_init: tcp mss: 1440
I (670) wifi_init: WiFi IRAM OP enabled
I (670) wifi_init: WiFi RX IRAM OP enabled
I (680) example_connect: Connecting to myssid...
I (680) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (820) wifi:mode : sta (7c:9e:bd:d8:4e:b4)
I (820) example_connect: Waiting for IP
I (2870) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (3630) wifi:state: init -> auth (b0)
I (3640) wifi:state: auth -> assoc (0)
I (3660) wifi:state: assoc -> run (10)
I (3670) wifi:connected with myssid, aid = 1, channel 1, 40U, bssid = 7c:9e:bd:d8:53:f1
I (3670) wifi:security: WPA2-PSK, phy: bgn, rssi: -30
I (3670) wifi:pm start, type: 1
I (3730) wifi:AP's beacon interval = 102400 us, DTIM period = 2
I (4560) esp_netif_handlers: sta ip: 192.168.43.43, mask: 255.255.255.0, gw: 192.168.43.42
I (4560) example_connect: Got IP event!
I (5560) example_connect: Got IPv6 event!
I (5560) example_connect: Connected to myssid
I (5560) example_connect: IPv4 address: 192.168.43.43
I (5560) example_connect: IPv6 address: fe80:0000:0000:0000:7e9e:bdff:fed8:4eb4
I (5570) example: Socket created, sending to 192.168.0.165:3333
I (5580) example: Message sent
//==============================================================================================
// Wifi Ap mode + UDP server side
//=====================================================
Code: Select all
rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:6896
ho 0 tail 12 room 4
load:0x40078000,len:13076
load:0x40080400,len:3900
0x40080400: _init at ??:?
entry 0x40080688
I (31) boot: ESP-IDF v4.1.3-dirty 2nd stage bootloader
I (31) boot: compile time 14:39:53
I (31) boot: chip revision: 3
I (34) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (42) boot.esp32: SPI Speed : 40MHz
I (46) boot.esp32: SPI Mode : DIO
I (51) boot.esp32: SPI Flash Size : 4MB
I (55) boot: Enabling RNG early entropy source...
I (61) boot: Partition Table:
I (64) boot: ## Label Usage Type ST Offset Length
I (72) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (79) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (86) boot: 2 factory factory app 00 00 00010000 00100000
I (94) boot: End of partition table
I (98) boot_comm: chip revision: 3, min. application chip revision: 0
I (105) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x15bb0 ( 89008) map
I (148) esp_image: segment 1: paddr=0x00025bd8 vaddr=0x3ffb0000 size=0x03180 ( 12672) load
I (154) esp_image: segment 2: paddr=0x00028d60 vaddr=0x40080000 size=0x00404 ( 1028) load
0x40080000: _WindowOverflow4 at /media/swapnil/Bibox/ESP_IDF/esp-idf/components/freertos/xtensa_vectors.S:1778
I (155) esp_image: segment 3: paddr=0x0002916c vaddr=0x40080404 size=0x06eac ( 28332) load
I (176) esp_image: segment 4: paddr=0x00030020 vaddr=0x400d0020 size=0x6e88c (452748) map
0x400d0020: _stext at ??:?
I (349) esp_image: segment 5: paddr=0x0009e8b4 vaddr=0x400872b0 size=0x0deb4 ( 57012) load
0x400872b0: doBacktrace at /media/swapnil/Bibox/ESP_IDF/esp-idf/components/esp32/panic.c:497
I (386) boot: Loaded app from partition at offset 0x10000
I (386) boot: Disabling RNG early entropy source...
I (386) cpu_start: Pro cpu up.
I (390) cpu_start: Application information:
I (395) cpu_start: Project name: udp_server
I (400) cpu_start: App version: 1
I (404) cpu_start: Compile time: May 27 2022 14:39:42
I (410) cpu_start: ELF file SHA256: 516fc0c9329ee0d2...
I (416) cpu_start: ESP-IDF: v4.1.3-dirty
I (422) cpu_start: Starting app cpu, entry point is 0x400812f4
0x400812f4: call_start_cpu1 at /media/swapnil/Bibox/ESP_IDF/esp-idf/components/esp32/cpu_start.c:276
I (0) cpu_start: App cpu up.
I (432) heap_init: Initializing. RAM available for dynamic allocation:
I (439) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (445) heap_init: At 3FFB80C0 len 00027F40 (159 KiB): DRAM
I (451) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (458) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (464) heap_init: At 40095164 len 0000AE9C (43 KiB): IRAM
I (470) cpu_start: Pro cpu start user code
I (489) spi_flash: detected chip: generic
I (489) spi_flash: flash io: dio
I (489) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (585) wifi:wifi driver task: 3ffc08f0, prio:23, stack:6656, core=0
I (585) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (585) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (615) wifi:wifi firmware version: d333e55
I (615) wifi:config NVS flash: enabled
I (615) wifi:config nano formating: disabled
I (615) wifi:Init data frame dynamic rx buffer num: 32
I (615) wifi:Init management frame dynamic rx buffer num: 32
I (625) wifi:Init management short buffer num: 32
I (625) wifi:Init dynamic tx buffer num: 32
I (635) wifi:Init static rx buffer size: 1600
I (635) wifi:Init static rx buffer num: 10
I (645) wifi:Init dynamic rx buffer num: 32
I (645) wifi_init: rx ba win: 6
I (645) wifi_init: tcpip mbox: 32
I (655) wifi_init: udp mbox: 6
I (655) wifi_init: tcp mbox: 6
I (665) wifi_init: tcp tx win: 5744
I (665) wifi_init: tcp rx win: 5744
I (665) wifi_init: tcp mss: 1440
I (675) wifi_init: WiFi IRAM OP enabled
I (675) wifi_init: WiFi RX IRAM OP enabled
I (685) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (785) wifi:mode : softAP (7c:9e:bd:d8:53:f1)
I (795) wifi:Total power save buffer number: 16
I (795) wifi:Init max length of beacon: 752/752
I (795) wifi:Init max length of beacon: 752/752
I (795) wifi softAP WITH udp: wifi_init_softap finished. SSID:myssid password:mypassword channel:1
I (805) wifi softAP WITH udp: Socket created
I (815) wifi softAP WITH udp: Socket bound, port 3333
I (815) wifi softAP WITH udp: Waiting for data
I (2885) wifi:new:<1,1>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1
I (2885) wifi:station: 7c:9e:bd:d8:4e:b4 join, AID=1, bgn, 40U
I (2905) wifi softAP WITH udp: station 7c:9e:bd:d8:4e:b4 join, AID=1
I (2925) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.43.43
what i have found the connection is being formed between wifi AP and wifi station and also sockets are being created both side
OnUDP client side : after socket are formed the UDP sents a packet and waits to receive a packet but here after sending the packet but gets stuck on receive function that is where it has to receive the packet from the UDP server
int len = recvfrom(sock, rx_buffer, sizeof(rx_buffer) - 1, 0, (struct sockaddr *)&source_addr, &socklen);
On UDP server side : after socket is formed the UDP first hast to receive the packet form the cient but that's not happing it is getting stuck at :
int len = recvfrom(sock, rx_buffer, sizeof(rx_buffer) - 1, 0, (struct sockaddr *)&source_addr, &socklen);
Is their a fault in IP address or something else; if yes from where to change it
thanks,