Dual Core Implementations
Posted: Tue May 21, 2019 9:24 pm
Hello,
I am new to the use of multi-core devices, and was hoping to get more information / examples on how to properly configure the ESP32 for use of both cores. I have read data sheets and other threads discussing the topic and have gleaned some information from them, but it is not nearly enough to move forward with.
We plan on creating a communications device which could be used to implement connectivity needs for all of our products. We were hoping to place the ESP32 at the heart of this solution because it provides a cost-effective hardware solution with open source code that we can leverage to control the future of our product lines. We have paid a consultant to research the ESP32 and perform some preliminary design work as a proof of concept. One of the issues that was encountered in that exercise dealt with latency in serial communications between the ESP32 and our local processor. According to the consultant, the implementation of the SPI driver code for the ESP32 had some fairly serious limitations in how the traffic had to be packetized and queued. Since the driver and the queue are managed by the OS, there were latency issues with passing commands to the ESP32 and retrieving responses in a timely fashion. Additionally, pin assignments via the GPIO ring caused delays which prompted the necessity of a "dummy" bit work-around.
Much of what I have seen and read about in regard to example code relies upon the use of FreeRTOS. From what I have read, I believe the default configuration would have FreeRTOS manage the tasks and assign them to an "available" core. In the interest of segregating time-sensitive communications (stack) code from our application code, I was hoping to leverage the multi-core silicon to support the BLE and WiFi stack operations on the first core with the use of the OS, while using the second "App" core for our application-specific "bare metal" code. In theory, this would allow us to isolate our application code and manage the serial peripherals without interruption from the stack and FreeRTOS operations (essentially operating as two separate entities). If this is feasible, I need a better understanding of some root functionality of the ESP32 design before I can progress.
The first topic is memory access. The documentation refers to a flexible addressing scheme which provides both shared and isolated access regions for each core. Unfortunately, any external flash memory would have to be accessed through a common MMU and cache interface which can pose some arbitration issues. The data sheets mention part options with embedded flash, but I cannot find details regarding where this memory fits into the map. Based on the lack of predefined memory regions to support it, I presume this may be treated as "external memory" and accessed through the MMU as well... is that correct? One topic of discussion suggested executing code for the application processor through RAM to avoid arbitration issues with the first core... Is that necessary, or just a manner of ensuring zero delays in operation of the second core?
The next question I have is in regard to interrupt handling. Does the silicon support a single interrupt controller, or does each core contain an interrupt controller that can be configured to assume responsibility for specific events? If the design supports a single controller, is it handled by the first core by default?
Finally, I have questions regarding peripheral support. Is it possible to have the first core - which I envision as handling communications stacks - manage the radio interface and any required timers, while having the second core - which I envision as handling application-specific tasks - manage the interface with the remaining peripherals?
If the peripherals and interrupt handling cannot be independently managed by each core, then the topology I was considering is probably not plausible. If it is plausible to segregate these operations, it would be ideal for us to implement our custom secure bootloader code on the core running our application code. We can then securely connect to the cloud to retrieve firmware updates for both the application and the communications stacks and perform in-circuit reprogramming of the flash memory.
Thanks in advance!
Mark
I am new to the use of multi-core devices, and was hoping to get more information / examples on how to properly configure the ESP32 for use of both cores. I have read data sheets and other threads discussing the topic and have gleaned some information from them, but it is not nearly enough to move forward with.
We plan on creating a communications device which could be used to implement connectivity needs for all of our products. We were hoping to place the ESP32 at the heart of this solution because it provides a cost-effective hardware solution with open source code that we can leverage to control the future of our product lines. We have paid a consultant to research the ESP32 and perform some preliminary design work as a proof of concept. One of the issues that was encountered in that exercise dealt with latency in serial communications between the ESP32 and our local processor. According to the consultant, the implementation of the SPI driver code for the ESP32 had some fairly serious limitations in how the traffic had to be packetized and queued. Since the driver and the queue are managed by the OS, there were latency issues with passing commands to the ESP32 and retrieving responses in a timely fashion. Additionally, pin assignments via the GPIO ring caused delays which prompted the necessity of a "dummy" bit work-around.
Much of what I have seen and read about in regard to example code relies upon the use of FreeRTOS. From what I have read, I believe the default configuration would have FreeRTOS manage the tasks and assign them to an "available" core. In the interest of segregating time-sensitive communications (stack) code from our application code, I was hoping to leverage the multi-core silicon to support the BLE and WiFi stack operations on the first core with the use of the OS, while using the second "App" core for our application-specific "bare metal" code. In theory, this would allow us to isolate our application code and manage the serial peripherals without interruption from the stack and FreeRTOS operations (essentially operating as two separate entities). If this is feasible, I need a better understanding of some root functionality of the ESP32 design before I can progress.
The first topic is memory access. The documentation refers to a flexible addressing scheme which provides both shared and isolated access regions for each core. Unfortunately, any external flash memory would have to be accessed through a common MMU and cache interface which can pose some arbitration issues. The data sheets mention part options with embedded flash, but I cannot find details regarding where this memory fits into the map. Based on the lack of predefined memory regions to support it, I presume this may be treated as "external memory" and accessed through the MMU as well... is that correct? One topic of discussion suggested executing code for the application processor through RAM to avoid arbitration issues with the first core... Is that necessary, or just a manner of ensuring zero delays in operation of the second core?
The next question I have is in regard to interrupt handling. Does the silicon support a single interrupt controller, or does each core contain an interrupt controller that can be configured to assume responsibility for specific events? If the design supports a single controller, is it handled by the first core by default?
Finally, I have questions regarding peripheral support. Is it possible to have the first core - which I envision as handling communications stacks - manage the radio interface and any required timers, while having the second core - which I envision as handling application-specific tasks - manage the interface with the remaining peripherals?
If the peripherals and interrupt handling cannot be independently managed by each core, then the topology I was considering is probably not plausible. If it is plausible to segregate these operations, it would be ideal for us to implement our custom secure bootloader code on the core running our application code. We can then securely connect to the cloud to retrieve firmware updates for both the application and the communications stacks and perform in-circuit reprogramming of the flash memory.
Thanks in advance!
Mark