Become a leader in the IoT community!
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
I’ve integrated temperature, vibration, and pressure sensors with the AVR128DA48, and have set up CAN Bus communication running Zephyr. Each sensor is connected to a separate CAN node, and data is being collected. However, I’m having trouble synchronizing the sensor readings. Sometimes, readings from different sensors are out of sync or arrive too late on the CAN network. This is the current code snippet I’m using for CAN data transmission:
void send_sensor_data() {
struct zcan_frame temp_frame = {
.id = 0x101,
.dlc = 2,
.data = {temperature >> 8, temperature & 0xFF},
};
can_send(can_dev, &temp_frame, K_MSEC(100), NULL, NULL);
struct zcan_frame press_frame = {
.id = 0x102,
.dlc = 2,
.data = {pressure >> 8, pressure & 0xFF},
};
can_send(can_dev, &press_frame, K_MSEC(100), NULL, NULL);
}
What should I do to ensure sensor data is transmitted synchronously over the CAN Bus, ensuring that all sensor readings arrive at the same time for proper analysis? Any tips?
CONTRIBUTE TO THIS THREAD