Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3843

General • pico multicore & printf

$
0
0
Hi,
The following output via minicom over usb is correct, as produced by the code snippets after the +++ line. What I'm interested in knowing is why this doesn't work without all those sleep_ms(1000); calls. Is there some issue with printf?
BTW, "doesn't work" is defined as missing printf output to the terminal...some or all.
thanks for looking,
Bill

INITIALIZED
Below shift point
Confirm start_core1!, 0 here
Core 1 entry1!
Core 1 entry2!
Initial State:
ARMED = 1
MSD_LAMP = 1
exiting main on core 0
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
code snippets start here, in order of code startup.


printf("%s%s", "INITIALIZED\n", spell[POS_3]);
sleep_ms(1000);

start_core1();
printf("exiting main on core 0\n");
stdio_flush();
========================================================

void start_core1()
{
multicore_launch_core1(core1_entry);

// Wait for it to start up
sleep_ms(1000);

uint32_t g = multicore_fifo_pop_blocking(); //get the alive msg from core1_entry

if (g != FLAG_VALUE)
{
printf("Err: core 0 rcvd %d from core 1!\n",g);
}
else
{
printf("Confirm start_core1!, %d here\n", get_core_num());
sleep_ms(1000);
multicore_fifo_push_blocking(FLAG_VALUE); //send core1 the start msg
sleep_ms(1000);
}
}

=============================================================================
void core1_entry() {

multicore_fifo_push_blocking(FLAG_VALUE); //notify core 0 I'm here
sleep_ms(1000);
printf("Core %d entry1!\n", get_core_num() ); //verify this IS core 1
uint32_t g = multicore_fifo_pop_blocking(); //wait for start from core 0
printf("Core %d entry2!\n", get_core_num() ); //confirm start msg rcvd

if (g != FLAG_VALUE)
{
printf("Err: core 1 rvcd %d from core 0!\n", g);
printf("core %d shutting down\n", get_core_num()); //shut down & exit
stdio_flush();
multicore_reset_core1();
}
else
{
printf("Initial State:\n");
printf("ARMED = %d\n", gpio_get(ARMED));
printf("MSD_LAMP = %d\n", gpio_get(MSD_LAMP));

Statistics: Posted by wwmartin — Fri Aug 23, 2024 1:10 am



Viewing all articles
Browse latest Browse all 3843

Trending Articles