I have two separate SPI devices connected to completely different SPI buses. Each device has its own driver library / class based on the pattern of the LIS302 driver by Simon Ford. Both the drivers work great on their own. If I have only one device, I can instantiate it (once) at the top of the file and then call its member functions e.g., sample the sensor in a loop. However, instantiating a second device makes the first device stop working. I can only get both devices to work if I re-instantiate the devices before each communication attempt.
In other words, this works:
int main() {
    Sensor1 s1(p5,p6,p7);
    while(1) {
        s1.sample();
    }
}
But this doesn't:
int main() {
    Sensor1 s1(p5,p6,p7);
    while(1) {
        s1.sample();
    }
}
And this does:
int main() {
    Sensor1 s1(p5,p6,p7);
    Sensor2 s2(p11,p12,p13);
    while(1) {
        s1.sample(); //blocks forever
        s2.sample(); //we never get here
    }
}
Has anyone seen this kind of behavior before?
Matt
                 
             
        
I have two separate SPI devices connected to completely different SPI buses. Each device has its own driver library / class based on the pattern of the LIS302 driver by Simon Ford. Both the drivers work great on their own. If I have only one device, I can instantiate it (once) at the top of the file and then call its member functions e.g., sample the sensor in a loop. However, instantiating a second device makes the first device stop working. I can only get both devices to work if I re-instantiate the devices before each communication attempt.
In other words, this works:
int main() { Sensor1 s1(p5,p6,p7); while(1) { s1.sample(); } }But this doesn't:int main() { Sensor1 s1(p5,p6,p7); while(1) { s1.sample(); } }And this does:int main() { Sensor1 s1(p5,p6,p7); Sensor2 s2(p11,p12,p13); while(1) { s1.sample(); //blocks forever s2.sample(); //we never get here } }Has anyone seen this kind of behavior before?Matt