Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find devie's AP after init camera on ESP32S3 #626

Closed
AxelLin opened this issue Jan 23, 2024 · 13 comments
Closed

Cannot find devie's AP after init camera on ESP32S3 #626

AxelLin opened this issue Jan 23, 2024 · 13 comments

Comments

@AxelLin
Copy link

AxelLin commented Jan 23, 2024

Cannot find devie's AP after init camera on ESP32S3

Test on esp-idf master, 5.2 branch and 5.1 branch.

If I call esp_camera_init() before starting AP.
The console log does not show any error but I usually cannot find the device's AP.
In most of my test, I just cannot find the device's AP.
Sometimes, I can find the device's AP but failed to join it:

I (43253) wifi:removing station <20:1e:88:5e:2b:3f> after unsuccessful auth/assoc, AID = 0
W (43254) wifi:rm mis
I (43254) wifi:new:<6,0>, old:<6,0>, ap:<6,0>, sta:<0,0>, prof:6

However, if I comment out the esp_camera_init() everything looks fine.

I also tested on ESP32 and ESP32 works, only ESP32S3 fails.
But on ESP32 the wifi is very slow after init camera.

@me-no-dev
Copy link
Member

I would guess that this is connected to the previous issue, though I do not see a workaround from our end for this.

@igrr would someone from IDF/WiFi team look into this?

@me-no-dev
Copy link
Member

@AxelLin can you try to run the camera on the other core? Let's see if maybe WiFi and Camera tasks starve each other

@AxelLin
Copy link
Author

AxelLin commented Jan 23, 2024

@AxelLin can you try to run the camera on the other core? Let's see if maybe WiFi and Camera tasks starve each other

I tried "CORE0", "CORE1" and "NO_AFFINITY" on v5.1.2-622-g47b44dfa71, the same issue.

@igrr
Copy link
Member

igrr commented Jan 23, 2024

@AxelLin could you please add some details about the hardware (board) you are using?

@AxelLin
Copy link
Author

AxelLin commented Jan 23, 2024

I tested on "Freenove ESP32-S3-WROOM Board".

@AxelLin
Copy link
Author

AxelLin commented Jan 24, 2024

I did another test on S3:

  1. Start AP first
    I can find the AP, and I can join the AP.
  2. Delay 30 sec
    It looks fine before calling esp_camera_init()
  3. Call esp_camera_init()
    After calling esp_camera_init() the AP disappear and I got below log immediately:
    I (35486) wifi:station: 20:1e:88:5e:2b:3f leave, AID = 1, bss_flags is 658531, bss:0x3fcda26c
    I (35487) wifi:new:<6,0>, old:<6,0>, ap:<6,0>, sta:<0,0>, prof:6
    I (35490) wifi:idx:2, tid:0

Below is the log after calling esp_camera_init() in CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=y build:

To init camera
I (37079) s3 ll_cam: DMA Channel=4
I (37083) cam_hal: cam init ok
D (37087) camera: Enabling XCLK output
D (37090) camera: Initializing SCCB
I (37094) sccb: pin_sda 4 pin_scl 5
I (37098) sccb: sccb_i2c_port=1
V (37102) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (37108) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (37117) intr_alloc: Connected src 43 to int 18 (cpu 0)
D (37122) camera: Searching for camera address
I (37136) camera: Detected camera at address=0x30
I (37144) camera: Detected OV2640 camera
D (37153) ov2640: OV2640 Attached
I (37156) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
D (37163) camera: Doing SW reset of sensor
V (37215) wifi:tx process: alloc static tx buf, pb=0x3fcdbc04 l=54 hdr=0 data=54
I (37244) cam_hal: buffer_size: 16384, half_buffer_size: 1024, node_buffer_size: 1024, node_cnt: 16, total_cnt: 93
I (37244) cam_hal: Allocating 96000 Byte frame buffer in PSRAM
V (37251) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (37257) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x50E
D (37266) intr_alloc: Connected src 70 to int 19 (cpu 0)
V (37271) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (37277) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x50E
D (37286) intr_alloc: Connected src 24 to int 19 (cpu 0)
I (37291) cam_hal: cam config ok
D (37295) camera: Setting frame size to 800x600
I (37300) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8
Init camera done

