spi and rtos panics

danny@cs.huji.ac.il
Posts: 31
Joined: Thu Mar 30, 2017 10:39 am

spi and rtos panics

Postby danny@cs.huji.ac.il » Thu Mar 30, 2017 11:05 am

Hi,
I am developing for an ESP32-wroom (i have 2 dev boards, one from Adafruit, and one fro Doit)
I have so far managed to write code that connects to an access point, and listens
to my commands, mainly OTA update, which works.
So now I'm trying the SPI stuff, and as soon as I start a transaction it panics:
Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU1)

on the Saleae I see that the CS is lowered, but no clock, nothing.

I'm using the latest esp-idf (rc2?)

danny

ESP_Sprite
Posts: 9051
Joined: Thu Nov 26, 2015 4:08 am

Re: spi and rtos panics

Postby ESP_Sprite » Thu Mar 30, 2017 3:57 pm

What code do you use to set up & start the spi transaction?

danny@cs.huji.ac.il
Posts: 31
Joined: Thu Mar 30, 2017 10:39 am

Re: spi and rtos panics

Postby danny@cs.huji.ac.il » Fri Mar 31, 2017 5:25 am

the code is work-in-progress, but the last message printed is the one just before the
begining of the transfer.

thanks,
danny
PS: why is plain text not acceptable as attachment?
Attachments
spi.h.pdf
(11.55 KiB) Downloaded 506 times
spi.c.pdf
(21.65 KiB) Downloaded 605 times

ESP_Sprite
Posts: 9051
Joined: Thu Nov 26, 2015 4:08 am

Re: spi and rtos panics

Postby ESP_Sprite » Fri Mar 31, 2017 8:19 am

You're doing an ESP_LOGI from the pre-transfer callback, which is executed in interrupt context. ESP_LOGI calls printf, which can't be used in interrupt context. Use ESP_EARLY_LOGI instead.

danny@cs.huji.ac.il
Posts: 31
Joined: Thu Mar 30, 2017 10:39 am

Re: spi and rtos panics

Postby danny@cs.huji.ac.il » Fri Mar 31, 2017 11:53 am

I only added the print out of frustration, It panics without it too.

even if the callback is null.

danny

ESP_Sprite
Posts: 9051
Joined: Thu Nov 26, 2015 4:08 am

Re: spi and rtos panics

Postby ESP_Sprite » Sat Apr 01, 2017 4:54 am

Hmm . Any chance you could get us a backtrace of where the error happens?

danny@cs.huji.ac.il
Posts: 31
Joined: Thu Mar 30, 2017 10:39 am

Re: spi and rtos panics

Postby danny@cs.huji.ac.il » Sat Apr 01, 2017 7:51 am

sure:
Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU1)
Register dump:
PC : 0x400d1b0c PS : 0x00060b34 A0 : 0x80084118 A1 : 0x3ffb9fd0
A2 : 0x00000008 A3 : 0x00000001 A4 : 0x00060623 A5 : 0x3ffba088
A6 : 0x00000001 A7 : 0x00000001 A8 : 0x3ffb25d0 A9 : 0x3ffb9fb0
A10 : 0x00000000 A11 : 0x00060b20 A12 : 0x80084f2d A13 : 0x3ffbe6d0
A14 : 0x00000003 A15 : 0x00060d23 SAR : 0x00000000 EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000

Backtrace: 0x400d1b0c:0x3ffb9fd0 0x40084118:0x3ffb9ff0

Rebooting...


xtensa-esp32-elf-addr2line -pfia -e build/mfrc.elf 0x400d1b0c:0x3ffb9fd0
0x400d1b0c: esp_vApplicationIdleHook at /vol/src/esp/esp-idf/components/esp32/./freertos_hooks.c:52
esp32> xtensa-esp32-elf-addr2line -pfia -e build/mfrc.elf 0x40084118:0x3ffb9ff0
0x40084118: prvIdleTask at /vol/src/esp/esp-idf/components/freertos/./tasks.c:3424

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: spi and rtos panics

Postby WiFive » Sat Apr 01, 2017 8:59 am

Does msdelay use vtaskdelay? Probably want bigger stack size.

danny@cs.huji.ac.il
Posts: 31
Joined: Thu Mar 30, 2017 10:39 am

Re: spi and rtos panics

Postby danny@cs.huji.ac.il » Sat Apr 01, 2017 10:33 am

any particular one? I increased (doubled) the ISR in freeRTOS, and one in esp32 specific main stack stack size

but it's still panics

thanks,
danny

danny@cs.huji.ac.il
Posts: 31
Joined: Thu Mar 30, 2017 10:39 am

Re: spi and rtos panics

Postby danny@cs.huji.ac.il » Tue Apr 04, 2017 6:01 am

problem solved!
increased task stack size in xTaskCreate

thanks!!!

danny

Who is online

Users browsing this forum: Google [Bot] and 238 guests