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

Trying to interface a GPS module with my AVR using UART in Zephyr RTOS

@Middleware & OS Hi friends, I'm trying to interface a GPS module with my AVR microcontroller using UART in Zephyr RTOS. I've set up the UART peripheral and device tree configuration, but I'm not receiving any data from the GPS module. I tried configuring the UART peripheral in prj.conf, created device bindings in the device tree source file (dts), and wrote code to read data from the GPS module. When the GPS module is functioning correctly and transmitting data over UART, I should see NMEA sentences like $GPGGA, $GPRMC. I'm using the GPS(Ublox NEO-6M) module model. this is a sample of my code snippet: ```c #include <zephyr.h> #include <device.h>...
Solution:
It might not be code issue check whether your gps is synced or not sometimes it takes time for gps to lock up to a satellite and then it starts giving out data In one of our design gps sync took good 15minutes due to poor pcb design...

Why is my TI CC2652 smart lighting control system unable to read light sensor data?

hey guys am creating a smart lighting control system using a TI CC2652 with Embedded Linux. The system should read data from a Thread light sensor, I am using the NCP Thread Border Router Software (Model: OpenThread Border Router, Version: 0.3.0). But am getting the error Error reading light level: Device not found ...
Solution:
Thanks @Dark AI it's already been resolved, I updated the code to scan for the correct node and added some initialization checks. Here's the updated version: ```python import openzwave.option import openzwave.network...

Best tools for generating UML diagrams from SystemVerilog code for thesis writeup?

I'm working on my thesis writeup and need to document a reasonably complex verification framework written in SystemVerilog. The framework consists of several classes with parameterized types and inheritance relationships. I'd like to generate UML diagrams to effectively represent this structure, ideally in the simplest and most concise way possible. It's been a while since I last used UML diagramming tools, so I'd prefer to avoid manually creating them using tools like draw.io to minimize errors and time investment....
Solution:
Well, UML diagrams, whether automatically or manually generated, can be used to review the design of a SystemVerilog module or system. They can help you identify potential issues, such as complex dependencies or missing connections, early in the development process.

looking for good IDEs to write assembly language on my Mac

I'm looking for good IDEs to write assembly language on my Mac, something a bit lighter-weight than Xcode. I'm working on an Intel Mac and wondering if I can use generic x86 assembly syntax. Are there any major modifications to the instruction set I should be aware of? Also, how does assembly development work on Apple Silicon Macs with ARM processors? Even on Windows, some tools allow assembly code to run in an emulated environment. Does macOS offer a similar approach?...
Solution:
For a lightweight IDE on Mac for assembly language, consider Visual Studio Code, Sublime Text, or Atom. For Intel Macs, use x86 assembly syntax. For Apple Silicon Macs (ARM-based), use ARM-specific syntax or emulated environments like Rosetta 2. Adapt code to the ARM instruction set for compatibility. Make sure you add the Assembly Language extensions before development...

Using an AVR microcontroller with Zephyr to read data from an ADC via SPI

Hey guys, I'm using an AVR microcontroller with Zephyr to read data from an ADC via SPI. I've configured the SPI peripheral and device tree, but the data coming back from the ADC just doesn't seem right. So far I have been able to set up the SPI in prj.conf and the device tree (dts). Wrote code to read data from the ADC. Below is the code snippet. ```#include <zephyr.h> #include <device.h> #include <drivers/spi.h>...

Using an STM32F767ZI microcontroller with FreeRTOS

