Page 1 of 1
ESP32 crashes if UART pins are changed in ble_spp_client example
Posted: Fri May 25, 2018 2:16 pm
by jscastonguay
Hi,
I wrote a github issue on this but I try in this forum because I find strange the problem that I face of. I took ble_spp_client example along with ble_spp_server example. The only thing that I did was to change to UART pins on ble_spp_client. Precisely, I changed the following line:
Code: Select all
uart_set_pin(UART_NUM_0, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
for
Code: Select all
uart_set_pin(UART_NUM_0, GPIO_NUM_4, GPIO_NUM_5, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
or with UART_NUM_2, GPIO_NUM_16 and GPIO_NUM_17, or whatever the pins or UART.
Then, the ESP32 crashed. It is impossible that nobody saw this problem before… Changing the pins on uart_events example cause no problem…
Is there any limitation using BLE and UART together?
Thanks for your help!
JS
Re: ESP32 crashes if UART pins are changed in ble_spp_client example
Posted: Sat May 26, 2018 3:56 am
by ESP_Sprite
What hardware do you use, and did you make sure the hardware doesn't already use GPIO4 and/or 5 for the flash? Rerouting a flash pin would cause the software to crash like this.
Re: ESP32 crashes if UART pins are changed in ble_spp_client example
Posted: Tue May 29, 2018 7:54 pm
by jscastonguay
Hi,
Sorry for the delay. We use ESP32-DevKitC V4. The SW is built with ESP-IDF under Windows. We also tried with GPIO 16/17, 34/35, 22/23… All of them did not work. Curiously, we can change the UART and/or GPIO with the ble_spp_server example and it works! The ble_app_client always crashes if we change the UART and/or GPIO
Thanks,
JS
Re: ESP32 crashes if UART pins are changed in ble_spp_client example
Posted: Wed May 30, 2018 2:53 am
by ESP_Sprite
How exactly does it crash? Do you get a backtrace?
Re: ESP32 crashes if UART pins are changed in ble_spp_client example
Posted: Thu May 31, 2018 2:27 pm
by jscastonguay
Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed)
Core 0 register dump:
PC : 0x40122524 PS : 0x00060934 A0 : 0x800466c6 A1 : 0x3ffc0540
A2 : 0x00000000 A3 : 0x40122524 A4 : 0x00000000 A5 : 0x00000010
A6 : 0x3ffb93cc A7 : 0x3ffb8360 A8 : 0x80019fb8 A9 : 0x000044ac
A10 : 0xf2f2f2f2 A11 : 0x00000000 A12 : 0x800905fb A13 : 0x00000022
A14 : 0x000023f0 A15 : 0x3ffb6710 SAR : 0x00000018 EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
Core 0 was running in ISR context:
EPC1 : 0x4008b327 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x40122524
Backtrace: 0x40122524:0x3ffc0540 0x400466c3:0x3ffc0570 0x40085da6:0x3ffc0590 0x40086906:0x3ffc05b0 0x40087846:0x3ffc05d0 0x4008875b:0x3ffc05f0 0x40082659:0x3ffc0610 0x40062230:0x00000000
Now for a unknown reason, the ESP32 does not crash anymore. Why? No idea. However, we still have problems with UART. Here is our configuration:
Server side (ble_spp_server):
* application code on UART1 (Rx:GPIO 16 and Tx:GPIO 17)
* system log on UART0 (default pins, Rx:GPIO 34 and Tx:GPIO 35)
Everything works.
Client side (ble_spp_client):
* application code on UART1 (Rx:GPIO 16 and Tx:GPIO 17)
* system log on UART0 (default pins, Rx:GPIO 34 and Tx:GPIO 35)
Everything also works.
However, if we try to exchange the UART/pins by this configuration with the client side:
* application code on UART0 (default pins, Rx:GPIO 34 and Tx:GPIO 35)
* system log on UART1 (Rx:GPIO 16 and Tx:GPIO 17)
The system log works but the application does not receive any bytes from UART0 !!!
We change the system log by menuconfig. We change the application code UART by the function uart_set_pin. Do we have to do something else or just calling the function uart_set_pin is enough? Why the UARTs are so difficult to configure? What are we doing wrong?
Thanks for your help.
JS
Re: ESP32 crashes if UART pins are changed in ble_spp_client example
Posted: Fri Jun 01, 2018 1:55 am
by WiFive
Tx:GPIO 35
That is input only gpio
Re: ESP32 crashes if UART pins are changed in ble_spp_client example
Posted: Mon Jun 04, 2018 3:03 pm
by jscastonguay
Hi,
Effectively we saw that we did not use good GPIOs. Now it is working. Thanks for your help.
JS