I am playing with several ESP32s linked together via a CAN bus. The simple prototype I have made is working well with 3 nodes, they are exchanging messages successfully. For the ones who don't know about CAN, the frames exchanged can contain a maximum of 8 bytes of data.
For one specific type of frame that contains instructions to activate a stepper motor, the 8 bytes of data are composed like this:
- typedef struct {
- uint8_t dir; // 'F' = CW, 'R' = CCW
- uint32_t rev; // number of revolutions
- uint8_t filler[3]; // filler
- } stepper_data_t;
Then I decided the plug my oscilloscope to the CAN bus to decode the frames, and for this specific frame, I have the following data (in hex):
0x52 79 11 01 02
0x52 is correct, as it corresponds to 'R'. But the next 4 bytes are a mystery for me, I was expecting to find 00 00 00 01. Is this linked to the way ESP32 is implementing uint32_t?