bkgoodman / esp-idf-lora

ESP32 ISP-IDF Support for LoRa
1 stars 0 forks source link

InstrFetchProhibited with SPI SDcard driver in use #1

Open ghost opened 2 years ago

ghost commented 2 years ago

Hi,

I'm testing this with a LoRa32 TTGO board, using DIO0 as the RX callback. The firmware also uses the SPI sdcard driver.

0;32mI (741) gpio: GPIO[26]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:1 ␛[0m
... (LORA configured here, succeeds)...
␛[0;32mI (991) uart: queue free spaces: 16␛[0m
...
I (1011) wifi:wifi driver task: 3ffc7364, prio:23, stack:6656, core=0
I (1011) wifi:wifi firmware version: eb52264
I (1011) wifi:wifi certification version: v7.0
I (1011) wifi:config NVS flash: enabled
I (1011) wifi:config nano formating: disabled
I (1021) wifi:Init data frame dynamic rx buffer num: 32
I (1021) wifi:Init management frame dynamic rx buffer num: 32
I (1031) wifi:Init management short buffer num: 32
I (1031) wifi:Init dynamic tx buffer num: 32
I (1041) wifi:Init static rx buffer size: 1600
I (1041) wifi:Init static rx buffer num: 10
I (1051) wifi:Init dynamic rx buffer num: 32
␛[0;32mI (1051) wifi_init: rx ba win: 6␛[0m
␛[0;32mI (1051) wifi_init: tcpip mbox: 32␛[0m
␛[0;32mI (1061) wifi_init: udp mbox: 6␛[0m
␛[0;32mI (1061) wifi_init: tcp mbox: 6␛[0m
␛[0;32mI (1061) wifi_init: tcp tx win: 5744␛[0m
␛[0;32mI (1071) wifi_init: tcp rx win: 5744␛[0m
␛[0;32mI (1071) wifi_init: tcp mss: 1440␛[0m
␛[0;32mI (1081) wifi_init: WiFi IRAM OP enabled␛[0m
␛[0;32mI (1091) wifi_init: WiFi RX IRAM OP enabled␛[0m
sdcard...
␛[0;32mI (1201) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 ␛[0m
␛[0;32mI (1201) sdspi_transaction: cmd=52, R1 response: command not supported␛[0m
␛[0;32mI (1251) sdspi_transaction: cmd=5, R1 response: command not supported␛[0m
Guru Meditation Error: Core  0 panic'ed (InstrFetchProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x00000000  PS      : 0x00060030  A0      : 0x00000000  A1      : 0x3ffbc510  
A2      : 0x3ffb948c  A3      : 0x00000000  A4      : 0x3ffb4610  A5      : 0x3ffb4620  
A6      : 0x00000001  A7      : 0x00000049  A8      : 0x8008cec4  A9      : 0x3ffbc4f0  
A10     : 0x3ffb948c  A11     : 0x0000007b  A12     : 0x00000049  A13     : 0x00000049  
A14     : 0x00000000  A15     : 0x00000001  SAR     : 0x00000000  EXCCAUSE: 0x00000014  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000  

My pin configuration:

#define SDCARD_MOSI     15
#define SDCARD_MISO     2
#define SDCARD_CS       13

#define LORA_MOSI       27
#define LORA_MISO       19
#define LORA_SCLK       5
#define LORA_CS         18
#define LORA_RST        23
#define LORA_DIO0       26
#define LORA_ISR        LORA_DIO0

#define CONFIG_LORA_CS_GPIO  LORA_CS
#define CONFIG_LORA_RST_GPIO LORA_RST
#define CONFIG_LORA_MISO_GPIO LORA_MISO
#define CONFIG_LORA_MOSI_GPIO LORA_MOSI
#define CONFIG_LORA_SCK_GPIO LORA_SCLK
#define CONFIG_LORA_IRQ_GPIO LORA_ISR

It seems like a conflict with the ISR handler.

ghost commented 2 years ago

Confirming this, I can't get the IRQ based rx handling to work. I managed to get the SPI sdcard code to work by placing the sx127x into the VSPI bus, and the sdcard in HSPI. I initialize the latter first, then I initialize sx127x. But the ISR code is not cooperating.