SPI transmission crashes causes Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

isfandyar01
Posts: 2
Joined: Sun Oct 29, 2023 11:33 am

SPI transmission crashes causes Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Postby isfandyar01 » Sun Oct 29, 2023 11:41 am

#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "mcp320x_isf.h"
#include <math.h>
#include <stdio.h>

#define NUMBER_OF_SAMPLES 1048

static const char *TAG = "current_sensor";
static const char *VOLTTAG = " Voltage";

double offsetI;
double filteredI;
double sqV, sumV, sqI, sumI, instP, sumP;
double realPower, apparentPower, powerFactor, Vrms;

// Declare the SPI bus and device handles as global variables
static spi_device_handle_t spi2;

static void initializeSPI() {
esp_err_t ret;
spi_bus_config_t buscfg = {
.mosi_io_num = GPIO_NUM_23,
.miso_io_num = GPIO_NUM_19,
.sclk_io_num = GPIO_NUM_18,
.quadwp_io_num = -1,
.quadhd_io_num = -1,
};

ret = spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO);
ESP_ERROR_CHECK(ret);

spi_device_interface_config_t dev_config;
dev_config.address_bits = 0;
dev_config.command_bits = 0;
dev_config.dummy_bits = 0;
dev_config.mode = 0;
dev_config.duty_cycle_pos = 0;
dev_config.cs_ena_posttrans = 0;
dev_config.cs_ena_pretrans = 0;
dev_config.clock_speed_hz = 10 * 1000 * 1000;
dev_config.clock_source = SPI_CLK_SRC_DEFAULT;
dev_config.spics_io_num = GPIO_NUM_5;
dev_config.flags = SPI_DEVICE_NO_DUMMY;
dev_config.queue_size = 1;
dev_config.pre_cb = NULL;
dev_config.post_cb = NULL;

ESP_ERROR_CHECK(spi_bus_add_device(SPI2_HOST, &dev_config, &spi2));
}

static void releaseSPI() {
ESP_ERROR_CHECK(spi_bus_remove_device(spi2));
ESP_ERROR_CHECK(spi_bus_free(SPI2_HOST));
}

static uint16_t spi_read() {
uint16_t value = 0;
uint32_t sum = 0;
char data[3];
char rxdata[3];

spi_transaction_t trans_desc;
trans_desc.addr = 0;
trans_desc.cmd = 0;
trans_desc.flags = SPI_TRANS_USE_RXDATA;
trans_desc.length = 3 * 8;
trans_desc.rxlength = 3 * 8;

trans_desc.tx_data[0] = (uint8_t)((1 << 2) | (MCP320X_READ_MODE_SINGLE << 1) |
((MCP320X_CHANNEL_0 & 4) >> 2));
trans_desc.tx_data[1] = (uint8_t)(MCP320X_CHANNEL_0 << 6);
trans_desc.tx_data[2] = 0;

for (uint16_t i = 0; i <= 1; i++) {
esp_err_t error = spi_device_polling_transmit(spi2, &trans_desc);
if (error != ESP_OK) {
ESP_LOGE(TAG, "SPI transmission error: %s", esp_err_to_name(error));
break;
}
const uint16_t first_part = trans_desc.rx_data[1];
const uint16_t second_part = trans_desc.rx_data[2];

sum += ((first_part & 15) << 8) | second_part;
}

value = (uint16_t)(sum / 2000);
return value;
}

double calcIrms_with_mcp3208(int numberOfSamples) {
uint16_t sampleI = 0;
double sumI = 0;

for (int n = 0; n <= numberOfSamples; n++) {
sampleI = spi_read();

offsetI = (offsetI + (sampleI - offsetI) / 1024);
filteredI = sampleI - offsetI;

sqI = filteredI * filteredI;
sumI += sqI;
}

double I_RATIO = 90.9 * ((3300 / 1000.0) / (4096));
double Irms = I_RATIO * sqrt(sumI / numberOfSamples);

sumI = 0;

return Irms;
}

void app_main() {
// Initialize the SPI bus
initializeSPI();

while (1) {
double Irms_main = calcIrms_with_mcp3208(1);
ESP_LOGI("mcp320x", "Current: %f mA", Irms_main);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}

// Release the SPI bus when done
releaseSPI();
}
this is the github link of repo for anyone who wants to help
https://github.com/isfandyar01/esp32_spi_mcp3208.git


this is my core dump and backtrace

