Hello!
Trying to get to grips with setting up communication between 3 odrives and a teensy. Initially i’m just trying to read voltages from each odrive, connected via serial through a ISO7731 (the same as the recommended ISO7762F from the docs with fewer channels).
I’ve attached my code below and this works great to read the voltage from one odrive. Similarly, if I comment out all the serial3 lines and uncomment either the serial1 or serial2 lines, I can successfully read the voltages from the indevidual odrive. However, when uncommenting more than one serial line, the voltages returned are rubbish - mostly zeros, and they are coming back at irregular time intervals.
// includes
#include <HardwareSerial.h>
#include <ODriveArduino.h>
// Printing with stream operator helper functions
template<class T> inline Print& operator <<(Print &obj, T arg) { obj.print(arg); return obj; }
template<> inline Print& operator <<(Print &obj, float arg) { obj.print(arg, 4); return obj; }
// ODrive objects
//ODriveArduino odrive1(Serial1);
//ODriveArduino odrive2(Serial2);
ODriveArduino odrive3(Serial3);
// delay value
int d = 200;
void setup() {
// ODrive uses 115200 baud
// Serial1.begin(115200);
// Serial2.begin(115200);
Serial3.begin(115200);
// Serial to PC
Serial.begin(115200);
while (!Serial) ; // wait for Arduino Serial Monitor to open
}
void loop() {
// put your main code here, to run repeatedly:
// Serial1 << "r vbus_voltage\n";
// Serial << "Odrive on serial 1 - Vbus voltage: " << odrive1.readFloat() << '\n';
// delay(d);
//
// Serial2 << "r vbus_voltage\n";
// Serial << "Odrive on serial 2 - Vbus voltage: " << odrive2.readFloat() << '\n';
// delay(d);
Serial3 << "r vbus_voltage\n";
Serial << "Odrive on serial 3 - Vbus voltage: " << odrive3.readFloat() << '\n';
delay(d);
}
Any help would be greatly appreciated!
Thanks
Dan