how to set configuration macros for esp32 arduino freertos - esp32

Are FreeRTOS of espidf framework and freeRTOS of arduino framework different versions on esp32 platform?
and how can I set CONFIG_XXX in ardunino framework? Is this only possible with the espidf version?
I defined CONFIG_XXX in the platformio configuration file(platformio.ini),
however it didn't work.

Related

Is there any simulator for ESP32-S2 or ESP32 chips?

I am working on an esp project and compiled my code by using the esp32s2 toolchain and created a binary that ready to run on a real device. But I don't have a real device to test my binary. Is there any simulator to simulate the ESP32-S2 chip or the ESP32 chip?
You can use Wokwi to simulate the ESP32, and soon also the ESP32-S2.The Wokwi is a free online simulator for electronics, and it runs in your browser. This means you can simulate code that interacts with 3rd-party sensors, display modules, LEDs and many other common parts. There's also initial support for WiFi simulation, and the developers are working on extending it to support connecting to any host on the internet (e.g. HTTPS/MQTT)
Simulator Examples
Arduino Examples
Blink
Seven segment counter
APA102 Color Cycles (TinyPico Board)
WiFi Scanning
MicroPython Examples
SSD1306 Example
NeoPixels
WiFi Scanning
ESP-IDF Examples
The following examples use the ESP-IDF functions. They are compiled using Arduino ESP32 Core:
Blink using FreeRTOS API
Binary LED counter using FreeRTOS tasks
GPIO button input + interrupts
https://docs.wokwi.com/guides/esp32
You can try QEMU from https://github.com/espressif/qemu or https://github.com/Ebiroll/qemu_esp32
Not sure if they are supporting ESP32-S2, but it seems to be working with ESP32.

Can I create NodeMCU projects within VS Code using the PlatformIO extension?

I am attempting to use a ESP-32 dev kit to control WS2812 LED stripes. Discovered there is some firmware called NodeMCU for these dev kits which uses LUA scripts from what I can tell. There is an extension called PlatformIO for VS Code. I had used this to program a Arduino board to flash an LED.
I was wondering if it is possible to use PlatformIO to build the NodeMCU firmware and the LUA scripts then using PlatformIO to download everything to the ESP-32 dev kit. Is that possible?
I am thinking this can't be done since there are only two Framework selections, "Arduino" and "ESP-IDF", when I create a project which doesn't list NodeMCU.
Thanks
With ESP-IDF you would write C-code directly against the SDK. This can be done in Platform IO. This has its advantages but the major downside of course is that a development roundtrip takes some time. The complete build & install (flashing binary) cycle is run for every bit you turn in your source code.
With NodeMCU you build & install the firmware once and then only transfer the Lua files that changed. The downside here is that you need separate tools for separate tasks. See https://nodemcu.readthedocs.io/en/dev-esp32/ for details.
Build the firmware, either on Linux dev env, on a Linux VM (e.g. on Windows) or with Docker (quite simple, by yours truly).
Flash the firmware. Use esptool.py or the self-contained standalone GUI tool NodeMCU PyFlasher (by yours truly).
Upload Lua code from host to device. Use ESPlorer (very basic editor), NodeMCU Tool or the ChiliPeppr ESP32 Web IDE.

How can we define SPI devices on x86?

I want to read data from CAN bus and for that I am using MPC2515 (as a CAN Conroller) via SPI.
Working on Up Board 2 based on Ubilinux (Linux kernel version is 4.9.45), its architecture x86 doesn't use device-tree entries like ARM for example. So how can I define SPI device settings?

Why SoftwareSerial doesn't work on Atmega128

I am writing a program in Atmel Studio 7 that I just installed and started using. I have set up the studio for Arduino and added the Atmega128 to the library of supported chips. All is good there. When I try to use the SoftwareSerial library and compile, I get an error that Atmega128 and Atmega64 do not support SoftwareSerial. Why is this? What is so different about this AVR over the atmega328, etc that it will not support the library. Is there a better approach to use SoftwareSerial or SoftUart on the atmega128? Thanks
Did you run into this compile error: This version of NewSoftSerial supports only 20, 16 and 8MHz processors?
This comes from these defines in the cpp file. It might work if you define F_CPU to be 8000000, and make sure that you actually set the register to make that the clock speed. Some processors use a slower clock speed by default. Consult the hardware manual.
Note that F_CPU needs to be defined before the NewSoftwareSerial.cpp file is processed. You can create defines right in the command line with a D switch.
#if F_CPU == 16000000
[snip]
#elif F_CPU == 8000000
[snip]
#elif F_CPU == 20000000
[snip]
#else
#error This version of NewSoftSerial supports only 20, 16 and 8MHz processors
#endif
Through my research, while using the Arduino libraries and set up, their included SoftwareSerial library does not support the atMega64 and atMega128 because of the differences in the PIN and interrupt on these chips. I have successfully set up softserial on other GPIO pins on the atMega128 by modifying this example. This example is only for transmitting. I am still working on the receive portion because it involves setting up interrupts and clocking. A key note to remember is to make sure your clock settings match throughout your project and the serial bauds are set properly. I tested my code using several different baud rates.
As a side note for beginners, I have found that testing with an Arduino is great. However, when trying to move to a custom built C project, it is extremely difficult to migrate from the Arduino project to a clean C project. In my opinion, its almost easier to just learn C and start testing within the Atmel Studio environment and stay away from Arduino. I sope this helps someone starting out with programming.

How can i use Arduino uno as stand alone Atmega328p MCU?

I want to use debugger which is provided my atmel studio to walk through my program which i want to write in assembly or c but not in arduino script language.
P.S: i don't want to use visual micro because i tried it already but it doesn't go through my assembly code
The Arduino Uno exposes the RESET pin, which is all that is needed for a debug connection via debugWIRE. Alternatively, JTAG debugging requires (IIRC) the SPI and RESET pins, which are conveniently broken out via the ICSP header.

Resources