Ant1pattern
New member
I have a (old-ish) Teensy 4.1 firmware which I have programmed onto about 20 different devices. I normally use MS Windows with Arduino 1.8.19 with the Teensy extensions to program the devices. Recently, I have created an ubuntu VM with what I believe is an identical installation of the IDE in order to have a separate place to compile release versions of the firmware and flash it to the devices. This VM is synchronized to my main repo via git. In general, I was able to programm a teensy module, but it appears as if the binary firmare generated on the new VM seems to differ from that which is being generated on my main dev system.
In particular, the device reads two Adafruit TSL2591 I²C light sensor modules. This works flawlessly when programmed from my dev system. When programmed from the VM, some systematic errors occur - The readings of the light sensors show incoherent values. For example, in absolute darkness, the windows binary reads the appropriate zero (or near-zero like 2-3) value. When flashed from the VM, the reading is at least in the 128-255 range with very suspicious (like bit-flipped) numbers.
One notably odd thing is that enabling some debug println instructions inbetween the measurements makes the binary work fine. I know I²C can be kinda wonky, but the errors do not seem to be an disfunctional I²C bus since I can run other commands - like configuring and reading the TSL2591's various settings just fine.
I am believing that this is not a code problem, as the devices are very mature and many of them are in daily use.
My first guess was some kind of bad pointer issue, but I only use static arrays, do proper math on the array access and yes all variables are initialized(zeroed) before measuring. Also during the build there occur only 4 harmless warnings whose origin I completely understand. Also the code is very simple.
I suspect there might be some issue with a different compiler working in the background due to the linux nature of the VM? Do you guys have any clever Ideas how I can proceed to diagnose this? I'd really like to move the compilation away from my dev machine to a CI system I am currently setting up.
In particular, the device reads two Adafruit TSL2591 I²C light sensor modules. This works flawlessly when programmed from my dev system. When programmed from the VM, some systematic errors occur - The readings of the light sensors show incoherent values. For example, in absolute darkness, the windows binary reads the appropriate zero (or near-zero like 2-3) value. When flashed from the VM, the reading is at least in the 128-255 range with very suspicious (like bit-flipped) numbers.
One notably odd thing is that enabling some debug println instructions inbetween the measurements makes the binary work fine. I know I²C can be kinda wonky, but the errors do not seem to be an disfunctional I²C bus since I can run other commands - like configuring and reading the TSL2591's various settings just fine.
I am believing that this is not a code problem, as the devices are very mature and many of them are in daily use.
My first guess was some kind of bad pointer issue, but I only use static arrays, do proper math on the array access and yes all variables are initialized(zeroed) before measuring. Also during the build there occur only 4 harmless warnings whose origin I completely understand. Also the code is very simple.
I suspect there might be some issue with a different compiler working in the background due to the linux nature of the VM? Do you guys have any clever Ideas how I can proceed to diagnose this? I'd really like to move the compilation away from my dev machine to a CI system I am currently setting up.