arduino-esp32 icon indicating copy to clipboard operation
arduino-esp32 copied to clipboard

On certain MQTT received messages: assert failed: xQueueGenericSend queue.c:820 (pxQueue)

Open konacurrents opened this issue 3 years ago • 15 comments

Board

M5Stack-Tiny-CAM

Device Description

Just the M5 Timer X.

Hardware Configuration

Nothing attached

(I don't know how to find the Arduino ESP32 version), but I assume it's the latest.

Version

v2.0.4

IDE Name

Arduino IDE 1.8.19

Operating System

maxOSx 12.4

Flash frequency

240mhz

PSRAM enabled

yes

Upload speed

115200

Description

Basically I have ESP code that works with ESP32 and the M5 chip nicely. It has BLE Server/Client, MQTT, WIFI, AP mode etc.

So I was successful compiling for the M5Stack-Tiny-CAM, and it receives MQTT messages from my network.

But for a couple of my messages, I get the

[ 50715][E][Wire.cpp:319] beginTransmission(): could not acquire lock
[ 50722][E][Wire.cpp:370] requestFrom(): Unfinished Repeated Start transaction! Expected address do not match! 104 != 0

then it processes my MQTT message, then:

 50859][E][Wire.cpp:313] beginTransmission(): Unfinished Repeated Start transaction! Expected requestFrom, not beginTransmission! Clearing...
assert failed: xQueueGenericSend queue.c:820 (pxQueue)

Previously ran in other threads

In some cases, my MQTT code was trying to use BLE messaging, and the thread /task had to be released, so that the BLEClient code could run (versus just calling that code).

In this case I don't see that issue.

Not happening on my other 2 builds. The errors above don't even show up.

Also the code doesn't even have to do anything, but the error still occurs:

[ 41605][E][Wire.cpp:313] beginTransmission(): Unfinished Repeated Start transaction! Expected requestFrom, not beginTransmission! Clearing...

assert failed: xQueueGenericSend queue.c:820 (pxQueue)

Sketch

My code is vast. Hard to include.

Debug Message

