Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

The problem of data transfer between the cores on ESP-Wroom-32.

Posted by orangepizero on August 1, 2017

Hello. In this code it is not possible to print correctly the data on each task. I can not understand the reason. The output of the program is below. How do I get the HELLO_WORLD string in each of the tasks in the output? Using the parameter transfer. Thank you. ~~~

include
include "freertos/FreeRTOS.h"
include "freertos/task.h"
include "freertos/event_groups.h"
include "esp_system.h"
include "espeventloop.h"
include "esp_log.h"
include "nvs_flash.h"

const sizet stacksize = 4096;

static void task1(void *pvParameters) { ESPLOGE("TASK", "TASK CORE1: %s", (char *)pvParameters); vTaskDelete(NULL); }

static void taskmain(void *pvParameters) { char *data = (char *)pvParameters; while(1) { ESPLOGI("TASK", "TASK CORE0: %s", data); vTaskDelay(1000 / portTICKRATEMS); xTaskCreatePinnedToCore(&task1, "task1", stacksize, (void*)&data, 2, NULL, 1); } vTaskDelete(NULL); }

void appmain() { char data[12] = "HELLOWORLD"; xTaskCreatePinnedToCore(&taskmain, "taskmain", stack_size, (void*)&data, 1, NULL, 0); } ~~~

OUTPUT: ~~~ E (264246) TASK: TASK CORE1: ��? I (265246) TASK: TASK CORE0: E (265246) TASK: TASK CORE1: ��? I (266246) TASK: TASK CORE0: E (266246) TASK: TASK CORE1: ��? I (267246) TASK: TASK CORE0: E (267246) TASK: TASK CORE1: ��? I (268246) TASK: TASK CORE0: E (268246) TASK: TASK CORE1: ��? I (269246) TASK: TASK CORE0: E (269246) TASK: TASK CORE1: ��? I (270246) TASK: TASK CORE0: E (270246) TASK: TASK CORE_1: ��? ~~~


The problem of data transfer between the cores on ESP-Wroom-32.

Posted by hs2sf on August 1, 2017

Probably because appmain is left and the string is a stack variable at least concerning taskmain. Be careful with the lifetime of data given by pvParameters. Why not using a task local string ? Provided that ESP_LOGI irtself is thread-safe of course ;)


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner