From a926173d88f3cd7f223bbea3600799a83357cd2c Mon Sep 17 00:00:00 2001 From: TMRh20 Date: Mon, 19 Feb 2024 06:30:16 -0600 Subject: [PATCH 1/3] Docs: Byte alignment/packing mismatches #847 --- COMMON_ISSUES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/COMMON_ISSUES.md b/COMMON_ISSUES.md index b5404c46..6d24538a 100644 --- a/COMMON_ISSUES.md +++ b/COMMON_ISSUES.md @@ -121,6 +121,12 @@ This is likely due to the SPI speed being set up to 10MHz by default. We recomme In the RF24 library's beginnings, the default value was (prior to 2014) set to 4MHz. +Inaccurate payloads can also be because of the difference in how 8-bit, 32-bit and 64-bit systems handle data in memory. The easiest way to ensure your data aligns between devices is to specify the size of variables in code. ie: Instead of unsigned long, use uint32_t and use __attribute__((__packed__)) for data structures if you don't align your data manually per the below blog post. + +Newer users can use the `sizeof();` function to verify the size of different variables or data structures as well. + +See [https://www.gnu.org/software/libc/manual/html_node/Integers.html](https://www.gnu.org/software/libc/manual/html_node/Integers.html) and [TMRh20s Blog Post](https://tmrh20.blogspot.com/2020/09/transferring-data-between-systems-using.html) for more info + ### My PA/LNA module fails to transmit You may find variants of the nRF24L01 transceiver that are marketed as “nRF24L01+PA+LNA”. These modules are distinct in the fact that they come with a detachable (SMA-type) antenna. They employ separate RFX24C01 IC with the antenna for enhanced Power Amplification (PA) and Low Noise Amplification (LNA) features. While they boast greater range with the same functionality, they are subject to a couple lesser known (and lesser advertised) drawbacks: From fad156eba15838de6934c874ddf3d76d76a55e8c Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Mon, 19 Feb 2024 14:09:21 -0800 Subject: [PATCH 2/3] review changes --- COMMON_ISSUES.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/COMMON_ISSUES.md b/COMMON_ISSUES.md index 6d24538a..f67d1e6e 100644 --- a/COMMON_ISSUES.md +++ b/COMMON_ISSUES.md @@ -121,11 +121,10 @@ This is likely due to the SPI speed being set up to 10MHz by default. We recomme In the RF24 library's beginnings, the default value was (prior to 2014) set to 4MHz. -Inaccurate payloads can also be because of the difference in how 8-bit, 32-bit and 64-bit systems handle data in memory. The easiest way to ensure your data aligns between devices is to specify the size of variables in code. ie: Instead of unsigned long, use uint32_t and use __attribute__((__packed__)) for data structures if you don't align your data manually per the below blog post. +Inaccurate payloads can also happen because of differences in how 8-bit, 32-bit and 64-bit systems store data in memory. The easiest way to ensure your data aligns between devices is to specify the size of variables in code. ie: Instead of `unsigned long`, use `uint32_t` and use `__attribute__((__packed__))` for data structures if you don't align your data manually per the linked blog posts (see below). +Newer users can use the `sizeof()` function to verify the size of different variables or data structures as well. -Newer users can use the `sizeof();` function to verify the size of different variables or data structures as well. - -See [https://www.gnu.org/software/libc/manual/html_node/Integers.html](https://www.gnu.org/software/libc/manual/html_node/Integers.html) and [TMRh20s Blog Post](https://tmrh20.blogspot.com/2020/09/transferring-data-between-systems-using.html) for more info +See [GNU libc doc about integers](https://www.gnu.org/software/libc/manual/html_node/Integers.html) and [TMRh20's Blog Post](https://tmrh20.blogspot.com/2020/09/transferring-data-between-systems-using.html) for more info. ### My PA/LNA module fails to transmit From 9debc4e762c587a70de0dc8ff66d57d648bab0b4 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Mon, 19 Feb 2024 14:13:37 -0800 Subject: [PATCH 3/3] oops add blank line back; fix English grammar --- COMMON_ISSUES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/COMMON_ISSUES.md b/COMMON_ISSUES.md index f67d1e6e..efda6272 100644 --- a/COMMON_ISSUES.md +++ b/COMMON_ISSUES.md @@ -121,7 +121,8 @@ This is likely due to the SPI speed being set up to 10MHz by default. We recomme In the RF24 library's beginnings, the default value was (prior to 2014) set to 4MHz. -Inaccurate payloads can also happen because of differences in how 8-bit, 32-bit and 64-bit systems store data in memory. The easiest way to ensure your data aligns between devices is to specify the size of variables in code. ie: Instead of `unsigned long`, use `uint32_t` and use `__attribute__((__packed__))` for data structures if you don't align your data manually per the linked blog posts (see below). +Inaccurate payloads can also happen because of differences in how 8-bit, 32-bit and 64-bit systems store data in memory. The easiest way to ensure your data aligns between devices is to specify the size of variables in code. For example, use `uint32_t` instead of `unsigned long`, and use `__attribute__((__packed__))` for data structures if you don't align your data manually per the linked blog posts (see below). + Newer users can use the `sizeof()` function to verify the size of different variables or data structures as well. See [GNU libc doc about integers](https://www.gnu.org/software/libc/manual/html_node/Integers.html) and [TMRh20's Blog Post](https://tmrh20.blogspot.com/2020/09/transferring-data-between-systems-using.html) for more info.