[     4][D][esp32-hal-cpu.c:214] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[   849][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled

Listing directory: /
Version-(1.0)-8.9.2022-ESP_M5_CAMERA
Compiled Aug 11 2022 @ 20:00:20
 ** #define Module Configuration **
WIFI ssid = SunnyWhiteriver
preSetup_WIFI_APModule: isSet(set)
WIFI ssid = SunnyWhiteriver
setupBLEServerNetworking(PTClicker,notset,b0e6a4bf-cccc-ffff-330c-0000000000f0,b0e6a4bf-cccc-ffff-330c-0000000000f1)
Stored DeviceName = M5Camera
Setting BLE serviceName: PTClicker:M5Camera
I NimBLEDevice: BLE Host Task Started
I NimBLEDevice: NimBle host synced.
D NimBLEDevice: >> setPower: 7 (type: 11)
D NimBLEDevice: << setPower
D NimBLEDevice: Setting bonding: 0, mitm: 0, sc: 1
D NimBLEServer: >> createService - 0xdead
D NimBLEServer: << createService
D NimBLEServer: >> createService - b0e6a4bf-cccc-ffff-330c-0000000000f0
D NimBLEServer: << createService
D NimBLEService: >> start(): Starting service: UUID: 0xdead, handle: 0xffff
D NimBLEService: Adding 1 characteristics for service UUID: 0xdead, handle: 0xffff
D NimBLEService: << start()
D NimBLEService: >> start(): Starting service: UUID: b0e6a4bf-cccc-ffff-330c-0000000000f0, handle: 0xffff
D NimBLEService: Adding 1 characteristics for service UUID: b0e6a4bf-cccc-ffff-330c-0000000000f0, handle: 0xffff
D NimBLEService: << start()
D NimBLEAdvertising: >> Advertising start: customAdvData: 0, customScanResponseData: 0
primary service
           uuid 0x1800
         handle 1
     end_handle 5
characteristic
           uuid 0x2a00
     def_handle 2
     val_handle 3
   min_key_size 0
          flags [READ]
characteristic
           uuid 0x2a01
     def_handle 4
     val_handle 5
   min_key_size 0
          flags [READ]
primary service
           uuid 0x1801
         handle 6
     end_handle 9
characteristic
           uuid 0x2a05
     def_handle 7
     val_handle 8
   min_key_size 0
          flags [INDICATE]
ccc descriptor
           uuid 0x2902
         handle 9
   min_key_size 0
          flags [READ|WRITE]
primary service
           uuid 0xdead
         handle 10
     end_handle 13
characteristic
           uuid 0xbeef
     def_handle 11
     val_handle 12
   min_key_size 0
          flags [READ|WRITE|READ_ENC|WRITE_ENC]
descriptor
           uuid 0x2904
         handle 13
   min_key_size 0
          flags [READ]
primary service
           uuid b0e6a4bf-cccc-ffff-330c-0000000000f0
         handle 14
     end_handle 17
characteristic
           uuid b0e6a4bf-cccc-ffff-330c-0000000000f1
     def_handle 15
     val_handle 16
   min_key_size 0
          flags [READ|WRITE]
descriptor
           uuid 0xc01d
         handle 17
   min_key_size 0
          flags [READ|WRITE]
D NimBLEAdvertising: << Advertising start
done setupBLEServerNetworking
doneWIFI_APModuleCredentials,  and now calling finishSetup()
From WIFI -> JSON =
setup_MQTTNetworking
 .. continue setup_MQTTNetworking
Reading.1 EPROM JSON = {"ssid":"SunnyWhiteriver","ssidPassword":"sunny2021","mqtt_server":"idogwatch.com","mqtt_port":"1883","mqtt_password":"PASSWD","mqtt_guestPassword":"doggy","mqtt_user":"[email protected]","mqtt_topic":"usersP/bark/[email protected]","deviceName":"M5Camera","uuid":null,"jsonHeader":null,"jsonVersion":null,"location":"In My Pocket on Hike"}
JSON parsed.1 = {"ssid":"SunnyWhiteriver","ssidPassword":"sunny2021","mqtt_server":"idogwatch.com","mqtt_port":"1883","mqtt_password":"PASSWD","mqtt_guestPassword":"doggy","mqtt_user":"[email protected]","mqtt_topic":"usersP/bark/[email protected]","deviceName":"M5Camera","uuid":null,"jsonHeader":null,"jsonVersion":null,"location":"In My Pocket on Hike"}
SunnyWhiteriver
sunny2021
idogwatch.com
PASSWD
M5Camera
usersP/bark/[email protected]
In My Pocket on Hike
doggy
main_updateMQTTInfo(SunnyWhiteriver,sunny2021,[email protected],PASSWD,doggy, In My Pocket on Hike)
main_saveWIFICredentials{'ssid':'SunnyWhiteriver','ssidPassword':'sunny2021'}
wifi_apModule.updateMQTTInfo(SunnyWhiteriver, sunny2021, [email protected],PASSWD, doggy, In My Pocket on Hike)
calling .. processJSONMessage
DeviceName: M5Camera
[  1903][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 0 - WIFI_READY
[  1910][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[  1908][V][WiFiGeneric.cpp:283] _arduino_event_cb(): STA Started
[  1916][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 2 - STA_START
[  1982][V][WiFiGeneric.cpp:295] _arduino_event_cb(): STA Connected: SSID: SunnyWhiteriver, BSSID: 88:de:7c:a3:bc:36, Channel: 11, Auth: WPA2_PSK
[  1984][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
[  2003][V][WiFiGeneric.cpp:305] _arduino_event_cb(): STA Got New IP:192.168.0.244
[  2004][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
[  2007][D][WiFiGeneric.cpp:914] _eventCallback(): STA IP: 192.168.0.244, MASK: 255.255.255.0, GW: 192.168.0.1
WiFi.status() == WL_CONNECTED()
finishWIFI_Setup()
setupMQTTNetworking_WIFI done..
callPreSetupMQTT(2)
**** setupMQTT *****
Attempting MQTT connection: 'idogwatch.com' '[email protected]' 'PASSWD' count=1
attempt _mqttClient.connect(espM5-cf2b)
[  5555][I][WiFiClient.cpp:253] connect(): select returned due to timeout 3000 ms for fd 48
callPreSetupMQTT(2)
**** setupMQTT *****
Attempting MQTT connection: 'idogwatch.com' '[email protected]' 'PASSWD' count=2
attempt _mqttClient.connect(espM5-52b4)
[  8862][I][WiFiClient.cpp:253] connect(): select returned due to timeout 3000 ms for fd 48
callPreSetupMQTT(2)
**** setupMQTT *****
Attempting MQTT connection: 'idogwatch.com' '[email protected]' 'PASSWD' count=3
attempt _mqttClient.connect(espM5-c668)
[ 12167][I][WiFiClient.cpp:253] connect(): select returned due to timeout 3000 ms for fd 48
callPreSetupMQTT(2)
**** setupMQTT *****
Attempting MQTT connection: 'idogwatch.com' '[email protected]' 'PASSWD' count=4
attempt _mqttClient.connect(espM5-2103)
processBarkletMessage: #actMe {ScoobyDoo} {'T':'1073748036','temp':'10','topic':'usersP/bark/[email protected]','user':'[email protected]','v':'v1','location':'Dog Kennel USA','paired':'ScoobyDoo', 'ble':'x','gateway':'off'}   topic=usersP/bark/[email protected]
processBarkletMessage: #actMe {GreyGoose} {'T':'1073748036','temp':'10','topic':'usersP/bark/[email protected]','user':'[email protected]','v':'v1','location':'hound dogs','paired':'none', 'ble':'x','gateway':'off'}   topic=usersP/bark/[email protected]
processBarkletMessage: #actMe {PumpkinUno} {'T':'1073748036','temp':'10','topic':'usersP/bark/[email protected]','user':'[email protected]','v':'v1','location':'hound dogs ','paired':'none', 'ble':'x','gateway':'off'}   topic=usersP/bark/[email protected]
processBarkletMessage: #actMe {HowieFeeder} {'T':'1073748036','temp':'10','topic':'usersP/bark/[email protected]','user':'[email protected]','v':'v1','location':'Hay field ','paired':'none', 'ble':'x','gateway':'off'}   topic=usersP/bark/[email protected]
checkAndReconnectWIFI_MQTTState: WL_CONNECTED
processBarkletMessage: {'send':'status'}   topic=usersP/bark/[email protected]
processJSONMessageMQTT: '{'send':'status'}'
JSON parsed = {"send":"status"}
sendCmd == status
processBarkletMessage: #STATUS   topic=usersP/bark/[email protected]
 1
[ 50715][E][Wire.cpp:319] beginTransmission(): could not acquire lock
[ 50722][E][Wire.cpp:370] requestFrom(): Unfinished Repeated Start transaction! Expected address do not match! 104 != 0
status?v=v1&dev=M5Camera&msg=STATUS
 2
 3
 5
 6
Sending message: #remoteMe {M5Camera} {#connectedMe} {I,F}  {'T':'50','dev':'M5Camera','user':'[email protected]','location':'In My Pocket on Hike','v':'Version-(1.0)-8.9.2022-ESP_M5_CAMERA'}
[ 50859][E][Wire.cpp:313] beginTransmission(): Unfinished Repeated Start transaction! Expected requestFrom, not beginTransmission! Clearing...

assert failed: xQueueGenericSend queue.c:820 (pxQueue)


Backtrace:0x40083ec9:0x3ffced800x40094fb1:0x3ffceda0 0x4009a945:0x3ffcedc0 0x40095a4e:0x3ffceef0 0x400e2cd5:0x3ffcef30 0x400e2f68:0x3ffcef60 0x400e11e3:0x3ffcef80 0x400e1231:0x3ffcefa0 0x400e124c:0x3ffcefd0 0x400daf45:0x3ffceff0 0x400db0c4:0x3ffcf010 0x400db389:0x3ffcf050 0x400d361a:0x3ffcf150 0x40101275:0x3ffcf170




ELF file SHA256: 0000000000000000

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_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:1184
load:0x40078000,len:12812
load:0x40080400,len:3032
entry 0x400805e4
[     2][V][WiFiServer.h:42] WiFiServer(): WiFiSâ®Æ•â®â®:WiFiServer(port=80, ...)
[     4][D][esp32-hal-cpu.c:214] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[   849][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled

Listing directory: /
  FILE: messages.txt	SIZE: 76
Version-(1.0)-8.9.2022-ESP_M5_CAMERA
Compiled Aug 11 2022 @ 20:00:20
 ** #define Module Configuration **
WIFI ssid = SunnyWhiteriver
preSetup_WIFI_APModule: isSet(set)
WIFI ssid = SunnyWhiteriver
setupBLEServerNetworking(PTClicker,notset,b0e6a4bf-cccc-ffff-330c-0000000000f0,b0e6a4bf-cccc-ffff-330c-0000000000f1)
Stored DeviceName = M5Camera
Setting BLE serviceName: PTClicker:M5Camera
I NimBLEDevice: BLE Host Task Started
I NimBLEDevice: NimBle host synced.
D NimBLEDevice: >> setPower: 7 (type: 11)
D NimBLEDevice: << setPower
D NimBLEDevice: Setting bonding: 0, mitm: 0, sc: 1
D NimBLEServer: >> createService - 0xdead
D NimBLEServer: << createService
D NimBLEServer: >> createService - b0e6a4bf-cccc-ffff-330c-0000000000f0
D NimBLEServer: << createService
D NimBLEService: >> start(): Starting service: UUID: 0xdead, handle: 0xffff
D NimBLEService: Adding 1 characteristics for service UUID: 0xdead, handle: 0xffff
D NimBLEService: << start()
D NimBLEService: >> start(): Starting service: UUID: b0e6a4bf-cccc-ffff-330c-0000000000f0, handle: 0xffff
D NimBLEService: Adding 1 characteristics for service UUID: b0e6a4bf-cccc-ffff-330c-0000000000f0, handle: 0xffff
D NimBLEService: << start()
D NimBLEAdvertising: >> Advertising start: customAdvData: 0, customScanResponseData: 0
primary service
           uuid 0x1800
         handle 1
     end_handle 5
characteristic
           uuid 0x2a00
     def_handle 2
     val_handle 3
   min_key_size 0
          flags [READ]
characteristic
           uuid 0x2a01
     def_handle 4
     val_handle 5
   min_key_size 0
          flags [READ]
primary service
           uuid 0x1801
         handle 6
     end_handle 9
characteristic
           uuid 0x2a05
     def_handle 7
     val_handle 8
   min_key_size 0
          flags [INDICATE]
ccc descriptor
           uuid 0x2902
         handle 9
   min_key_size 0
          flags [READ|WRITE]
primary service
           uuid 0xdead
         handle 10
     end_handle 13
characteristic
           uuid 0xbeef
     def_handle 11
     val_handle 12
   min_key_size 0
          flags [READ|WRITE|READ_ENC|WRITE_ENC]
descriptor
           uuid 0x2904
         handle 13
   min_key_size 0
          flags [READ]
primary service
           uuid b0e6a4bf-cccc-ffff-330c-0000000000f0
         handle 14
     end_handle 17
characteristic
           uuid b0e6a4bf-cccc-ffff-330c-0000000000f1
     def_handle 15
     val_handle 16
   min_key_size 0
          flags [READ|WRITE]
descriptor
           uuid 0xc01d
         handle 17
   min_key_size 0
          flags [READ|WRITE]
D NimBLEAdvertising: << Advertising start
done setupBLEServerNetworking
doneWIFI_APModuleCredentials,  and now calling finishSetup()
From WIFI -> JSON =
setup_MQTTNetworking
 .. continue setup_MQTTNetworking
Reading.1 EPROM JSON = {"ssid":"SunnyWhiteriver","ssidPassword":"sunny2021","mqtt_server":"idogwatch.com","mqtt_port":"1883","mqtt_password":"PASSWD","mqtt_guestPassword":"doggy","mqtt_user":"[email protected]","mqtt_topic":"usersP/bark/[email protected]","deviceName":"M5Camera","uuid":null,"jsonHeader":null,"jsonVersion":null,"location":"In My Pocket on Hike"}
JSON parsed.1 = {"ssid":"SunnyWhiteriver","ssidPassword":"sunny2021","mqtt_server":"idogwatch.com","mqtt_port":"1883","mqtt_password":"PASSWD","mqtt_guestPassword":"doggy","mqtt_user":"[email protected]","mqtt_topic":"usersP/bark/[email protected]","deviceName":"M5Camera","uuid":null,"jsonHeader":null,"jsonVersion":null,"location":"In My Pocket on Hike"}
SunnyWhiteriver
sunny2021
idogwatch.com
PASSWD
M5Camera
usersP/bark/[email protected]
In My Pocket on Hike
doggy
main_updateMQTTInfo(SunnyWhiteriver,sunny2021,[email protected],PASSWD,doggy, In My Pocket on Hike)
main_saveWIFICredentials{'ssid':'SunnyWhiteriver','ssidPassword':'sunny2021'}
wifi_apModule.updateMQTTInfo(SunnyWhiteriver, sunny2021, [email protected],PASSWD, doggy, In My Pocket on Hike)
calling .. processJSONMessage
DeviceName: M5Camera
[  1885][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 0 - WIFI_READY
[  1892][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[  1890][V][WiFiGeneric.cpp:283] _arduino_event_cb(): STA Started
[  1898][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 2 - STA_START
[  1961][V][WiFiGeneric.cpp:295] _arduino_event_cb(): STA Connected: SSID: SunnyWhiteriver, BSSID: 88:de:7c:a3:bc:36, Channel: 11, Auth: WPA2_PSK
[  1963][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
[  1994][V][WiFiGeneric.cpp:305] _arduino_event_cb(): STA Got New IP:192.168.0.244
[  1995][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
[  1998][D][WiFiGeneric.cpp:914] _eventCallback(): STA IP: 192.168.0.244, MASK: 255.255.255.0, GW: 192.168.0.1
WiFi.status() == WL_CONNECTED()
finishWIFI_Setup()
setupMQTTNetworking_WIFI done..
callPreSetupMQTT(2)
**** setupMQTT *****
Attempting MQTT connection: 'idogwatch.com' '[email protected]' 'PASSWD' count=1
attempt _mqttClient.connect(espM5-9b8e)
processBarkletMessage: #FEED   topic=usersP/bark/[email protected]
 610
[ 24915][E][Wire.cpp:319] beginTransmission(): could not acquire lock
[ 24916][E][Wire.cpp:370] requestFrom(): Unfinished Repeated Start transaction! Expected address do not match! 104 != 0
status?v=v1&dev=M5Camera&msg=FEED
Perform FEED internally, calling callbackFunction.. 2
feedMessageCallback_main: feed
Sending message: #actMe {M5Camera} {'T':'1074343608','temp':'-39','topic':'usersP/bark/[email protected]','user':'[email protected]','v':'v1','location':'In My Pocket on Hike','paired':'none', 'ble':'x','gateway':'off'}
 620
processBarkletMessage: #actMe {PumpkinUno} {'T':'1073748036','temp':'10','topic':'usersP/bark/[email protected]','user':'[email protected]','v':'v1','location':'hound dogs ','paired':'none', 'ble':'x','gateway':'off'}   topic=usersP/bark/[email protected]
processBarkletMessage: #actMe {GreyGoose} {'T':'1073748036','temp':'10','topic':'usersP/bark/[email protected]','user':'[email protected]','v':'v1','location':'hound dogs','paired':'none', 'ble':'x','gateway':'off'}   topic=usersP/bark/[email protected]
processBarkletMessage: #actMe {HowieFeeder} {'T':'1073748036','temp':'10','topic':'usersP/bark/[email protected]','user':'[email protected]','v':'v1','location':'Hay field ','paired':'none', 'ble':'x','gateway':'off'}   topic=usersP/bark/[email protected]
processBarkletMessage: #actMe {ScoobyDoo} {'T':'1073748036','temp':'10','topic':'usersP/bark/[email protected]','user':'[email protected]','v':'v1','location':'Dog Kennel USA','paired':'ScoobyDoo', 'ble':'x','gateway':'off'}   topic=usersP/bark/[email protected]
processBarkletMessage: #actMe {M5Camera} {'T':'1074343608','temp':'-39','topic':'usersP/bark/[email protected]','user':'[email protected]','v':'v1','location':'In My Pocket on Hike','paired':'none', 'ble':'x','gateway':'off'}   topic=usersP/bark/[email protected]
checkAndReconnectWIFI_MQTTState: WL_CONNECTED
processBarkletMessage: {'send':'status'}   topic=usersP/bark/[email protected]
processJSONMessageMQTT: '{'send':'status'}'
JSON parsed = {"send":"status"}
sendCmd == status
processBarkletMessage: #STATUS   topic=usersP/bark/[email protected]
 1
[ 40017][E][Wire.cpp:313] beginTransmission(): Unfinished Repeated Start transaction! Expected requestFrom, not beginTransmission! Clearing...

assert failed: xQueueGenericSend queue.c:820 (pxQueue)


Backtrace:0x40083ec9:0x3ffce9700x40094fb1:0x3ffce990 0x4009a945:0x3ffce9b0 0x40095a4e:0x3ffceae0 0x400e2cd5:0x3ffceb20 0x400e2f78:0x3ffceb50 0x400e2a55:0x3ffceb70 0x400e2ab5:0x3ffceb90 0x400e2ae2:0x3ffcebc0 0x400dafb9:0x3ffcebf0 0x400d8424:0x3ffcec30 0x400d7e6e:0x3ffced10 0x400d83d5:0x3ffcef80 0x400d8d01:0x3ffcf060 0x4018ff03:0x3ffcf0b0 0x400fd325:0x3ffcf0d0 0x400d495e:0x3ffcf110 0x400d4e3e:0x3ffcf130 0x400d3623:0x3ffcf150 0x40101275:0x3ffcf170




ELF file SHA256: 0000000000000000

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_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:1184
load:0x40078000,len:12812
load:0x40080400,len:3032
entry 0x400805e4
[     2][V][WiFiServer.h:42] WiFiServer(): WiFiSâ®Æ•â®â®:WiFiServer(port=80, ...)
[     4][D][esp32-hal-cpu.c:214] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[   849][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled

Listing directory: /
  FILE: messages.txt	SIZE: 153
Version-(1.0)-8.9.2022-ESP_M5_CAMERA
Compiled Aug 11 2022 @ 20:00:20
 ** #define Module Configuration **
WIFI ssid = SunnyWhiteriver
preSetup_WIFI_APModule: isSet(set)
WIFI ssid = SunnyWhiteriver
setupBLEServerNetworking(PTClicker,notset,b0e6a4bf-cccc-ffff-330c-0000000000f0,b0e6a4bf-cccc-ffff-330c-0000000000f1)
Stored DeviceName = M5Camera
Setting BLE serviceName: PTClicker:M5Camera
I NimBLEDevice: BLE Host Task Started
I NimBLEDevice: NimBle host synced.
D NimBLEDevice: >> setPower: 7 (type: 11)
D NimBLEDevice: << setPower
D NimBLEDevice: Setting bonding: 0, mitm: 0, sc: 1
D NimBLEServer: >> createService - 0xdead
D NimBLEServer: << createService
D NimBLEServer: >> createService - b0e6a4bf-cccc-ffff-330c-0000000000f0
D NimBLEServer: << createService
D NimBLEService: >> start(): Starting service: UUID: 0xdead, handle: 0xffff
D NimBLEService: Adding 1 characteristics for service UUID: 0xdead, handle: 0xffff
D NimBLEService: << start()
D NimBLEService: >> start(): Starting service: UUID: b0e6a4bf-cccc-ffff-330c-0000000000f0, handle: 0xffff
D NimBLEService: Adding 1 characteristics for service UUID: b0e6a4bf-cccc-ffff-330c-0000000000f0, handle: 0xffff
D NimBLEService: << start()
D NimBLEAdvertising: >> Advertising start: customAdvData: 0, customScanResponseData: 0
primary service
           uuid 0x1800
         handle 1
     end_handle 5
characteristic
           uuid 0x2a00
     def_handle 2
     val_handle 3
   min_key_size 0
          flags [READ]
characteristic
           uuid 0x2a01
     def_handle 4
     val_handle 5
   min_key_size 0
          flags [READ]
primary service
           uuid 0x1801
         handle 6
     end_handle 9
characteristic
           uuid 0x2a05
     def_handle 7
     val_handle 8
   min_key_size 0
          flags [INDICATE]
ccc descriptor
           uuid 0x2902
         handle 9
   min_key_size 0
          flags [READ|WRITE]
primary service
           uuid 0xdead
         handle 10
     end_handle 13
characteristic
           uuid 0xbeef
     def_handle 11
     val_handle 12
   min_key_size 0
          flags [READ|WRITE|READ_ENC|WRITE_ENC]
descriptor
           uuid 0x2904
         handle 13
   min_key_size 0
          flags [READ]
primary service
           uuid b0e6a4bf-cccc-ffff-330c-0000000000f0
         handle 14
     end_handle 17
characteristic
           uuid b0e6a4bf-cccc-ffff-330c-0000000000f1
     def_handle 15
     val_handle 16
   min_key_size 0
          flags [READ|WRITE]
descriptor
           uuid 0xc01d
         handle 17
   min_key_size 0
          flags [READ|WRITE]
D NimBLEAdvertising: << Advertising start
done setupBLEServerNetworking
doneWIFI_APModuleCredentials,  and now calling finishSetup()
From WIFI -> JSON =
setup_MQTTNetworking
 .. continue setup_MQTTNetworking
Reading.1 EPROM JSON = {"ssid":"SunnyWhiteriver","ssidPassword":"sunny2021","mqtt_server":"idogwatch.com","mqtt_port":"1883","mqtt_password":"PASSWD","mqtt_guestPassword":"doggy","mqtt_user":"[email protected]","mqtt_topic":"usersP/bark/[email protected]","deviceName":"M5Camera","uuid":null,"jsonHeader":null,"jsonVersion":null,"location":"In My Pocket on Hike"}
JSON parsed.1 = {"ssid":"SunnyWhiteriver","ssidPassword":"sunny2021","mqtt_server":"idogwatch.com","mqtt_port":"1883","mqtt_password":"PASSWD","mqtt_guestPassword":"doggy","mqtt_user":"[email protected]","mqtt_topic":"usersP/bark/[email protected]","deviceName":"M5Camera","uuid":null,"jsonHeader":null,"jsonVersion":null,"location":"In My Pocket on Hike"}
SunnyWhiteriver
sunny2021
idogwatch.com
PASSWD
M5Camera
usersP/bark/[email protected]
In My Pocket on Hike
doggy
main_updateMQTTInfo(SunnyWhiteriver,sunny2021,[email protected],PASSWD,doggy, In My Pocket on Hike)
main_saveWIFICredentials{'ssid':'SunnyWhiteriver','ssidPassword':'sunny2021'}
wifi_apModule.updateMQTTInfo(SunnyWhiteriver, sunny2021, [email protected],PASSWD, doggy, In My Pocket on Hike)
calling .. processJSONMessage
DeviceName: M5Camera
[  1882][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 0 - WIFI_READY
[  1889][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[  1888][V][WiFiGeneric.cpp:283] _arduino_event_cb(): STA Started
[  1895][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 2 - STA_START
[  1963][V][WiFiGeneric.cpp:295] _arduino_event_cb(): STA Connected: SSID: SunnyWhiteriver, BSSID: 88:de:7c:a3:bc:36, Channel: 11, Auth: WPA2_PSK
[  1966][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
[  1990][V][WiFiGeneric.cpp:305] _arduino_event_cb(): STA Got New IP:192.168.0.244
[  1991][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
[  1994][D][WiFiGeneric.cpp:914] _eventCallback(): STA IP: 192.168.0.244, MASK: 255.255.255.0, GW: 192.168.0.1
WiFi.status() == WL_CONNECTED()
finishWIFI_Setup()
setupMQTTNetworking_WIFI done..
callPreSetupMQTT(2)
**** setupMQTT *****
Attempting MQTT connection: 'idogwatch.com' '[email protected]' 'PASSWD' count=1
attempt _mqttClient.connect(espM5-d9d5)

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.

konacurrents avatar Aug 12 '22 03:08 konacurrents

Please note in the future that this forum is for issues with the code in this repository, not issues with your code. esp32.com is a more open conversation about all manner of esp32 questions.

You say you are having problems with mqtt, but the errors quite directly point at Wire. My guess is that you have your data collection (from some I2C device) and data delivery intermingled. Separate them so that you have the data in hand before you make the network connection. That will reduce the possibility of timeouts and race conditions. It also makes it easier to add new collection and delivery processes. The more asynchronous you can make these steps, the more robust your application will be overall.

You can decode the backtrace you are getting to pin down exactly at what line in the code the error is occurring. I think you will see that it is happening while some device is polling the wire. See if there isn't a better driver for that device out there that is better suited for esp32 (or perhaps more recently updated).

lbernstone avatar Aug 12 '22 05:08 lbernstone

Thanks for the reply and pointer to the backtrace debugging approach. I'll look into that.

I assumed that since the error I'm getting was not my code (like Wire) that this forum was appropriate.

Would you suggest that a data collection (like MQTT) - store that data, and release the interrupt, then in the next loop() process the message? That's what I ended up doing with BLE messages.

thanks.

konacurrents avatar Aug 12 '22 16:08 konacurrents

Well, I separated the MQTT.loop which has an interrupt processor, from the actual processing of the received data after returning from the loop - and I get the same error. So I guess I have to go the backtrace route.

konacurrents avatar Aug 12 '22 17:08 konacurrents

[ 50715][E][Wire.cpp:319] beginTransmission(): could not acquire lock

Did you initialize the wire correctly. I think something is wrong camera.

podaen avatar Sep 06 '22 08:09 podaen

That M5 camera (on right in pic) is a self contained unit so there is no wiring on my part.

image

konacurrents avatar Sep 06 '22 14:09 konacurrents

Its wireless... so where is the wire.h in use?

podaen avatar Sep 06 '22 14:09 podaen

I assume the internals of the esp chip to the camera.

I just need a good approach to debug, which I haven't figured out on any of my esp projects.

konacurrents avatar Sep 06 '22 14:09 konacurrents

Oh. I see now. I don't am exprenced engough with M5 stack. I can only point you in a direction what I think it could be it.

Did you check the freehap of the allocated memorie or maybe somthing is missing in your code that is needed to use the library. How long is the message you are sending to the MQTT? Sending small msg improves the performance.

podaen avatar Sep 07 '22 07:09 podaen

Are you using this library?

/* PubSubClient.h - A simple client for MQTT. Nick O'Leary http://knolleary.net */

Then check these parameters in the MQTT library if they are valid for you application.

// MQTT_MAX_PACKET_SIZE : Maximum packet size. Override with setBufferSize().
#ifndef MQTT_MAX_PACKET_SIZE
#define MQTT_MAX_PACKET_SIZE 256
#endif

// MQTT_KEEPALIVE : keepAlive interval in Seconds. Override with setKeepAlive()
#ifndef MQTT_KEEPALIVE
#define MQTT_KEEPALIVE 15
#endif

// MQTT_SOCKET_TIMEOUT: socket timeout interval in Seconds. Override with setSocketTimeout()
#ifndef MQTT_SOCKET_TIMEOUT
#define MQTT_SOCKET_TIMEOUT 15
#endif

podaen avatar Sep 08 '22 05:09 podaen

is this still valid?

VojtechBartoska avatar Dec 15 '22 13:12 VojtechBartoska

Yes sadly I still get this issue.

konacurrents avatar Dec 17 '22 23:12 konacurrents

Intresting. I am using now an other mqqt lib with events and I have the same issue.

podaen avatar Dec 18 '22 12:12 podaen

Follow up: I'm still getting this assert failed (after trying this again after a year off).

assert failed: xQueueGenericSend queue.c:820 (pxQueue)

Here is what's strange, I change the build so it thinks it's an M5 without a camera, and the assert failure still happens. So it seems the internals of the M5Camera acts slightly differently.

That said, it can send some MQTT messages depending on events.

I'll keep debugging to see if the thread wasn't released enough before the send. What works is receiving an MQTT message to take a picture, which then takes a picture, uploads to a web page, and sends out a URL of the result over MQTT.

konacurrents avatar Jan 15 '24 21:01 konacurrents

Here is a stack track

After leaning how to get the stack track here it is:

assert failed: xQueueGenericSend queue.c:820 (pxQueue)

Decoding stack results
0x40084269: panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c line 402
0x40084269: panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c line 402
0x4009572d: esp_system_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/esp_system.c line 128
0x4009572d: esp_system_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/esp_system.c line 128
0x4009b37d: __assert_func at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/assert.c line 85
0x4009b37d: __assert_func at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/assert.c line 85
0x400961ca: xQueueGenericSend at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 820
0x400961ca: xQueueGenericSend at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 820
0x400e79f9: TwoWire::beginTransmission(unsigned short) at /Users/scott/Library/Arduino15/packages/m5stack/hardware/esp32/2.0.4/libraries/Wire/src/Wire.cpp line 315
0x400e7b68: TwoWire::beginTransmission(int) at /Users/scott/Library/Arduino15/packages/m5stack/hardware/esp32/2.0.4/libraries/Wire/src/Wire.cpp line 499
0x400e5f0f: AXP192::ReadBuff(unsigned char, unsigned char, unsigned char*) at /Users/scott/Documents/Arduino/libraries/M5StickCPlus/src/AXP192.cpp line 120
0x400e5f5d: AXP192::Read12Bit(unsigned char) at /Users/scott/Documents/Arduino/libraries/M5StickCPlus/src/AXP192.cpp line 67
0x400e5f5d: AXP192::Read12Bit(unsigned char) at /Users/scott/Documents/Arduino/libraries/M5StickCPlus/src/AXP192.cpp line 67
0x400e5f78: AXP192::GetBatVoltage() at /Users/scott/Documents/Arduino/libraries/M5StickCPlus/src/AXP192.cpp line 342
0x400e5f78: AXP192::GetBatVoltage() at /Users/scott/Documents/Arduino/libraries/M5StickCPlus/src/AXP192.cpp line 342
0x400dd9d5: getBatPercentage_mainModule() at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/src/MainModule/MainModule.cpp line 1722
0x400dd9d5: getBatPercentage_mainModule() at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/src/MainModule/MainModule.cpp line 1722
0x400ddb61: main_currentStatusURL(bool) at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/src/MainModule/MainModule.cpp line 1986
0x400ddb61: main_currentStatusURL(bool) at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/src/MainModule/MainModule.cpp line 1986
0x400de59a: invokeAsyncCommands() at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/src/MainModule/MainModule.cpp line 1368
0x400d342b: loop() at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/ESP_IOT.ino line 361
0x40104f85: loopTask(void*) at /User line 499
0x400e5f0f: AXP192::ReadBuff(unsigned char, unsigned char, unsigned char*) at /Users/scott/Documents/Arduino/libraries/M5StickCPlus/src/AXP192.cpp line 120
0x400e5f5d: AXP192::Read12Bit(unsigned char) at /Users/scott/Documents/Arduino/libraries/M5StickCPlus/src/AXP192.cpp line 67
0x400e5f5d: AXP192::Read12Bit(unsigned char) at /Users/scott/Documents/Arduino/libraries/M5StickCPlus/src/AXP192.cpp line 67
0x400e5f78: AXP192::GetBatVoltage() at /Users/scott/Documents/Arduino/libraries/M5StickCPlus/src/AXP192.cpp line 342
0x400e5f78: AXP192::GetBatVoltage() at /Users/scott/Documents/Arduino/libraries/M5StickCPlus/src/AXP192.cpp line 342
0x400dd9d5: getBatPercentage_mainModule() at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/src/MainModule/MainModule.cpp line 1722
0x400dd9d5: getBatPercentage_mainModule() at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/src/MainModule/MainModule.cpp line 1722
0x400ddb61: main_currentStatusURL(bool) at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/src/MainModule/MainModule.cpp line 1986
0x400ddb61: main_currentStatusURL(bool) at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/src/MainModule/MainModule.cpp line 1986
0x400de59a: invokeAsyncCommands() at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/src/MainModule/MainModule.cpp line 1368
0x400d342b: loop() at /Users/scott/Documents/GitHub/ESP_IOT_BLE_AP_Testing/ESP_IOT/ESP_IOT.ino line 361
0x40104f85: loopTask(void*) at /Users/scott/Library/Arduino15/packages/m5stack/hardware/esp32/2.0.4/cores/esp32/main.cpp line 50

s/scott/Library/Arduino15/packages/m5stack/hardware/esp32/2.0.4/cores/esp32/main.cpp line 50



Decoding stack results
0x40084269: panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c line 402
0x40084269: panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c line 402
0x4009572d: esp_system_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/esp_system.c line 128
0x4009572d: esp_system_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/esp_system.c line 128
0x4009b37d: __assert_func at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/assert.c line 85
0x4009b37d: __assert_func at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/assert.c line 85
0x400961ca: xQueueGenericSend at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 820
0x400961ca: xQueueGenericSend at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 820
0x400e79f9: TwoWire::beginTransmission(unsigned short) at /Users/scott/Library/Arduino15/packages/m5stack/hardware/esp32/2.0.4/libraries/Wire/src/Wire.cpp line 315
0x400e7b68: TwoWire::beginTransmission(int) at /Users/scott/Library/Arduino15/packages/m5stack/hardware/esp32/2.0.4/libraries/Wire/src/Wire.cpp

konacurrents avatar Jan 15 '24 22:01 konacurrents

Hello @konacurrents as Arduino Team, we are not really able to help here. Is your issue still relevant?

VojtechBartoska avatar Jun 05 '24 11:06 VojtechBartoska