Good Morning!
I'm doing a project in which I use the two processors separately and two I2C channels ( TwoWire ), where in each processor I use an I2C channel.
The Zero Processor is used for sensor reading routines through the I2C channel (INA219, BME680, ADS1115, DS1302), storing the values in global variables .
The Processor A use for the other routines and control of the LCD and keyboard, both I2C and demonstration of the values of the global variables .
In the compilation everything works , but after turning on Esp32 it works for a few seconds and then crashes.
I'm using I2C as follows :
TwoWire I2C_1 = TwoWire ( 0);
TwoWire I2C_2 = TwoWire ( 1);
I2C_ 1.begin (21, 22, 100000);
I2C_ 2.begin (15, 4, 100000);
The Processors I am creating as follows :
xTaskCreatePinnedToCore ( CoreZero , " CoreZero ", 16392, NULL, 5, NULL, 0);
delay ( 500);
xTaskCreatePinnedToCore ( CoreOne , " CoreOne ", 16392, NULL, 5, NULL, 1);
delay ( 500);
void loop( ) {
vTaskDelete ( NULL);
}
Observation:
The processors being used one without routine in the other works perfectly, however the two connected together does not work.
I need help trying to clarify the problem and whoever helps me to clarify I will give a payment.
Thanks.
Issues with using multiprocessing and TwoWire I2C
Re: Issues with using multiprocessing and TwoWire I2C
What exactly are the crash details?
The original Arduino TwoWire code was never thread-safe. The version in the arduino-esp32 component attempts to be but you need to make sure that CONFIG_DISABLE_HAL_LOCKS is NOT set in your sdkconfig. Even still, it's not perfect. Seeing the crash dump will help understand what's going on.
The original Arduino TwoWire code was never thread-safe. The version in the arduino-esp32 component attempts to be but you need to make sure that CONFIG_DISABLE_HAL_LOCKS is NOT set in your sdkconfig. Even still, it's not perfect. Seeing the crash dump will help understand what's going on.
Re: Issues with using multiprocessing and TwoWire I2C
When I start Esp32 it works for a few seconds and crashes. The routines that run on Processor Zero are reading the sensors and devices that I have listed, placed all on a processor works perfectly, when divided into two Wires the problems begin.
I wanted to check if it was possible to work the way I'm trying.
The bug message follows.
thanks
I wanted to check if it was possible to work the way I'm trying.
The bug message follows.
thanks
- Attachments
-
- bug.txt
- (2.01 KiB) Downloaded 243 times
-
- 1655252881396.jpg (3.99 MiB) Viewed 3149 times
-
- 1655252881383.jpg (3.87 MiB) Viewed 3149 times
Re: Issues with using multiprocessing and TwoWire I2C
As I said, the original TwoWire Arduino code was never thread-safe. Espressif had to add a lot of locking to get that model to work in multiple threads and even with that, it's not perfect.
The only suggestions I have are...
The only suggestions I have are...
- Check the setting of DISABLE_HAL_LOCKS under Arduino in menuconfig.
- Can you split usage of the busses so that bus 1 is only accessed from Core 1 and bus 2 is only accessed from Core 2? Maybe create queues so that if one core needs data from the other bus, it can queue a request to the other core?
- Under ESP System Settings, set Panic handler behaviour to GDBStub on panic so you can see which threads are blocked on what.
- Search for ESP32 native drivers for your I2C devices so you don't have to use the Arduino TwoWire component.
Re: Issues with using multiprocessing and TwoWire I2C
Thank you friend,
I will explore your suggestions and get back to you.
I will explore your suggestions and get back to you.
Who is online
Users browsing this forum: No registered users and 73 guests