Hello everyone,
I'm working on a robotics project using a Teensy 3.6 in Ubuntu 16.04. The teensy is connected to a custom shield to control 2 boards ("distal" and "proximal") which has been thoroughly validated.
I have been encountering some weird issues that can be hard to reproduce, even for me. But it's been happening in the same way for a while now, which is why I decided to post and see if anyone can shed some light into this behavior...
As the title says, my code works as intended, only after (usually) 3 "resets": I make changes to the code, upload the firmware using the arduino IDE and open the serial monitor to inspect the debug messages that I print there. On first upload, I get values for "Number of LEDs" and "Number of PDs" printed out that do not follow my code. Then I press the program/reset button on the physical Teensy 3.6 and the debug messages now show SOME correct values for one of the boards, but not both. Finally if I press the button once again, then the serial monitor shows all values initialized as per my code. I have attached 3 screenshots showing this happening - take into account just the reset button is being pushed in between these screenshots, no changes to the code at all.
Sometimes you get incorrect values that are zeros (as in the first screenshot) but I've also gotten random values in other occasions. Unfortunately the code base is large enough that I think attaching it is better than copying it in a /CODE block. For reference, the values shown in the 3rd screenshot are the correct ones (32 LEDs, 28 PDs). These values are constant member values declared in the derived class "Flexboardv21", which are passed directly into the base class constructor and saved into the base class member variables to hold this information (the reason for this structure is that there are other versions of the Flexboard with different number of LEDs and PDs and mappings which I have erased for clarity).
While there is use of "new" and dynamic memory allocation in the code, I still don't think that accounts for this kind of behavior.
Any ideas what could be causing this?
Thanks in advance for your time,
Pedro
I'm working on a robotics project using a Teensy 3.6 in Ubuntu 16.04. The teensy is connected to a custom shield to control 2 boards ("distal" and "proximal") which has been thoroughly validated.
I have been encountering some weird issues that can be hard to reproduce, even for me. But it's been happening in the same way for a while now, which is why I decided to post and see if anyone can shed some light into this behavior...
As the title says, my code works as intended, only after (usually) 3 "resets": I make changes to the code, upload the firmware using the arduino IDE and open the serial monitor to inspect the debug messages that I print there. On first upload, I get values for "Number of LEDs" and "Number of PDs" printed out that do not follow my code. Then I press the program/reset button on the physical Teensy 3.6 and the debug messages now show SOME correct values for one of the boards, but not both. Finally if I press the button once again, then the serial monitor shows all values initialized as per my code. I have attached 3 screenshots showing this happening - take into account just the reset button is being pushed in between these screenshots, no changes to the code at all.
Sometimes you get incorrect values that are zeros (as in the first screenshot) but I've also gotten random values in other occasions. Unfortunately the code base is large enough that I think attaching it is better than copying it in a /CODE block. For reference, the values shown in the 3rd screenshot are the correct ones (32 LEDs, 28 PDs). These values are constant member values declared in the derived class "Flexboardv21", which are passed directly into the base class constructor and saved into the base class member variables to hold this information (the reason for this structure is that there are other versions of the Flexboard with different number of LEDs and PDs and mappings which I have erased for clarity).
While there is use of "new" and dynamic memory allocation in the code, I still don't think that accounts for this kind of behavior.
Any ideas what could be causing this?
Thanks in advance for your time,
Pedro