I'm using an STM32F767ZI microcontroller with FreeRTOS. I have two tasks: one receives TCP data triggered by an interrupt every 100ms, and the other handles user requests. When task-2 calls NVIC_SystemReset, the system hangs, typically in vPortRaiseBASEPRI after vTaskNotifyFromISR used by task-1. The error message indicates a hang in vPortRaiseBASEPRI, causing the system to become unresponsive. Replacing the task notification with a flag in the interrupt allows the reset but is inefficient. Disabling interrupts with portDISABLE_INTERRUPTS, suspending tasks with vTaskSuspendAll, and entering a critical section with taskENTER_CRITICAL didn't help. A workaround of disabling interrupts before reset works but is unsafe. ...
Solution:
Well, I believe you can start by modifying the system reset procedure in task-2 to ensure a safe and reliable reset. Before calling NVIC_SystemReset, disable all interrupts to prevent any pending ISR from causing the system to hang. ```c...

Seeking Advice on Federated Learning Frameworks, Communication, and Privacy on Edge Devices

Hi everyone, I’m currently exploring the implementation of federated learning on edge devices to enhance privacy and data security in AI applications. This approach allows individual devices to collaboratively train a model while keeping the data localized, which is crucial for privacy-sensitive applications. I’m facing a few challenges and would love to tap into your expertise. Specifically, I’m looking for insights on choosing the right federated learning frameworks and libraries, managing communication between devices to handle latency and data synchronization. Additionally, I’m very interested in best practices for ensuring data privacy and security in these federated environments....
Solution:
Implementing federated learning on edge devices involves selecting frameworks like TensorFlow Federated or PySyft, managing communication for latency and data synchronization, and ensuring data privacy through techniques like differential privacy and secure aggregation. Which framework would u like to use @wafa_ath

Troubleshooting BME280 Sensor Data Reading Issue on Raspberry Pi Pico with MicroPython

Hello, I am trying to interface a BME280 sensor with a Raspberry Pi Pico using MicroPython over I2C to monitor environmental conditions such as temperature, humidity, and pressure. However, I am encountering an issue with reading the sensor data, I have referred to the BME280 sensor documentation and the MicroPython library documentation to confirm the correct method for reading sensor data, I have examined the bme280 library code to verify the methods available for reading data from the sensor, I reinstalled the bme280 library to ensure it was correctly installed, I ran a simple I2C scan script to ensure that the BME280 sensor is properly connected and detected by the Raspberry Pi Pico. ```python i2c = I2C(0, scl=Pin(17), sda=Pin(16), freq=100000) devices = i2c.scan()...
Solution:
Hello @Enthernet Code read_compensated_data() method doesn't exist in your BME280 library. Try adding this: ```...

Debugging Persistent Segmentation Fault in Multi-threaded C++ Program on AMD Barcelona CPUs

I have been wrestling with a persistent segmentation fault in a multi-threaded C++ program running on a cluster of AMD Barcelona CPUs Linux/x86_64. The code causing the crashes is a heavily used function, and under load, running 1000 instances of the program same optimized binary can generate 1 to 2 crashes per hour. Now here's the interesting part, the crashes happen on different machines within the cluster although the machines themselves are almost identical, and they all share the same characteristics - same crash address and call stack....
Solution:
Tools like GDB can help you track memory access patterns in different threads , and you know that mutexes are synchronization mechanisms you should add around critical sections of foo to allow you have thread safe access to shared data . How's it going ? @Marvee Amasi

anyone managed to get printf working with floats on an M4 preferable with cmake and vscode

Has anyone managed to get printf working with floats on an M4 preferable with cmake and vscode. My cubeIDE works just fine.

I want to learn FreeRtos and application with some projects from basics

Hey guys, I want to learn FreeRtos and application with some projects from basics do you have any resources in minds.. pls suggest any YouTube channel that's good or any coursework

Handling Non-Atomic Operations for 64-bit Variables on a 32-bit Non-Preemptive System

Hi everyone, @Middleware & OS I'm struggling to find sufficient material on handling non-atomic operations, and I'd appreciate some guidance. I need to maintain a microsecond count in a 64-bit variable, with a 32-bit processor system that uses a non-preemptive scheduler. An ISR will update this variable every microsecond. My system provides functions to clear the variable and read its value. Since the processor is 32-bit, accessing the entire 64-bit variable atomically might not be possible. Concerned how I can ensure that the read function doesn't retrieve a partially updated value as in reading half from the old value and half from the new value during an interrupt? ...
Solution:
Yeah, you are right @Marvee Amasi 👍... @Sterling try to disable interrupts during the read operation to prevent the ISR from updating the variable while you're reading it.This will enable you to read either the old or new value in its entirety.

Optimizing a bubble sort implementation in C for an x86-64 architecture

