Hi,
In fact in this case, if you are getting larger size, it is common. It is due to compiler, struct padding and alignment issues. For AVR compiler, let's say you have one variable long(4 bytes), one variable long (4 bytes) and one variable int(2 bytes) ordered in this manner, it gives size of struct size 4+4+2 = 10.
However in ARM (we are using GCC compiler in this case), variable int has 4 bytes. So in total the struct size will be 4+4+4 = 12 instead. So it is normal you are getting this issue with CT-ARM but I believe you have no problem getting the same data, am I right?
You can try use sizeof(variable type) in your program and see the comparison between CT-ARM and AVR boards. If you wish to use 2 bytes in CT-ARM, use
short instead of
int.
Another issue you will be facing will be struct padding and alignment issues, this will arise if you are using mixed type of variables(int, char, long) in one struct, you will get different results between CT-ARM and AVR boards.
To solve this issue just modify the struct into following just in case:
struct __attribute__((__packed__)) payload_t{
*/your variables*/
};
In AVR boards, structs will be packed automatically during compilation so you don't need to put __attribute__(( __packed__)) in Arduino program.
For more info, you can refer to these websites:
https://en.wikipedia.org/wiki/Data_structure_alignmenthttp://stackoverflow.com/questions/29618439/what-is-the-size-of-integer-in-8-bit-16-bit-32-bit-processors-microcontrollershttp://stackoverflow.com/questions/4306186/structure-padding-and-packingHave fun learning and experimenting!
Edit:: One common way to avoid confusion between datatypes is using int[x]_t or uint[x]_t, for example if you want to use unsigned variables with 2 bytes, then using uint16_t. Check if it works.