user1532080
user1532080

Reputation: 297

Why does multicore hang on my Raspberry Pi Pico

I can try pretty much any of the examples, launching code on core 1 hangs.

It hangs in multicore_launch_core1_raw, the first call to multicore_fifo_pop_blocking never returns.

Anyting I'm missing? (Among others, "hello_multicore" is doing that).

Here's the code of hello_multicore, from the official examples (so all the includes are from the SDK):

/**
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/multicore.h"

#define FLAG_VALUE 123

void core1_entry() {

    multicore_fifo_push_blocking(FLAG_VALUE);

    uint32_t g = multicore_fifo_pop_blocking();

    if (g != FLAG_VALUE)
        printf("Hmm, that's not right on core 1!\n");
    else
        printf("Its all gone well on core 1!");

    while (1)
        tight_loop_contents();
}

int main() {
    stdio_init_all();
    printf("Hello, multicore!\n");

    /// \tag::setup_multicore[]

    multicore_launch_core1(core1_entry);

    // Wait for it to start up

    uint32_t g = multicore_fifo_pop_blocking();

    if (g != FLAG_VALUE)
        printf("Hmm, that's not right on core 0!\n");
    else {
        multicore_fifo_push_blocking(FLAG_VALUE);
        printf("It's all gone well on core 0!");
    }

    /// \end::setup_multicore[]
}

It'll hang on line "multicore_launch_core1(core1_entry);".

I'd like to know how to make it not hang, or why it hangs.

Upvotes: -4

Views: 31

Answers (0)

Related Questions