espressif / esp-drone

Mini Drone/Quadcopter Firmware for ESP32 and ESP32-S Series SoCs.
GNU General Public License v3.0
830 stars 242 forks source link

motors do not spin #92

Closed livigni closed 1 month ago

livigni commented 1 month ago

Describe the bug I am struggling with motors not being operated. The esp-drone boots up and motors spins at the self check, but when connecting with mobile app and playing with touch controls nothing happens. I have enabled the "DEBUG_UDP" in config.h of the firmware and I can see that when moving the virtual joystick udp messages are received by the firmware, but still motor do not spin (no voltage a the motors pins, so I don't think is a low capacity battery issue). Any hints?

Version (please complete the following information):

Logs


rst:0x10 (RTCWDT_RTC_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:1
load:0x3fff0030,len:7012
load:0x40078000,len:15784
load:0x40080400,len:4536
0x40080400: _init at ??:?

entry 0x400806bc
I (27) boot: ESP-IDF v4.4.8-1-ga9d0f22193 2nd stage bootloader
I (27) boot: compile time 19:10:44
I (28) boot: Multicore bootloader
I (32) boot: chip revision: v1.0
I (36) qio_mode: Enabling default flash chip QIO
I (41) boot.esp32: SPI Speed      : 80MHz
I (46) boot.esp32: SPI Mode       : QIO
I (50) boot.esp32: SPI Flash Size : 16MB
I (55) boot: Enabling RNG early entropy source...
I (60) boot: Partition Table:
I (64) boot: ## Label            Usage          Type ST Offset   Length
I (71) 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) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=1f074h (127092) map
I (141) esp_image: segment 1: paddr=0002f09c vaddr=3ffb0000 size=00f7ch (  3964) load
I (143) esp_image: segment 2: paddr=00030020 vaddr=400d0020 size=913c8h (594888) map
I (311) esp_image: segment 3: paddr=000c13f0 vaddr=3ffb0f7c size=03410h ( 13328) load
I (315) esp_image: segment 4: paddr=000c4808 vaddr=40080000 size=18120h ( 98592) load
I (360) boot: Loaded app from partition at offset 0x10000
I (361) boot: Disabling RNG early entropy source...
I (372) cpu_start: Multicore app
I (372) cpu_start: Pro cpu up.
I (373) cpu_start: Starting app cpu, entry point is 0x400813e8
0x400813e8: call_start_cpu1 at /Users/vicio/src/espressif-esp-drone/esp/esp-idf/components/esp_system/port/cpu_start.c:151

I (0) cpu_start: App cpu up.
I (392) cpu_start: Pro cpu start user code
I (392) cpu_start: cpu freq: 160000000
I (392) cpu_start: Application information:
I (397) cpu_start: Project name:     ESPDrone
I (402) cpu_start: App version:      8e31974-dirty
I (408) cpu_start: Compile time:     Oct  6 2024 08:18:11
I (414) cpu_start: ELF file SHA256:  58a9a54c5d15d529...
I (420) cpu_start: ESP-IDF:          v4.4.8-1-ga9d0f22193
I (426) cpu_start: Min chip rev:     v0.0
I (430) cpu_start: Max chip rev:     v3.99 
I (435) cpu_start: Chip rev:         v1.0
I (440) heap_init: Initializing. RAM available for dynamic allocation:
I (447) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (453) heap_init: At 3FFCABE8 len 00015418 (85 KiB): DRAM
I (459) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (466) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (472) heap_init: At 40098120 len 00007EE0 (31 KiB): IRAM
I (479) spi_flash: detected chip: gd
I (483) spi_flash: flash io: qio
I (487) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (550) PLATFORM: set active config 
I (550) gpio: GPIO[18]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (552) gpio: GPIO[23]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (562) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (574) wifi:wifi driver task: 3ffd3b68, prio:23, stack:6656, core=0
I (577) system_api: Base MAC address is not set
I (582) system_api: read default base MAC address from EFUSE
I (597) wifi:wifi firmware version: ff661c3
I (597) wifi:wifi certification version: v7.0
I (597) wifi:config NVS flash: enabled
I (600) wifi:config nano formating: disabled
I (604) wifi:Init data frame dynamic rx buffer num: 32
I (609) wifi:Init static rx mgmt buffer num: 5
I (613) wifi:Init management short buffer num: 32
I (617) wifi:Init dynamic tx buffer num: 32
I (621) wifi:Init static rx buffer size: 1600
I (626) wifi:Init static rx buffer num: 10
I (629) wifi:Init dynamic rx buffer num: 32
I (634) wifi_init: rx ba win: 6
I (637) wifi_init: tcpip mbox: 32
I (641) wifi_init: udp mbox: 6
I (645) wifi_init: tcp mbox: 6
I (648) wifi_init: tcp tx win: 5760
I (653) wifi_init: tcp rx win: 5760
I (657) wifi_init: tcp mss: 1440
I (661) wifi_init: WiFi IRAM OP enabled
I (665) wifi_init: WiFi RX IRAM OP enabled
I (675) phy_init: phy_version 4791,2c4672b,Dec 20 2023,16:06:06
I (759) wifi:mode : softAP (fc:f5:c4:6c:e2:75)
I (762) wifi:Total power save buffer number: 16
I (762) wifi:Init max length of beacon: 752/752
I (762) wifi:Init max length of beacon: 752/752
I (766) espnow: esp-now Version: 2.5.2
I (771) ESPNOW: espnow [version: 1.0] init
I (774) espnow: mac: fc:f5:c4:6c:e2:74, version: 2
I (779) espnow: Enable main task
I (783) espnow: main task entry
I (784) WIFI_UDP: wifi_init_softap complete.SSID:ESP-DRONE_FCF5C46CE275 password:12345678
I (796) WIFI_UDP: Socket created
I (800) WIFI_UDP: Socket bound, port 2390
I (805) WIFI_UDP: UDP server create socket succeed
I (1310) SYS: ----------------------------

I (1310) SYS: ESPlane 2.0  is up and running!

I (1310) I2CDRV:  i2c 1 driver install return = 0
I (1314) EEPROM: spi_flash_init ... !
I (1318) EEPROM: spi_flash_read ok !
Characterized using eFuse Vref
I (2533) I2CDRV:  i2c 0 driver install return = 0
I (2534) SENSORS: MPU6050 I2C connection [OK].

W (2890) ZR2: Z-down sensor [FAIL]

W (2890) SENSORS: VL53L1X I2C connection [FAIL].

I (2890) gpio: GPIO[15]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
W (2946) SENSORS: PMW3901 SPI connection [FAIL].

I (2946) SENSORS: sensors init done
I (2947) SENSORS: pitch_calib = 0.000000,roll_calib = 0.000000
I (2952) gpio: GPIO[14]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:1 
I (2961) ESTIMATOR: Using Complementary (1) estimator

I (2967) POSITION_CONTROLLER: thrustBase = 24000,thrustMin  = 5000
I (2974) MOTORS: pwm_timer_init()
I (2978) SYS: wifilinkTest = 1 
I (3481) SYS: pmTest = 1
I (3481) SYS: workerTest = 1
I (3481) SYS: systemTest = 1 
I (3481) SYS: configblockTest = 1 
I (3484) COMM: wifilinkTest = 1 
I (3488) COMM: crtpTest = 1 
I (3492) COMM: crtpserviceTest = 1 
I (3496) COMM: platformserviceTest = 1 
I (3500) COMM: consoleTest = 1 
I (3504) COMM: paramTest = 1 
I (3508) SYS: commTest = 1 
I (3511) SYS: commanderTest = 1 
I (5333) SYS: stabilizerTest = 1 
I (5333) SYS: estimatorKalmanTaskTest = 1 
I (5333) STAB: Wait for sensor calibration...

I (5336) SYS: systemStart ! selftestPassed = 1
I (6314) SYSLOAD: Task dump
I (6314) SYSLOAD: Load  Stack left      Name    PRI
I (6315) SYSLOAD: 0.01  2420    Tmr Svc         1
I (6316) SYSLOAD: 96.83         1552    IDLE1   0
I (6321) SYSLOAD: 93.39         1564    IDLE0   0
I (6325) SYSLOAD: 0.03  2576    CRTP-RX         2
I (6330) SYSLOAD: 0.22  3460    PWRMGNT         1
I (6334) SYSLOAD: 0.05  2668    tiT     18
I (6343) SYSLOAD: 0.01  1960    sys_evt ER      20
I (6348) SYSLOAD: 0.06  2220    espnow_main     1
I (6353) SYSLOAD: 0.00  3620    UDP_TX  2
I (6358) SYSLOAD: 0.00  3240    UDP_RX  2
I (6362) SYSLOAD: 0.00  3580    WIFILINK        2
I (6367) SYSLOAD: 0.00  2620    CRTP-TX         2
I (6371) SYSLOAD: 0.00  2608    LOG     2
I (6376) SYSLOAD: 0.00  1604    PARAM   2
I (6380) SYSLOAD: 0.00  1556    CMDHL   3
I (6384) SYSLOAD: 0.24  1084    ipc0    4
I (6389) SYSLOAD: 0.00  2428    KALMAN  4
I (6393) SYSLOAD: 0.00  1592    MEM     2
I (6398) SYSLOAD: 3.95  3648    SYSTEM  1
I (6402) SYSLOAD: 0.00  1468    LEDSEQCMD       1
I (6407) SYSLOAD: 0.11  4312    SENSORS         6
I (6411) SYSLOAD: 0.07  3428    esp_timer       22
I (6416) SYSLOAD: 3.01  4460    wifi    23
I (6421) SYSLOAD: 0.89  1008    ipc1    24
I (6425) SYSLOAD: Free heap: 119340 bytes
I (13170) wifi:new:<6,0>, old:<6,0>, ap:<6,0>, sta:<255,255>, prof:6
I (13170) wifi:station: f6:a4:f3:fd:8a:be join, AID=1, bgn, 20
I (13221) WIFI_UDP: stationf6:a4:f3:fd:8a:bejoin, AID=1
I (13221) espnow: station f6:a4:f3:fd:8a:be join, AID=1
I (13445) wifi:<ba-add>idx:2 (ifx:1, f6:a4:f3:fd:8a:be), tid:0, ssn:0, winSize:64
I (13681) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.43.43

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = 7A
30 00 00 00 00 00 00 00 80 33 33 BB 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 

Received size = 15 cksum = BC
30 00 00 00 00 00 00 00 80 1F 85 BF 41 84 E4 
...
livigni commented 1 month ago

It was stuck in "I (5333) STAB: Wait for sensor calibration..." and there is no timeout condition that could throw an assert. Closing the issue.

sasha240100 commented 1 month ago

@livigni have you tried checking the PWM signal going from the esp32 on the transistor gate with oscilloscope? What are the frequency / duty cycle parameters you get? From the hardware perspective that's the first thing I'd check