Hello , I'm working on optimizing a bubble sort implementation in C for an x86-64 architecture specifically targeting an Intel Core i7 processor using GCC 11.2 . I noticed that the -O3 flag resulted in slower performance compared to -O2 when sorting large arrays of integers 1 million elements in this case. Here are the timings, average of multiple runs:...
Solution:
Compile your code with profiling enabled using ```sh Copy code gcc -pg -O3 -o sort sort.c ./sort 1000000...

How can I interface an I2C device with BeagleBone Black running Embedded Linux

Hello guys, how can I interface an I2C device with BeagleBone Black running Embedded Linux for my home automation system?. I have connected the I2C device to the appropriate pins on the BeagleBone Black, enabled the I2C interface on the BeagleBone Black, wrote a C program to communicate with the I2C device using the I2C bus. But keep encountering Failed to open the I2C bus. this is my code ```c #include <stdio.h>...
Solution:
@Boss lady if the devices exist, then the next thing I would check are the permissions. Having just taken a quick look on mine... ``` debian@BeagleBone:~$ ls -l /dev/i2c-* crw-rw---- 1 root gpio 89, 0 May 17 12:23 /dev/i2c-0 crw-rw---- 1 root gpio 89, 1 May 17 12:23 /dev/i2c-1...

How to determine who drives the clock ?

I have come to this problem where I wanted to go with synchronous UART between 2 peers for reliable communication. The problem is how to determine who drives the clock ? I mean it's a bi-directional communication. so for peer1, it will try to sync the clock to its TX line, and for peer2 it will try to do the same for its TX line. which results in a conflict for whom to drive the clock....
Solution:
In a synchronous UART setup where reliable bi-directional communication is required, the clock source needs to be clearly defined to avoid conflicts.

Could you guys help please review my code and suggest any potential mistakes or improvements?

Good day guys, I'm currently working on a project involving the MCP3424 ADC module and an STM32 microcontroller. My intention is to verify whether the MCP3424 is connected to the master STM32 at the defined address 0x68. While the ADC module successfully connects to an Arduino at the same address, I am facing issues with the STM32 connection. This is my code ; ```c...
Solution:
Alright @Sterling this code example can help guide you to refine your code for more detailed debugging: ```c while (1) { HAL_StatusTypeDef result = HAL_I2C_IsDeviceReady(&hi2c1, 0x68 << 1, 10, 1000);...

Troubleshooting 'USART Device Not Ready' Error on AVR Microcontroller with Zephyr RTOS

hey guys, I am trying to set up USART communication on an AVR microcontroller running Zephyr RTOS to send data to an IoT cloud platform. I have configured the USART peripheral in the
prj.conf
prj.conf
file, created a Zephyr USART device binding in the device tree source file (
dts
dts
), and wrote an application to send data over USART. However, I am encountering an error stating
USART device not ready
USART device not ready
. I have verified the device tree source configuration to ensure proper USART peripheral set...
Solution:
Hey @Dtynin , I see you are talking about SPI, but if you're also working with USART and encountering the "USART device not ready" error, there are some common troubleshooting steps you can follow to resolve this. like Verifying that the USART node in your .dts file is correctly defined and matches your hardware setup, also ensure the compatible property is set correctly and that the USART pins (tx, rx, etc.) are properly assigned. Make sure that the necessary configurations for USART are enabled in your prj.conf file. This includes enabling the USART driver and setting any required parameters....

Resolving 'SPI Device Not Ready' Error on AVR Microcontroller with Zephyr RTOS

hey guys, I am attempting to set up SPI communication on an AVR microcontroller running Zephyr RTOS to acquire data from an SPI temperature sensor (MCP9808) and send it to an IoT cloud platform, I have configured the SPI peripheral in the prj.conf file, created a Zephyr SPI device binding in the device tree source file (dts), writing an application to read temperature data from the MCP9808 sensor. But am getting the error, what could be wrong?
SPI device not ready
SPI device not ready
I have verified the device tree source configuration to ensure proper SPI peripheral settings, checked the pin configurations to match the hardware setup, made sure the MCP9808 sensor is connected correctly to the SPI pins....
Solution:
thanks again guys after following these verifications and adjustments, the SPI communication with the MCP9808 sensor is functioning as expected! I've achieved successful temperature data readings and logging. Appreciate your assistance once more!

USB Webcam Not Working on Jetson Nano for OpenCV/TensorFlow Object Detection

Hello guys, I am trying to set up a USB webcam on my NVIDIA Jetson Nano to perform real-time video analytics using OpenCV and TensorFlow, I have installed OpenCV and TensorFlow on Ubuntu, connected a USB webcam to the Jetson Nano, wrote a Python script to capture video frames and perform object detection. But I keep getting the error
[ WARN:0] global /tmp/pip-req-build-1234abcd/opencv/modules/videoio/src/cap_v4l.cpp (890) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
[ WARN:0] global /tmp/pip-req-build-1234abcd/opencv/modules/videoio/src/cap_v4l.cpp (890) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
...
Solution:
v4l2-ctl --list-devices
v4l2-ctl --device=/dev/video0 --stream-mmap=3 --stream-count=10
v4l2-ctl --list-devices
v4l2-ctl --device=/dev/video0 --stream-mmap=3 --stream-count=10
If the above steps don't help, try running a simple OpenCV script to verify if OpenCV can access the camera: ...

How do I set the I2C (Mpu-6050) slave address in my application?

@Middleware & OS Hello Guys, how do I set the I2C (Mpu-6050) slave address in my application, am getting the error Failed to acquire bus access and/or talk to slave: Input/output error but i have Checked the wiring and confirmed the slave device address. here's my code below ```c int addr = 0x48; // The I2C address of the slave device if (ioctl(file, I2C_SLAVE, addr) < 0) {...
Solution:
Thanks everyone!, I didn't realize the address for the MPU-6050 was different. I changed the address to 0x68 and now my code looks like this: ```c int file; if ((file = open("/dev/i2c-1", O_RDWR)) < 0) {...