rst:0x1 (POWERON_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:2
load:0x3fff0030,len:7076
load:0x40078000,len:15584
ho 0 tail 12 room 4
load:0x40080400,len:4
load:0x40080404,len:3876
entry 0x4008064c
I (30) boot: ESP-IDF 5.1.1 2nd stage bootloader
I (30) boot: compile time Oct 29 2023 16:23:24
I (31) boot: Multicore bootloader
I (35) boot: chip revision: v1.0
I (38) boot.esp32: SPI Speed : 40MHz
I (43) boot.esp32: SPI Mode : DIO
I (47) boot.esp32: SPI Flash Size : 4MB
I (52) boot: Enabling RNG early entropy source...
I (57) boot: Partition Table:
I (61) boot: ## Label Usage Type ST Offset Length
I (68) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (76) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (83) boot: 2 factory factory app 00 00 00010000 00100000
I (91) boot: End of partition table
I (95) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0afdch ( 45020) map
I (120) esp_image: segment 1: paddr=0001b004 vaddr=3ffb0000 size=02ee4h ( 12004) load
I (125) esp_image: segment 2: paddr=0001def0 vaddr=40080000 size=02128h ( 8488) load
I (129) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=16dach ( 93612) map
I (168) esp_image: segment 4: paddr=00036dd4 vaddr=40082128 size=0bce0h ( 48352) load
I (195) boot: Loaded app from partition at offset 0x10000
I (195) boot: Disabling RNG early entropy source...
I (207) cpu_start: Multicore app
I (207) cpu_start: Pro cpu up.
I (207) cpu_start: Starting app cpu, entry point is 0x4008259c
I (0) cpu_start: App cpu up.
I (225) cpu_start: Pro cpu start user code
I (225) cpu_start: cpu freq: 240000000 Hz
I (225) cpu_start: Application information:
I (230) cpu_start: Project name: esp32_ads1115
I (235) cpu_start: App version: 67d5f36-dirty
I (241) cpu_start: Compile time: Oct 29 2023 16:21:33
I (247) cpu_start: ELF file SHA256: ef0b573097ec0f9f...
I (253) cpu_start: ESP-IDF: 5.1.1
I (258) cpu_start: Min chip rev: v0.0
I (262) cpu_start: Max chip rev: v3.99
I (267) cpu_start: Chip rev: v1.0
I (272) heap_init: Initializing. RAM available for dynamic allocation:
I (279) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (285) heap_init: At 3FFB3850 len 0002C7B0 (177 KiB): DRAM
I (291) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (298) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (304) heap_init: At 4008DE08 len 000121F8 (72 KiB): IRAM
I (312) spi_flash: detected chip: generic
I (315) spi_flash: flash io: dio
I (319) esp_core_dump_uart: Init core dump to UART
I (325) app_start: Starting scheduler on CPU0
I (330) app_start: Starting scheduler on CPU1
I (330) main_task: Started on CPU0
I (340) main_task: Calling app_main()
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Core 0 register dump:
PC : 0x4000c344 PS : 0x00060a30 A0 : 0x80081662 A1 : 0x3ffb5a30
A2 : 0x3ffb6ff0 A3 : 0x00000004 A4 : 0x00000003 A5 : 0x3ffb6ff0
A6 : 0x3ffb6cd8 A7 : 0x00000000 A8 : 0x80000000 A9 : 0x00000000
A10 : 0x00000000 A11 : 0x00000002 A12 : 0x3ffae884 A13 : 0x00000001
A14 : 0xb33fffff A15 : 0xb33fffff SAR : 0x00000010 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000004 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000


Backtrace: 0x4000c341:0x3ffb5a30 0x4008165f:0x3ffb5a40 0x400819e1:0x3ffb5a60 0x40081abc:0x3ffb5a80 0x400d10c4:0x3ffb5aa0 0x400d11c8:0x3ffb5af0 0x400d127c:0x3ffb5b20 0x400891d8:0x3ffb5b50 0x40088de1:0x3ffb5b80

#0 0x4000c341:0x3ffb5a30 in ?? ??:0
#1 0x4008165f:0x3ffb5a40 in setup_priv_desc at C:\Users\ISFAND_PC\.platformio\packages\framework-espidf\components\driver\spi\gpspi/spi_master.c:873
#2 0x400819e1:0x3ffb5a60 in spi_device_polling_start at C:\Users\ISFAND_PC\.platformio\packages\framework-espidf\components\driver\spi\gpspi/spi_master.c:1061
#3 0x40081abc:0x3ffb5a80 in spi_device_polling_transmit at C:\Users\ISFAND_PC\.platformio\packages\framework-espidf\components\driver\spi\gpspi/spi_master.c:1110
#4 0x400d10c4:0x3ffb5aa0 in spi_read at src/main.c:79
#5 0x400d11c8:0x3ffb5af0 in calcIrms_with_mcp3208 at src/main.c:99 (discriminator 3)
#6 0x400d127c:0x3ffb5b20 in app_main at src/main.c:121
#7 0x400891d8:0x3ffb5b50 in main_task at C:\Users\ISFAND_PC\.platformio\packages\framework-espidf\components\freertos/app_startup.c:208 (discriminator 13)
#8 0x40088de1:0x3ffb5b80 in vPortTaskWrapper at C:\Users\ISFAND_PC\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa/port.c:162




ELF file SHA256: ef0b573097ec0f9f

I (422) esp_core_dump_uart: Press Enter to print core dump to UART...
I (479) esp_core_dump_uart: Print core dump to uart...
I (479) esp_core_dump_binary: Found tasks: good 6, bad 0, mem segs 0
================= CORE DUMP START =================
2BIAAAIAAAAGAAAAVAEAAAAAAAA=
CFz7P3BZ+z8AXPs/
kFr7P2Q4+z9kMvs/ZDL7Pwhc+z9cMvs/GAAAAHL7bZhEfnX/CFz7PwAAAAABAAAA
BEz7P21haW4A/6xH3H3j1WbDdgAAAAAAAFz7PwEAAAAAAAAAAAAAAAAAAAAAAAAA
3Or6P0Tr+j+s6/o/AAAAAAAAAAABAAAAAAAAAAAAAAAAAAAASB0AQAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AQAAPw==
9DQIQPC/AEAwAAYAypAIgKD7+j8AAAAAIwAGACAABgBwfP4/4Ob6P4D/+j+9JAiA
cPv6P1g0+z8CAAAABAAAACMABgD//z+z//8/swQAAAClpaWlpaWlpQAAAAAAAAAA
AAAAABo3CEAjAAYA+pIIQFRN+j8AAAAAAAAAAAAAAAD//z+zAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAPQ0CEDcjQhAMAAFAAAAAABZiAiAsPv6P1A0+z8BAAAA
NSUIgND7+j8AAAAAsAH7PwEAAAAAAAAA//8/s///P7PkjQiA8Pv6PwEAAAABAAAA
//////D7+j//////AAAAEAAAAAAg/Po/CCUIQAEAAABUTfo/AAAAAAAAAAAAAAAA
AQAAAAAAAAABAAAAAAAAAAAAAABA/Po/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
fzAIgGB9/j/AXQAAEnd/AQAAAAAAAAAATPz6P6WlpaWlpaWlpaWlpaWlpaWlpaWl
paWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWl
paWlpaWlpaWlpaWlpaWlpQ==
V1ECJw==
================= CORE DUMP END =================
Coredump checksum='27025157'
I (1072) esp_core_dump_uart: Core dump has been written to uart.

mikemoy
Posts: 626
Joined: Fri Jan 12, 2018 9:10 pm

Re: SPI transmission crashes causes Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Postby mikemoy » Sun Oct 29, 2023 3:52 pm

I see you have trans_desc.rxlength = 3 * 8; where is trans_desc.txlength = 3 * 8; ?

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

Re: SPI transmission crashes causes Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Postby ESP_Sprite » Mon Oct 30, 2023 1:24 am

Make sure to initialize your stack-allocated stuctures, otherwise untouched fields will have crap in it leading to things like this. So rather than this:

Code: Select all

 spi_transaction_t trans_desc;
 
do this:

Code: Select all

 spi_transaction_t trans_desc={0};
 

isfandyar01
Posts: 2
Joined: Sun Oct 29, 2023 11:33 am

Re: SPI transmission crashes causes Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Postby isfandyar01 » Tue Oct 31, 2023 11:39 am

ESP_Sprite wrote:
Mon Oct 30, 2023 1:24 am
Make sure to initialize your stack-allocated stuctures, otherwise untouched fields will have crap in it leading to things like this. So rather than this:

Code: Select all

 spi_transaction_t trans_desc;
do this:

Code: Select all

 spi_transaction_t trans_desc={0};
doing this solved my issue

Who is online

Users browsing this forum: No registered users and 84 guests