Programming

Following the previous post about Queues, In this post i publish a simple modular stack written in C which can be used either by assigning a static space for the elements of a dynamic one (malloc etc). In computer science, a stack is an abstract data type that serves as a collection of elements, with two principal operations: push, which adds an element to the collection, and pop, which removes the most recently added element…

In concurrent programming, concurrent accesses to shared resources can lead to unexpected or erroneous behavior, so parts of the program where the shared resource is accessed are protected. This protected section is the critical section or critical region. It cannot be executed by more than one process. Typically, the critical section accesses a shared resource, such as a data structure, a peripheral device, or a network connection, that would not operate correctly in the context…

In this post i publish a simple modular queue written in C which can be used either by assigning a static space for the elements of a dynamic one (malloc etc). Queue is a particular kind of abstract data type or collection in which the entities in the collection are kept in order. The only requirement is that the memory space which will hold the queue items have to be allocated in prior. Below is the header/source…

Universal Plug & Play describes devices that work with a computer system as soon as they are connected. UPnP is an extension of this idea that expands the range of Plug and Play devices to networking equipment. Universal Plug and Play uses network protocols to allow a wide range of devices to be interconnected and work seamlessly with each other. [1] Since most UPnP devices support zero-configuration setup (like ordinary Plug and Play devices), it…

The first step is to create a function that compares two input strings, if those strings are an anagram the function will return true or if its not it will return false. Let’s name our function boolean isAnagram(String string1, String string2). Of course, if we compare those strings as they are we can’t find out if they are anagrams, so there is a need to process a little bit those string in a way that…

Using the Stitch Bootloader, the current project aims to update a board through CANbus. The workflow: The first board has a firmware loaded into the SD Card. At the beginning it requests to transmit the firmware through CANbus. If the second board accepts the request, then the firmware is transmitted through the CANBus to the SD Card of the client. After the completion of the firmware transfer process, the system reboots itself and Stitch Bootloader flashes…

Usually a firmware upgrade of the STM32FXXX boards are is not an easy task for customers. They have to plug the board and use several different tools to flash the memory. For that reason i have made a simple, effective and easy way to upgrade your firmware using an SD Card. The upgrade task is simple, just write your firmware in the first sector of the SD Card, reboot your system, and the bootloader will…

Occasionally we might come across a problem which lends itself well to the idea of C# code being compiled at runtime. The .NET Framework includes a mechanism called the Code Document Object Model (CodeDOM) that enables developers of programs that emit source code to generate source code in multiple programming languages at run time, based on a single model that represents the code to render. We can use the CSharpCodeProvider to do exactly this, it can compile…

Sometimes, we need an easy way to test and verify that our board works correctly, especially if we are using breadboards and cables. The following simple FreeRTOS thread is able to echo each incoming CAN frame. To use this thread you must enable FreeRTOS using the ST’s CubeMX software which will generate the appropriate startup source code and afterwards you have to include some extra libraries that can be found in the blog (please check…