V (38236) wifi:tx process: alloc static tx buf, pb=0x3fcd8490 l=54 hdr=0 data=54
D (38797) wifi:ap recv deauth/disassoc from sta 20:1e:88:5e:2b:3f, reason:980
I (38797) wifi:station: 20:1e:88:5e:2b:3f leave, AID = 1, bss_flags is 658531, bss:0x3fcdaf70
I (38801) wifi:new:<6,0>, old:<6,0>, ap:<6,0>, sta:<0,0>, prof:6
D (38807) wpa: ELOOP: wpa_auth_sta_deinit:508 called to remove timer handler=0x4204ae90, removed count=0
0x4204ae90: resend_eapol_handle at /home/axel/esp/esp-idf/components/wpa_supplicant/src/ap/wpa_auth.c:1177

D (38816) wpa: del sm, index=0 bitmap=0
D (38820) wpa: wpa_free_sta_sm: free eapol=0x3fcd5b38

I (38826) wifi:<ba-del>idx:2, tid:0
D (38829) event: running post WIFI_EVENT:15 with handler 0x42013ea0 and context 0x3fcb7ab0 on loop 0x3fcb1734

I (38839) net_utils: station 20:1e:88:5e:2b:3f leave, AID=1
D (38845) event: running post WIFI_EVENT:15 with handler 0x4200b800 and context 0x3fcd586c on loop 0x3fcb1734

D (38865) wifi:no bcast bss, send deauth: reason not authed(6)

@leeebo
Copy link

leeebo commented Jan 24, 2024

Hi @AxelLin I did the same test, call esp_camera_init() before starting AP. with esp32s3-eye hardware and ESP-IDF latest release/v5.2, both Camera and Wi-Fi work well for me. Would you please double check your hardware, whether there is a power supply or antenna problem ?

@Xiehanxin
Copy link

hi @AxelLin from the log we can see
D (38797) wifi:ap recv deauth/disassoc from sta 20:1e:88:5e:2b:3f, reason:980
it shows that the STA send the deauth/disassoc to AP actively. and the number 980 is got from the deauth/disassoc field.
the real reason might need a wireless package.

@AxelLin
Copy link
Author

AxelLin commented Jan 24, 2024

Would you please double check your hardware, whether there is a power supply or antenna problem ?

@leeebo
It works with STA + camera (v2.0.7) , so I think the power supply and the onboard antenna is fine.
(I also try power by adapter or power-bank, the same symptom).

Just wondering if you have a chance to test this board: https://github.com/Freenove/Freenove_ESP32_S3_WROOM_Board

@AxelLin
Copy link
Author

AxelLin commented Jan 24, 2024

hi @AxelLin from the log we can see D (38797) wifi:ap recv deauth/disassoc from sta 20:1e:88:5e:2b:3f, reason:980 it shows that the STA send the deauth/disassoc to AP actively.

@Xiehanxin

You seems imply the issue is beause the sta actively deauth/disassoc to AP.
But this symptom does not happen when camera is not inited.

Attached another detail log of verbose build:
I don't find any error message, only found below warning messages before deauth:
(ps. I don't observe below warngins if camera is not inited)
W (19059) wifi:[ADDBA]rx delba, code:37, delete tid:0
I (19060) wifi:idx:2, tid:0
W (19060) wifi:[ADDBA]rx delba, code:37, delete tid:0

Then the device got
wifi:ap recv deauth/disassoc from sta 20:1e:88:5e:2b:3f, reason:58

s3_esp32cam_ap.log

@AxelLin
Copy link
Author

AxelLin commented Jan 26, 2024

Hi @me-no-dev

FYI, #629 does not help for this issue.
I tried both LCD_CAM_ISR_IRAM_SAFE=y and LCD_CAM_ISR_IRAM_SAFE=n, no difference.
The AP still disappear after init camera.
Thanks anyway.

@me-no-dev
Copy link
Member

@AxelLin that would mean that the issue is not in GDMA or IRAM ISR. It does fix the previous (STA) issue, so you should not feel a delay when WiFi starts.

@AxelLin
Copy link
Author

AxelLin commented Feb 22, 2024

I cannot reproduce this issue now after change test location.

@AxelLin AxelLin closed this as completed Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants