Comments (2)
Looks like an "endian" difference between the two MCUs. Try swapping the byte order on the ints on the receiver and see if it helps. Might also be useful to set the int size manually.
from serialtransfer.
Both MCUs report being "Little Endian".
I ran the following code to find out:
#include <Arduino.h>
#include <limits.h>
#include <stdint.h>
#if CHAR_BIT != 8
#error "unsupported char size"
#endif
enum
{
O32_LITTLE_ENDIAN = 0x03020100ul,
O32_BIG_ENDIAN = 0x00010203ul,
O32_PDP_ENDIAN = 0x01000302ul
};
static const union { unsigned char bytes[4]; uint32_t value; } o32_host_order =
{ { 0, 1, 2, 3 } };
#define O32_HOST_ORDER (o32_host_order.value)
void setup()
{
Serial.begin( 115200 );
if ( O32_HOST_ORDER == O32_LITTLE_ENDIAN )
{
Serial.println( F( "Little Endian" ) );
}
else if ( O32_HOST_ORDER == O32_BIG_ENDIAN )
{
Serial.println( F( "Big Endian" ) );
}
else if ( O32_HOST_ORDER == O32_PDP_ENDIAN )
{
Serial.println( F( "PDP Endian" ) );
}
else
{
Serial.println( F( "Other Endian" ) );
}
}
So that might not be it.
It also fails with float
s, not only int
s.
Weird thing that the CRC validates the packets, so has to be some bit-shifting issue, just can't figure out what...
from serialtransfer.
Related Issues (20)
- compute CRC on all bytes (apart from start, stop and CRC byte of course) HOT 1
- the limit of 254 max bytes doesn't avoid the 0x7E value in the packet HOT 3
- Why is the main code commented? HOT 2
- Use this to send a file update from device A to B HOT 2
- Changing ports doesn't work with ESP32 HOT 1
- Use of abstract class as common interface
- Two way communication HOT 3
- Ver 3.1.3 SPI spi_tx_data -- 'SPITransfer' does not name a type; HOT 4
- Data Transfer Between ESP 32 And Arduino Mega HOT 1
- Documentation on how to send&recieve a single datum struct object (via serial) that exceeds the 254-byte maximum packet size HOT 1
- Compile time error on STM32F103 BluePill HOT 4
- Stale Packet error HOT 1
- This library assumes that it would be instantiated and never removed. HOT 4
- RS485 with SoftwareSerial not working as expected HOT 1
- Please provide examples of transferring more types of data. HOT 2
- Packet reset() overrides meaningful status in parse() HOT 3
- Best method for checking that a packet is valid before reading the contents? HOT 4
- File Transfer Not working as Expected[ESP-CAM to ESP32] HOT 3
- Received data always 7 (after converted to int) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serialtransfer.