I am using a unique hardware with ESP32Wrover module. I am using Platformio with arduino and idf framework, platformio 5.3.0 release (Arduino v2.0.6 and ESP-IDF to v4.4.3).
The following functionalities needs to be implemented:
1. Ethernet with webserver functionality
2. time critical SPI measurement with 20MHz SPI clock, x4 burst measurement, chip select stretching, 18us period. Reading must be continuous.
3. Two channel PWM signal ~8kHz frequency which is enabled for 100ms and disabled for 900ms (implemented with MCPWM)
All of the functions are implemented and working well, separately.. To have a deterministic operation I assigned all measurement related stuffs to Core 1 as it is described in this thread:
https://esp32.com/viewtopic.php?f=2&t=1 ... 51#p107851
The interrupts on Core1 are disabled, watchdog on core1 disabled, delay() function never called, all functions and variables are in RAM (DMA_ATTR and IRAM_ATTR attributes are used).
The core0 doing ethernet stuff and core1 doing measurement. Core1 has additional algorithms for filtering the measurement data. However if the SPI measurement is running or the PWM signal is active on the output the ethernet becomes broken (the device does not get IP address and it connects / disconnects repeatedly). If the SPI measurement and MCPWM are disabled the ethernet work perfectly.
If I use the following code on core1, and call it periodically:
Code: Select all
SPI2->data_buf[0] = *txBuf;
// Start transfer
spi_ll_master_user_start(SPI2);
while (SPI2->cmd.usr); // Wait for SPI bus ready
*rxBuf = (uint16_t) SPI2->data_buf[0];
What can be the problem?
Does the SPI share any resource with the Ethernet mac? Do the core 1 reserves any internal bus with causes failure?