Arduino Nano RP2040 Connect multicore

Hi!

I'm one of the lucky who managed to get a hold of a brand new Arduino Nano RP2040 Connect on release day. Now, I've gotten around to test it out, and what I've noticed is that there are no concrete tutorials (yet?) for how to properly getting the multi-core functionality going. I've tried some small things here and there - importing <pico/multicore.h> works a bit - it compiles well and good, but it seem to freeze after running the branching function. The last thing that happens is one printout, and the led lighting up.

Is there anyone out there who've managed to getting this to work?

Adding my useless code as well.

#include <pico/multicore.h>

void loop1() {
  while(true){
    Serial.println("hello world 2");
    delay(1000);
  } 
}

void setup() {
  Serial.begin(115200);
  pinMode(LED_BUILTIN, OUTPUT);
  
  delay(5000);
  multicore_launch_core1(loop1);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(500);
}

void loop() {
  while(true){
    digitalWrite(LED_BUILTIN, HIGH);
     delay(500);
     digitalWrite(LED_BUILTIN, LOW);
     delay(500);
  }
}

@henraisse, your topic has been moved to a more suitable location on the forum.

Okay, I think I've reached at least a couple of conclusions;

  1. Serial printing apparently works poorly on the second core. For some reason.
  2. Not sure why, but the usual delay() works poorly. use sleep_ms() instead.

I managed to get an interference pattern with the following sketch:

#include <pico/multicore.h>

void loop1() {
  while(true){
     digitalWrite(LED_BUILTIN, LOW);
     sleep_ms(600);
  }
}

void setup() {
  Serial.begin(115200);
  pinMode(LED_BUILTIN, OUTPUT);
  
  sleep_ms(5000);
  multicore_launch_core1(loop1);
  digitalWrite(LED_BUILTIN, HIGH);
  sleep_ms(500);
}

void loop() {
    while(true){
    digitalWrite(LED_BUILTIN, HIGH);
    sleep_ms(500);
  } 
}

Hope this could help others.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.