Has anyone tried using the Optical Flow sensor successfully in 3.1?
Mission Planner detects it (or rather complains on boot if I disconnect the sensor), but all the readings are zeros in console (test -> optflow).
I have read data and images successfully with 3.1-rc5 test program (with modified library code). But in Mission Planner it reads only zeros whether I am using official 3.1 firmware or my modified 3.1-rc5 firmware. (The modification in library was to read the registers twice, since the incoming data appeared to be one byte “delayed”.)
I am using APM 2.5.1, have resoldered the 3.3V/5V jumper as shown on the wiki page, tried adjusting the focus and I did have the camera lid removed. I also think the wires are OK, as the test example was working.
I’ve tested it with AC3.1 and it was working. I fixed a bug in one of the later release candidates (-rc7?) to make sure the SPI bus was running in the correct mode when talking to the sensor and that made it all start working for me.
Any updates on this? I’ve installed an optflow sensor in my indoor miniquad, but I have the same issue: the hardware is definitely working (test sketch shows OK values, Python script to show sensor image works as well), but the terminal test in 3.1 only shows 0/0 values, and entering OF_Loiter from AltHold doesn’t do anything, the copter keeps drifting slowly, requiring manual corrections to hover.
I tried to capture a piece of SPI communication with a logic analyzer.
The bus speed seems to be OK now. (It is still @ 8 Mhz, but I noticed later that it is reduced to 2 MHz each time the OpticalFlow sensor is adressed, so it should be no problem.)
It appears that the communication is working both ways, since the sensor is responding with Motion register being 0x41, which suggests that DPI was set to 1600. Is that correct?
From all this I would think that there is just too little light for the sensor to work, but i have it tested at night with only a table lamp (a lightbulb).
olexs: How much light did you have when your test sketch was working with movement values (not photos)?
Does the sensor hate fluorescent tubes?