DevHeads IoT Integration Server

DII

DevHeads IoT Integration Server

The DevHeads IoT Integration Server accelerates technology engineering by helping pro devs learn, share and collaborate.

Join

seeking-collabs

firmware-and-baremetal

middleware-and-os

edge-networking

pcb-and-analog

jobs

iot-cloud

code-review

devheads-feed

general-dev-chat

Best Practices for Developing Robust Custom Libraries for ESP32 Integrating Wi-Fi, Bluetooth, BLE

Hey guys @Middleware & OS Whilst developing a custom library for ESP32 aimed at integrating various wireless technologies (such as Wi-Fi, Bluetooth, and BLE) for an Industrial IoT project, I encountered issues related to hardware initialization and compatibility across different ESP-IDF framework versions. Specifically, the library functions intermittently fail to initialize the wireless modules correctly, leading to sporadic connection failures and inconsistent performance across devices. For e...
Solution:
use esp-idf's built in drivers and api that offer an abstraction layer above the hardware specifics, resolves compatibility across different esp32 boards and idf versions

Debugging Numerical Instability in AVX512-Optimized 2D Fluid Simulation on x86-64 CPU

In the process of me optimizing a 2D fluid simulation for x86-64 CPU using AVX512 instructions, Intel Xeon architecture , scalable processor with AVX512 support, GCC 12 compiler with -O3 optimization flags having periodic boundary conditions using explicit euler time stepping s heme I've implemented a staggered grid-based approach with a finite difference method for calculating fluid forces, but I'm encountering numerical instability issues when simulating large-scale fluid dynamics. Here is my AVX512 optimized force calculation kernel...
Solution:
@Marvee Amasi It sounds like you're running into stability issues with your fluid simulation, especially with the explicit Euler scheme on a large grids, to address the numerical instability, try reducing the time step or switching to a more stable method like implicit Euler. Make sure your time step meets the CFL condition to avoid instability. r-check your periodic boundary conditions for errors, and be cautious with AVX512 optimizations, as they can amplify floating-point precision issues. The Floating point exception could indicate division by zero or overflow, so make sure your calculations are well-guarded. To debug, simplify your simulation or use tools like valgrind and gdb to catch errors. These steps should help stabilize your simulation....
attachment 0

seeking for help related to data communication with a uart module.

