Site Information

 Loading... Please wait...

C Programming For The Internet-Of-Things (IoT) Under Linux

Posted by Technical Literature on

Applying C For The IoT With Linux

Applying C is the book you need if you are programming for Single Board Computers (SBCs) that operate under Linux, or if you perform any coding in C that interacts with the hardware. As there is not the right name for this body of knowledge, it is not easy to find a single source for it. This book collects all of these low-level, hardware-oriented, and often hardware-specific ideas. As such, it is a reasonably advanced book. This is not to say that it is difficult, but it does assume that you already know how to program in C and that you know the essential idioms of C.

Starting from the straightforward task of making a program run automatically, we look at how your program works with user-mode Linux. If you are working with hardware, arithmetic cannot be ignored, and separate chapters are dedicated to integer, fixed-point, and floating-point arithmetic. Equally, to handle I/O you need to have a solid grasp of files and the pseudo-file system. The dev/mem file, coupled with memory-mapped files, makes it possible to work with raw memory without leaving user mode. Sockets are a general-purpose method of communicating over networks and related infrastructure, and here the focus is on transmitting data over the internet. For this, we build a web client and a server.

Next, we examine graphics, which you might find unusual in a book on small systems, but these days even small systems have GPUs, and graphics come as standard. It is customary to think of adding low-cost output devices such as 7-segment displays to IoT devices. Still, with low-priced HDMI/DVI displays available, it becomes cost-effective to use the built-in graphics hardware in a straightforward approach.

After this, we turn to the idea of multi-tasking using Pthreads. As well as looking at threads, we contemplate locking, using mutex and condition variables, and scheduling. Although interrupts do not exist in user-mode Linux, we can get very close using poll and threading. Now that multiple cores are a feature of even low-cost SBC, in later chapters, we cover managing cores, look at C11’s atomics and introduce its memory models and barriers. Finally, we take a quick look at how to incorporate assembler with C.

More Information...


Raspberry Pi 3 B+ System With Dual CAN Bus Interface

Raspberry Pi 3 B+ System With Dual CAN Bus Interface

The Raspberry Pi 3 System With Dual CAN Bus Interface (PiCAN2-DUO) comes with a pre-installed Raspbian operating system.

The system is equipped with a PiCAN2 DUO board, depending on the selected option, with or without SMPS (Switch Mode Power Supply). The SMPS allows the powering of the whole system, i.e. the Raspberry Pi and the PiCAN board, per external power connection (e.g. the 12 VDC supply in a vehicle).

The Raspberry Pi 3 B+ is equipped with a high-performance heatsink set to reduce chip hot-spots and to increase the thermal dissipation surface area.

The PiCAN2 DUO board provides Controller Area Network (CAN) Bus capabilities for the Raspberry Pi. It uses the Microchip MCP2515 CAN controller with MCP2551 CAN transceiver. Connection are made via 4-way screw terminals.

There is an easy-to-install SocketCAN driver, and programming can be accomplished in C or Python.

More Information...