I bought a MLX90640 Thermal Camera Breakout – Wide angle (110°) which I am trying to use on a Rasberry Pi 4 via the breakout garden. On a fresh version or Raspbian (followed by an update), I have followed the instructions from github but when I try one of the examples I get:
bcm2835_init: gpio mmap failed: cannot allocate memory segmentation fault.
I did then lower the IMAGE_SCALE but that did not help.
Previously I tried it with BME680 in, and that sensor worked fine but I got the same error above for the thermal camera.
More information, its actually returning an error when I connect it to the breakout garden, is it a hardware problem?
You say it is returning an error when you connect it, are you plugging it in whilst the Pi is running? If so, this may be causing the issue. I don’t believe the breakouts are ‘hot plugable’ you need to power down the Pi before you connect the devices.
I don’t think the MLX software has been updated for Pi4/Buster yet. Log a pull request on the GitHub.
This will be a problem with libbcm2835, I suspect, which hasn’t yet been updated to work on the Pi 4.
You should be able to build with
I2C_MODE=LINUX and ignore the RPi-specific stuff.
No I never hot swap!
Just moved it on to a Pi 3 and it all works OK.
Thanks for the help everyone.