Hi, I am seeking for help related to data communication with a uart module. The module was connected via RX0 and TX1 pins in arduino Nano , however when I am trying to send data with Serial.write(...), the program just cannot upload to the board at all. Was it because of code uploading also need to use Serial via USB? Or something else? This is the code: `` void setup() { // put your setup code here, to run once:...
Solution:
I would think not, as if the Arduino is still trying to write it would interfere with the communication either way. You could always try it, as I could be wrong but even if it did work perhaps it would be simpler to use software serial.

Resolving stdio.h and FPU Instruction Errors in STM32F103 Project with clangd and Neovim

@Middleware & OS I have an STM32F103 project initialized with STM32CubeMX. For editing, I use Neovim, and I compile the code with arm-none-eabi-gcc using an auto-generated Makefile. I've installed clangd LSP and Bear to generate the compile_commands.json file. Everything works fine except for two errors: ...

Do I need a mutex to protect 8-bit variables on STM32L476 with ARMv7E-M architecture using FreeRTOS?

Good day @Middleware & OS , I am using an STM32L476 with CMSIS OS2, which implements FreeRTOS v10.3.1. The STM32L476 is based on a Cortex-M4 MCU that follows the ARMv7E-M architecture: https://en.wikipedia.org/wiki/ARM_Cortex-M. The key difference between ARMv7E-M and ARMv7-M is the inclusion of DSP extensions in ARMv7E-M, which I do not use in my application. Hence, functionally, my setup is akin to ARMv7-M: https://developer.arm.com/documentation/ddi0403/latest (Page A1-22). According to the ARM reference manual, ARMv7-M guarantees atomicity for single-byte (8-bit) operations: https://developer.arm.com/documentation/ddi0403/latest (Page A3-80)....
Solution:
Yes @Sterling , multi-byte variables like 16-bit and 32-bit types are not guaranteed to be atomic on ARM Cortex-M4. For these variables, you should use a mutex or other synchronization mechanism to protect access if they are shared between tasks. For example, you can use a FreeRTOS mutex: ```c uint32_t sharedVar; SemaphoreHandle_t xMutex;...

How do I program ESP8266-12E using PlatformIO for soil moisture sensor and pump control?

I'm having trouble programming my ESP8266-12E using PlatformIO. I have experience with Arduino UNO but am struggling to adapt to ESP8266. The Serial Monitor displays gibberish, and my code doesn't work on the ESP8266 like it does on the UNO. I'm trying to read a soil moisture sensor connected to A0 and control a 5V pump using a MOSFET on the 5V pin. Can someone help me understand the differences in programming ESP8266 with PlatformIO? Specific examples and code snippets would be greatly appreciated. @Middleware & OS...

Preventing "Target not responding" errors while plotting real-time MPU6050 data via ST-Link v3set

Hello Everyone, I'm using ST-Link v3set with a custom build board. I'm trying to see the real time plotting of the angle measured with MPU6050. The first few seconds everything works fine, but then I started to lose connection with the board "Target is not responding, retrying..." and the live expression stop working. If I add a delay like HAL_Delay(500), it will work but it's just too slow to see the real time graph, decreasing it will cause the problem described above...
attachment 0

How can I switch between output and alternative function modes in an STM?

Hi everyone, Please how can I switch between output and alternative function modes in an STM microcontroller? For example, if I initially configure GPIOA_Pin0 as a digital output and later in the same program want to use it to send data via USART2, what steps are necessary to switch the pin configuration? @Middleware & OS...

Why is my Zynq-7000 marine navigation system failing to initialize the NMEA 2000 GPS sensor?

I am developing a marine navigation system using a Zynq-7000 with Embedded Linux. The system should read data from an NMEA 2000 GPS sensor. I have confirmed the serial port connection and settings, checked the GPS sensor configuration and data format, made sure the NMEA 2000 library is correctly installed and configured. But i am getting the error Failed to initialize NMEA 2000 ```c #include <stdio.h>...
Solution:
Thanks for the idea, due to ur questions I was able to make research and get the list of possible errors, it turns out in my case it was necessary permissions not being granted to access serial device I used sudo and it worked just fine

Any user of ST's NUCLEO-32 (32-Pin MCU)?

Any user of ST's NUCLEO-32 (32-Pin MCU)? I found out today their port pins are not matching across nucleo-32 (NANO form factor) series with standard Arduino nano. Also, the USB connector is positioned at the opposite end (when trying to make pin-compatible). I didn't expect this surprise when they said the NUCLEO-32 series has pin compatibility with NANO. Also, the length was 50 mm (too long to replace a standard Arduino nano on a custom PCB). Does anyone here share a similar experience?
Solution:
Yea @Umesh Lokhande I've encountered the same issue. I tried to replace an Arduino Nano with a NUCLEO-32 on a custom board and it didn't fit due to the different pin mapping and the USB connector placement. The extra length was also a problem. It seems "pin compatibility" only refers to the signal names and not the actual physical placement.

Generic Library for Microcontroller as Modbus RTU Slave

I am carrying forward my previous work on the Modbus RTU Function Subset Implementation based on a Generic Library. I had tested this library on Cypress PSoC5 and TI Stellaris Launchpad Kit. This time I have tested it with Arduino Mega and Uno. Link to the blog : https://www.embverse.com/blogs/generic-library-for-microcontroller-as-modbus-rtu-slave...

Learning LoRa ( using RYLR998 ) seeking for guidance

@Umesh Lokhande @techielew @all a few days back, I kick started working with LoRa from @Umesh Lokhande 's YouTube video on LoRa 👇 Here is the link https://youtu.be/vgYVVC6Lvl8 Key takeaways from video and web are: Why LoRa, How LoRa works....
Solution:
Hi, @AJAY KUMAR V I'd suggest setting the same Address for both RYLR998 Lora radio modules. And test if both Lora modules communicate using AT commands (as shown in the video). Please note that the default baud rate is 115200 (factory setting) whereas in my code and testing, I changed it to a 9600 baud rate. So if you're following the instructions from my video then you've to modify your code Serial.begin(9600); I hope this will help. Let me know as you progress in your project. Best wishe...

Can the ESP32 in the test circuit hold the firmware and upload it to the main circuit’s ESP32

Hey guys I have developed a circuit with an ESP32 as the main microcontroller, alongside various sensors and hardware. I am creating a test circuit to validate this main circuit. The test circuit will connect to the main circuit to verify its inputs and outputs. I aim to have the test circuit upload firmware to the ESP32 on the main circuit and monitor its inputs and outputs to ensure they are functioning correctly. Can the ESP32 in the test circuit hold the firmware and upload it to the main circuit’s ESP32, and then observe and validate the inputs and outputs?...
Solution:
To upload firmware from one ESP32 to another using UART: - Connect the ESP32s (TX to RX, RX to TX) - Use a tool or library to send the firmware binary: - ESP-IDF: esptool command-line tool...

How to calculate the minimum sleep time that makes sense for MCU in low power mode?

Hi everyone I'm working with a battery-powered sensor and I'm interested in minimizing power consumption while maintaining functionality. I have a question regarding low power and sleep modes in microcontrollers. Is there a way to calculate the minimum sleep time that makes sense for a microcontroller (MCU) in low power mode? For instance, does it make sense to put an MCU to sleep for just 1 second? Are there any specific calculations or rules to define this minimum sleep time? #mcu-mpu-and-firmware...
Solution:
@wafa_ath here is a sleep implementation you can use.

can someone help me with esp-idf

Hello everyone, can someone help me with esp-idf @everyone

Do you have any models of pH modules compatible with ESP32?

Morning everyone, For my project, I am trying to interface a pH module with an ESP32. The module is the PH4502C. I am able to get somewhat coherent measurements, but there are quite a few variations in them, such as it goes from 7.90 to 8.16, for example, and then returns to around 7.90. Could adding a voltage isolator card solve this problem? Otherwise, do you have any models of pH modules compatible with ESP32? ...

What is the name of this 10 pin connector ?

What is the name of this 10 pin connector ?
Solution:
@accur4te it's name is IDC 10 pin male.
attachment 0

I need a MicroPython firmware for the ESP32-S2 AI Thinker CAM

Hello, I need a MicroPython firmware for the ESP32-S2 AI Thinker CAM that has TensorFlow Lite already built in. Can someone guide me on where I can find a pre-built version of this firmware? Any help with resources or instructions on obtaining and flashing this specific firmware would be greatly appreciated. @Middleware & OS...
Solution:
Hi @wafa_ath for your request, you might not find a pre-built firmware directly from the official MicroPython repository. but you can build it yourself. The ESP32-S2 has TensorFlow Lite Micro support, so you can include it in your MicroPython build, by: Install the ESP-IDF (Espressif IoT Development Framework). Install the required tools for building MicroPython (make, gcc, etc.). Clone the MicroPython Repository:...

How can I read data from an I2C temperature sensor (TMP102) using an STM32 microcontroller?

Good day guys, how can I read data from an I2C temperature sensor (TMP102) using an STM32 microcontroller? I am encountering the error Failed to read from the I2C bus: Remote I/O error despite confirming that the sensor is powered and the I2C connections are correctly set up. Here is my current code snippet, which attempts to read 10 bytes of data from the sensor: ```c char buffer[10]; if (read(file, buffer, 10) != 10) {...
Solution:
Try this code instead #include "stm32f1xx_hal.h" ...

Why Doesn't Intel Expose the Internal RISC Core to Programmers?

Hello everyone, starting with the Pentium Pro processor, Intel introduced a microarchitecture that translated x86 instructions into micro-operations (uops) executed by an internal RISC core right, so that there is significant performance improvements while maintaining compatibility with existing software. I know the reasoning behind using a hidden RISC core is clear but why not expose the RISC instruction set directly to programmers? This could potentially lead to further performance gains and a smoother transition away from the x86 instruction set in the future. I understand that maintaining backward compatibility is crucial, yes. Since Intel is already committed to supporting legacy x86 modes alongside 64-bit operation, wouldn't exposing the RISC core allow for a more natural path towards a future RISC-based architecture? It seems that Intel continues to extend the x86 instruction set with new extensions like AVX and SSE. Is there a specific reason for not leveraging the internal RISC core more directly?...