In a previous post, I’ve written about how to check and enable transparent hugepages in Linux globally.
Although this post is important if you actually have a usecase for hugepages, I’ve seen multiple people getting fooled by the prospect that hugepages will magically increase performance. However, hugepaging is a complex topic and, if used in the wrong way, might easily decrease overall performance. Mehr lesen
For an explanation of in-place algorithms see my previous post on zero-copy in-place splitting
You have a C string possibly containing whitespace at the beginning and/or the end.
char* s = " abc \n\r";
Using an in-place algorithm, you want to remove the whitespace from this string.
Doing this is also possible using
boost::algorithm::trim, but it has the same caveats as
boost::algorithm::split as discussed in my previous post about C splitting Mehr lesen
Let’s assume you have a string:
char* s = "1,23,456,7890";
You want to split said string at each comma in order to obtain its parts as C strings (with the number of parts being variable):
char* s1 = "1";
char* s2 = "23";
char* s3 = "456";
char* s4 = "7890";
In contrasts to older designs like the Arduino Uno, the Arduino Leonardo features a separate connection
Serial1 for TTL–UART whereas
Serial is used for the USB CDC UART interface.
This allows one to use the Leonardo as an USB/UART bridge without having to resort to more expensive boards like the Arduino Mega 2560. In order to do this, use this sketch which can also be modified to provide an intelligent UART bridge.
Remember to adjust the baudrate for your application. This version of the sketch does not support automatic baudrate selection via the CDC peripheral.
You are using the ChibiOS lwIP binding to access the network your microcontroller application.
You need to access the lwIP
struct netif structure, for example to get the current DHCP IP address assigned to the network interface. However, the default ChibiOS implementaton in
lwipthread.c does not export the interface structure.
When trying to compile ChibiOS 3.x you get one of these error messages during the linking stage:
undefined symbol `__main_stack_size__' referenced in expression
undefined symbol `__process_stack_size__' referenced in expression
All STM32 microcontrollers feature a 96-bit factory-programmed unique device ID. However, for me it was hard to find an adequately licensed example on how to read it in a manner compatible with different families and compilers.
Here’s a simple header that defines a macro for the device ID address. While I checked the address for both STM32F4 and STM32F0 families, other families might have slightly different addresses for the device ID. Check the reference manual corresponding to your STM32 family if errors occur.
The STM32F0 series of 32-bit ARM Cortex M0 microcontrollers contain a huge number of internal peripherals despite their low price starting at 0,32€ @1pc. Amongst them is an internal, factory-calibrated temperature sensor and a supply voltage sensor (that specifically senses
VDDA, the analog supply voltage rail) connect to channels 16 and 17 of the internal ADC.
While I usually like the STM32 documentation, it was quite hard to implement code that produced realistic values. While the STM32F0 reference manual contains both formulas and a short section of example code, I believe that some aspects of the calculation are understated in the computation:
Section 13.9 in RM0091 provides a formula for computing the temperature from the raw temperature sensor output and the factory calibration values. However it is not stated anywhere (at least in Rev7, the current RM0091 revision) that this formula is only correct for a
VDDA of exactly 3.30V.
A common task with embedded systems is to use the RTC to timestamp events. However, the system architect needs to find a way of synchronizing the devices RTC time with an external time source. Additionally, the designer needs to deal with the problem of drifting RTC clocks, especially for long-running devices. This article discusses an lwIP+SNTP-based approach for STM32 devices using the ChibiOS RTOS. The lwIP-specific part of this article is also applicable to other types of microcontrollers.
For high-accuracy or long-running applications, RTC clock drift also has to be taken into account. Depending on the clock source in use, the clock frequency can deviate significantly from the nominal value.
On the STM32F4 for example, you can derive the RTC clock from: The HSE/HSI main oscillator The LSI oscillator * The LSE oscillator, i.e. a 32.768 kHz external crystal.
You have a hash data structure represented by CZMQ’s
zhash_t (see the zhash_t documentation for further information).
In order to be able to use it more conveniently in C++, you intend to convert said
zhash_t to a