Quantcast
Viewing all articles
Browse latest Browse all 4899

Beginners • How to Transfer Strings Between Two Cores on Raspberry Pi Pico?

Hello everyone,

I’m working on a project with a Raspberry Pi Pico and using both cores (core0 and core1). I’ve successfully run tasks on each core, but I’m facing an issue when it comes to transferring strings between the two cores.

I'm currently using the rp2040.fifo for communication between the cores. However, the problem is that rp2040.fifo seems to handle numeric data types like uint32_t efficiently, but I’m having trouble figuring out the best way to pass a full string or char array between the cores.

Here’s a simplified version of what I’m doing:

Code:

// On core0if (Serial1.available()) {  String incomingMessage = Serial1.readString(); // Read the string  rp2040.fifo.push(sha1(incomingMessage));      // Attempt to send it (hashed for testing)}// On core1if (rp2040.fifo.available()) {  uint32_t receivedData = rp2040.fifo.pop();  Serial.println("Received data: " + String(receivedData));  // Expected string}

Statistics: Posted by LeonsKenn — Sat Oct 12, 2024 12:06 pm



Viewing all articles
Browse latest Browse all 4899

Trending Articles