Dual Core issues

videobuff
Posts: 1
Joined: Mon Mar 22, 2021 2:59 pm

Dual Core issues

Postby videobuff » Mon Mar 22, 2021 3:19 pm

I am writing cde for a antenna rotor, and would like to have the graphic code to run in one task, whereas getting the heading data from the antenna will run in another task. (I haven't written the last one yet, since i got stuck at the grafhics. The graphics itsself is running fine if i dont' use dual core.
However, when porting the code to a working simple dual core example. i got stuck and receive the following error code
  1. Task1 running on core 0
  2. Task2 running on core 1
  3. ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮'⸮⸮⸮0000000  A8      : 0x800d46c8  A9      : 0x3ffd5900  
  4. A10     : 0x007bef7b  A11     : 0x007bef00  A12     : 0x000003ef  A13     : 0x0000000f  
  5. A14     : 0x00000006  A15     : 0x0000007e  SAR     : 0x00000016  EXCCAUSE: 0x0000001d  
  6. EXCVADDR: 0x00000000  LBEG    : 0x400d9098  LEND    : 0x400d90fa  LCOUNT  : 0x00000002  
  7.  
  8. ELF file SHA256: 0000000000000000
  9.  
  10. Backtrace: 0x400d46d1:0x3ffd5920 0x400d1075:0x3ffd5970 0x400d1144:0x3ffd59a0 0x400861e5:0x3ffd59c0
  11.  
  12. Rebooting...
  13. Task1 running on core 0
  14. Task2 running on core 1
  15. Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.
  16. Core 1 register dump:
  17. PC      : 0x400d46d1  PS      : 0x00060e30  A0      : 0x800d1078  A1      : 0x3ffd58c0  
  18. A2      : 0x3ffc01b4  A3      : 0x3ffc02d8  A4      : 0x3ffbdbbc  A5      : 0x00000000  
  19. A6      : 0x00000002  A7      : 0x00000000  A8      : 0x800d46c8  A9      : 0x3ffd58a0  
  20. A10     : 0x007bef7b  A11     : 0x007bef00  A12     : 0x000003ef  A13     : 0x0000000f  
  21. A14     : 0x00000006  A15     : 0x0000007e  SAR     : 0x00000016  EXCCAUSE: 0x0000001d  
  22. EXCVADDR: 0x00000000  LBEG    : 0x400d9098  LEND    : 0x400d90fa  LCOUNT  : 0x00000002  
  23.  
It is the call to plotNeedle(angle,30) from this subroutine who creates the havoc, and i searched for days for a solution but could not find it.
  1. //Task2code: blinks an LED every 700 ms
  2. void Task2code( void * pvParameters ){
  3.   Serial.print("Task2 running on core ");
  4.   Serial.println(xPortGetCoreID());
  5.  
  6. variable = true;
  7.  while (variable == true) {
  8.     uint16_t angle = random(361); // random speed in range 0 to 240
  9.     plotNeedle(angle, 30);
  10.     variable = false;
  11.     delay(500);
  12.   }
  13. vTaskDelete(NULL);
  14. }
The complete code is attached
Any help is very much appreciated....

Erik
Attachments
Webroto_dualcore.zip
(34.26 KiB) Downloaded 245 times

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

Re: Dual Core issues

Postby ESP_Sprite » Tue Mar 23, 2021 4:24 am

It would help if you could decode the backtrace so we could see the exact line that triggers the StoreError.

Edit: Possibly found it. You start up task2 in setup() and only afterwards initialize the TFT. What do you think plotNeedle would do if it happens to run before the TFT code is initialized? Note that you're running it in a separate task which starts running in parallel with your setup() code as soon as you create it.

Who is online

Users browsing this forum: No registered users and 98 guests