SIPEED MAIX/K210: Access Multi-Core CPU functions in Arduino?

We are releasing a wide selection of AI products AIoT projects. Here you'll find the latest AI Hardware updates and comprehensive support. Please feel free to leave comments/suggestions and share your experience.

Moderators: lily.li, violet

Post Reply
crmann25
Pre-kindergarten
Pre-kindergarten
Posts: 2
Joined: Tue Aug 27, 2019 1:19 am

SIPEED MAIX/K210: Access Multi-Core CPU functions in Arduino?

Post by crmann25 » Tue Oct 08, 2019 3:23 am

Is there any information regarding the K210 multi-core feature and Arduino? Is this even supported?

uli649
Pre-kindergarten
Pre-kindergarten
Posts: 1
Joined: Sun Dec 15, 2019 5:03 pm

Re: SIPEED MAIX/K210: Access Multi-Core CPU functions in Arduino?

Post by uli649 » Sun Dec 15, 2019 5:12 pm

suggestion:

2 Tabs in Arduino IDE

Main Tab: (Core0 code)

Code: Select all

#include <entry.h>

const uint8_t led = LED_RED;

void setup() 
{
  Serial.begin(9600);
  Serial.print("Start Core: "); Serial.println(current_coreid());
  pinMode(led,OUTPUT);
  register_core1(main1 , NULL ); 
}

void loop() 
{
  const unsigned long interval = 333;
  static uint64_t merker = 0;
  static bool ledStatus = false;
  if(millis() - merker > interval)
  {
    merker+=interval;
    ledStatus = !ledStatus;
    digitalWrite(led,ledStatus); 
  }
}


Second Tab: (Core1 code)

Code: Select all

const uint8_t led1 = LED_BLUE;

void setup1()
{
  Serial.print("Start Core: "); Serial.println(current_coreid());
  pinMode(led1,OUTPUT);
}


void loop1()
{
  const unsigned long interval = 1000;
  static uint64_t merker = 0;

  static bool ledStatus = false;
  if(millis() - merker > interval)
  {
    merker+=interval;
    ledStatus = !ledStatus;
    digitalWrite(led1,ledStatus);
  }
}

int main1(void *parameter)
{
  setup1();
  while(1)
  {
    loop1();
  }
}
It is blinking with two led.


Be careful with concurrent access to resources.
Example: the serial outputs of both cores mix

Post Reply