-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adafruit mlx90640_camtest.py example does a "black screen" in RPi4 #22
Comments
you need to run it from a command line or something to get the error message |
I have the same problem. I got an adafruit MLX90640 today. Testing it now with my Raspberry Pi 4 with 4gb RAM gives an working mlx90640_simpletest.py. From the command line is nice and smooth. I can see my face :-) But the mlx90640_camtest.py is not working. It gives a black screen. The error I see is:
|
I have experienced the same issue that @Paul760 referenced above. My implementation is custom and actually does not output anything to a screen; it just reads temps. I am running my code on a Raspberry Pi 3 B+. At first, I thought this may have been a frequency issue because I was trying to run the camera at 32Hz however it also happens at 16Hz and 8Hz as well. I know that the runtime error is getting thrown from this section of code but I don't quite understand the reason behind keeping a count within the while loop and then raising a runtime error of "too many retries". I will say that if I remove the following two lines from the code, the implementation seems to work just fine. I just don't know the history behind it so I am not comfortable pushing a PR to remove it unless I am confident it is not needed. Does anyone know the reason for why it exists?
|
Well, as i was just stuck at the same point and was searching for a workaround for lot of time now, there it goes: This will make the code work at least for the beginning phase. |
unclear why some pi+camera combos are fine at higher rate and some are not (we wrote the code on a pi 4 originally so it ought to still work?) . if someone can update the example to put a hint about trying different refresh rates, and submit a PR, that would be great! |
sure, seems fine - other folks in this thread can check it out too |
hi!, recently I have acquired two mlx modules, On melexis github, there is a closed issue that talks about "of too many retries": A commit was made in April 2020 to solve it. int MLX90640_GetFrameData(uint8_t slaveAddr, uint16_t *frameData); and two new method: int ValidateFrameData(uint16_t *frameData) int ValidateAuxData(uint16_t *auxData) I tried to do the same on my local library: def _GetFrameData(self, frameData):
dataReady = 0
cnt = 0
statusRegister = [0]
controlRegister = [0]
data =[0]*64
while dataReady == 0:
self._I2CReadWords(0x8000, statusRegister)
dataReady = statusRegister[0] & 0x0008
# print("ready status: 0x%x" % dataReady)
self._I2CWriteWord(0x8000, 0x0030)
self._I2CReadWords(0x0400, frameData, end=768)
self._I2CReadWords(0x0700, data, end=64)
self._I2CReadWords(0x800D, controlRegister)
frameData[832] = controlRegister[0]
frameData[833] = statusRegister[0] & 0x0001
returned_data = self._ValidateAuxData(data)
if returned_data == 0:
for cnt in range(0,64):
frameData[cnt+768]= data[cnt]
returned_data = self._ValidateFrameData(frameData)
if returned_data != 0:
raise RuntimeError("_ValidateFrameData_error",-2)
return frameData[833] def _ValidateAuxData(self, auxData):
if auxData[0] == 0x7FFF:
return -8
for i in range(8,19):
if(auxData[i] == 0x7FFF):
return -8
for i in range(20,23):
if(auxData[i] == 0x7FFF):
return -8
for i in range(24,33):
if(auxData[i] == 0x7FFF):
return -8
for i in range(40,51):
if(auxData[i] == 0x7FFF):
return -8
for i in range(52,55):
if(auxData[i] == 0x7FFF):
return -8
for i in range(56,64):
if(auxData[i] == 0x7FFF):
return -8
return 0; def _ValidateFrameData(self, frameData):
line = 0
for i in range(0,768,32):
if (frameData[i] == 0x7FFF) and (line%2 == frameData[833]):
return -8
line = line + 1
return 0 Now I can increase the frequency, but the frame rate is slow. That's why I have added in /boot/config.txt, this line
(Beware, if there are other modules on the same i2c they may dont like the line on /boot/config.txt ) Now works in 8hz, 16hz, 34hz, 62hz, but sometimes there are other errors: I2c, math errors in sqrt, division by zero..( on high frequencies ). I added a block "try-except-continue" on my main to "hide those errors" and when they occur i read a new frame again. Maybe someone can do this better, I'm a python newbie. (There are other new methods on melexis API) |
thanks, if someone is up for adding the new validation functions to a PR we can review and add them to the library! |
The example from adafruit (mlx90640_camtest.py) crashes the RPi4 all the time! This means that when I run the example, the screen goes black and I need to shut down the RPi4. Don't even have time to get the error. The example mlx90640_simpletest.py and also mlx90640_pil.py works good though... any thoughts?
The text was updated successfully, but these errors were encountered: