Can't get multicore to work

Hello all,

I’ve been using platformIO to program my RP2040; I’m now at the part in which I wanna use the second core in the RP2040.
I’ve looked at the docs on how to enable it, but it doesn’t work.

Here is my main.cpp:

#include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
#include <INA226.h>
#include <TFT_eSPI.h>
#include "screenCustom.h"


TFT_eSPI tft = TFT_eSPI();
TFT_eSprite mainScreen = TFT_eSprite(&tft);
INA226 ina(Wire);

const int buttonMarkerM1 = 6;
const int buttonMarkerM2 = 7;
const int buttonMarkerM3 = 8;
const int buttonPowerOn = 9;

const int ledOn1 = 10;
const int ledOn2 = 11;

void setup() {
	Serial.begin(115200);

	setupLoadingScreen();
		pinMode(buttonMarkerM1, INPUT);
		pinMode(buttonMarkerM2, INPUT);
		pinMode(buttonMarkerM3, INPUT);
		pinMode(buttonPowerOn, INPUT);

		pinMode(ledOn1, OUTPUT);
		pinMode(ledOn2, OUTPUT);

		digitalWrite(ledOn1, LOW);
		digitalWrite(ledOn2, HIGH);
		delay(650);
		digitalWrite(ledOn1, HIGH);
		digitalWrite(ledOn2, LOW);

	loadScreenLoadingBar(50);
	delay(400);
		Wire.begin();

		if(ina.begin()) {
			loadScreenErrorMessage("Error: Can't connect to INA226");
			while(true) {}
		}
	loadScreenLoadingBar(100);
	delay(900);
	loadScreenLoadingBar(200);
	delay(200);
}

void loop() {
	setupMainScreen(0, 0.00, 0.00, 12.00, 0.00, 0);
}

void setup1() {

}

void loop1() {
	Serial.println(digitalRead(buttonPowerOn));

	if(digitalRead(buttonPowerOn)) {
		digitalWrite(ledOn1, LOW);
		digitalWrite(ledOn2, HIGH);
		delay(1000);
		digitalWrite(ledOn1, HIGH);
		digitalWrite(ledOn2, LOW);
		delay(1000);
	}
}

My platformio.ini looks like this;

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:pico]
platform = raspberrypi
board = pico
framework = arduino

; change microcontroller
board_build.mcu = rp2040

; change MCU frequency
board_build.f_cpu = 133000000L


lib_deps = 
	bodmer/TFT_eSPI@^2.5.30
	peterus/INA226Lib@^1.1.3

I’ve searched all day on a fix, but I can’t seem to find one. What am I doing wrong?

Thanks for the help.

No. If you want to use EarlePhilhower’s Arduino-Pico core, you must use platformio.ini basis per

https://arduino-pico.readthedocs.io/en/latest/platformio.html#examples

Don’t forget Using this core with PlatformIO — Arduino-Pico 3.6.0 documentation too.

1 Like

Thanks, this was the issue.

I’ve now solved it.