[#55] |
Hi, I'm the EE charged with the electronics part of our Miniscopes project (NIN, The Netherlands).
After some initial struggles, last Friday we were very excited to see the first pictures coming from one of our Miniscopes. Soon after, we reached a total score of 15 working CMOS sensors and 10 DAQs.
However, something peculiar is happening, and I hope there is a known cure for it.
When the coax from the CMOS PCB is connected to the DAQ PCB, the Data Link LED lights.
Then I start MiniScopeControl.exe and click Connect.
The msCam window starts up with a flat grey screen.
At this point, no live video is present and the Scope Min/Max levels are identical and stay constant.
However, the LED brightness can be controlled by moving the Excitation LED slider.
To get live video, I then have to manually reset the MT9V032C12STM CMOS sensor, by briefly striking its pin 31 with a grounded wire. A more controlled way is, to do this with a 100nF capacitor instead of a solid ground.
This trick only works after the connection with MiniScopeControl.exe has already been established.
As an aside, the Exposure and Gain sliders have no effect on picture brightness in msCam.
But if I understood well, this is a post processing function performed in the PC.
All CMOS sensors we have are behaving the same, also when combined with different DAQ boards.
Should the sensor chip be re-initialized over I2C the moment the connection with MiniScopeControl.exe is made, and are we dealing with a partial I2C malfunction?
Any advice is much appreciated.
Regards,
Mike
Posted by MikerVee on 7 June 2016 at 04:20. |
|
Hi Mike,
Thanks for your very detailed post and I think I should be able to help you. Can you answer a few questions for me:
- When you click 'Connect' in the software, do you ever get a red screen or is it generally a solid grey screen?
- When you manually reset the CMOS sensor using pin 31 does the video instantly start streaming or do you have to click 'Connect' again in the software?
My first suggestion is to make sure you are physically connecting the scope coax cable to the DAQ Box before powering up the system over USB. If the DAQ Box is already powered when you connect the coax cable, there is a chance the CMOS sensor goes into an unresponsive state until it is reset. If this doesn't solve your problem, I suggest trying to run the system on different computers since it may be a computer driver/hardware issue.
The Exposure and Gain are not post processing function. The software communicates the Gain and Exposure values to the CMOS sensor over I2C which then adjust these parameters in the sensor (you can check out the Mt9V032 data sheet for more info on what these two settings do). Since you do not see a response from changing these setting it suggests the CMOS sensor is defaulting into a unstable state and not responding to I2C commands. Also, the LED brightness is also programmed through I2C so since this is working there shouldn't be a problem in the I2C transmission over the coax cable.
When you click 'Connect' and see the grey screen what does the Scope FPS read on the middle right side of the software? What does it read once you manually reset the sensor?
Posted by DAharoni (administrator) on 7 June 2016 at 17:01. |
| Hi Daniel,
Thanks for your quick and extensive response.
I followed your suggestion about the powering up sequence. No changes.
So far, I tested with 2 computers, the latest being a fresh out of the box HP Z240 workstation with i7-6700 at 3.4GHz, 32GB RAM and SSD, running Windows 7 Enterprise. No difference in the start up of the Scope. Maybe coming Friday I may be able to borrow another one.
Your questions:
- When you click 'Connect' in the software, do you ever get a red screen or is it generally a solid grey screen?
Maybe 1 out of 10 attempts there will be a red screen, after which I re-insert the USB connector, wait till the driver has loaded, and restart the software.
Most of the time there will be a solid grey or white screen (actually, today they were mostly white).
- When you manually reset the CMOS sensor using pin 31 does the video instantly start streaming or do you have to click 'Connect' again in the software?
It immediately starts streaming.
- When you click 'Connect' and see the grey screen what does the Scope FPS read on the middle right side of the software? What does it read once you manually reset the sensor?
During the grey screen it reads 29/30 fps.
After reset it fluctuates between 58 to 62. So the sensor seems to be in 60 fps default mode at this point.
Then, when I adjust the fps setting, the corresponding value will appear on the middle right.
The effect of adjusting the fps is clearly noticeable in 'jerkiness' as well as brightness. Lower fps --> brighter video.
No effect from Exposure or Gain adjustments.
Best,
Mike
Posted by MikerVee on 8 June 2016 at 14:34. |
| Thanks for the info Mike. We have never run into this issue ourselves so I will need to think a bit about what might be the source of the problem. Below are a few comments as I think my way through it:
- What is happening when you see the grey/white screen is your imaging sensor is, at least partly, initializing properly since it is outputting 30FPS. The control lines (Frame Valid, and Line Valid) along with the pixel clock output are running properly otherwise you would see a red screen and there wouldn't be a FPS readout. So while the clocking and signalling of the sensor are running correctly, the pixel value readout or ADC is stuck outputting the same value for all pixels until reset. Once reset, the imaging sensor goes into its default configuration which is 60FPS. The reason why the Gain and Exposure adjustments aren't working at this point is the default configuration of the imaging sensor leaves these as auto adjustments and turns off manual adjustments.
- It sounds like the I2C, serializer/deserializer, USB Host Controller, and most other components are functioning properly which is great. The issue is likely localized with the CMOS sensor or possibly a component connected to it.
Who fabricated and assembled your PCBs? Were they part of a Miniscope.org group PCB order? If so, which group order were you part of?
If we can't fix this problem quickly, I can modify the miniscope firmware for you to implement one of two temporary solutions:
- Send a 'Soft Reset' signal over I2C to the CMOS sensor when the 'Connect' button is pushed in the software. Hopefully this will function similarly to your manual hard reset.
- If the Soft Reset doesn't fix the problem, I can add a button to the software to enable Gain and Exposure adjustments after manually resetting the sensor.
Posted by DAharoni (administrator) on 8 June 2016 at 20:05. |
| Hi Mike,
I went ahead and added a Soft Reset to the firmware which you can find here. While this firmware might fix the issue you are having, I would suggest looking into it further since the issue shouldn't have shown up in the first place. Please keep me updated.
Posted by DAharoni (administrator) on 8 June 2016 at 22:22. |
| Hi Daniel,
What great service! Unfortunately the Soft Reset addition in the firmware did not make any difference.
I think you are right about the sensor partly initializing properly. I also noticed that, even with the grey/white screen, the fps readout is updated correctly after changing the setting.
Our PCB's were stuffed by a local assembly house. At first, when none of the sensors seemed to work, I thought there might be soldering problems, as the assembler complained a bit about vias being located in the soldering pads. But since we now have 15 'working' sensor PCBs behaving identically, I think we can rule out bad solder joints.
We supplied the CMOS sensors ourselves (bought on AliExpress). The local rep for ON Semi had a MOQ of 152 pcs., which was a bit too rich for us. Now I start wondering if something could be wrong with the sensors. They looked good (whatever that means) under a microscope and their date/time stamp, combined with Aptina + partno., gave hits on the web, which gave some confidence. But you never know.
I would like to try your next solution, with the extra button.
Much obliged,
Mike
Posted by MikerVee on 9 June 2016 at 12:25. |
| Daniel, thanks so much for helping us out!
Mike, the sensors were bought through the AliExpress supplier listed on the miniscope site. As far as I can tell most people have been happy with the sensors from this particular supplier.
Posted by Hoogland on 9 June 2016 at 12:46. |
| Hi Tycho and Mike,
Yes, from what I have heard, people have been successful using the CMOS sensors from that supplier.
If I remember correctly you had a company in the Netherlands assemble your PCBs. Is there a chance that the components for the CMOS PCB do not match the Bill of Materials listed on our GitHub Repository? In particular, the resistor and capacitor attached to the reset pin (pin 31) of the CMOS sensor? If the capacitor value is too low or the resistor value is too high this could explain the issue you are having.
Posted by DAharoni (administrator) on 9 June 2016 at 14:14. |
| We did indeed use a company in the Netherlands. I think the PCB manufacturer used the same resistor/capacitor values, but it may not have been using the same supplier of resistors/capacitors as listed on the BoM. Mike will know this better.
Posted by Hoogland on 9 June 2016 at 15:08. |
| Hi Daniel,
The board assembler is a contact from my previous job. They know they can't divert from a BOM I supply without my explicit permission. They routinely enquire if it's OK to use alternative components. Since this is not my design, they were told to adhere to the exact BOM, apart from generic components like resistors and capacitors (of course sticking to the specified values, dielectrics, etc.). But I can of course still check the semiconductors to make sure.
The R on pin 31 measures as 10k, which fits the schematic. The cap (C32, from the top of my head) I couldn't measure in circuit. Putting another 100nF in parallel made no difference in behaviour.
In my first post I mentioned that the reset trick only works after the 'Connect' button has been hit in the software. Wouldn't this suggest that a proper reset at power up isn't sufficient to get the sensor to work properly when the software connects?
There is another thing I noticed and could be a clue, but I'll have to re-verify that tomorrow. When in 'grey screen' mode, I can control LED brightness with the slider. When I quickly alternate the slider position between high and low values, sometimes horizontal stripes appear in the msCam picture during the transition. Could this be an indication that I2C messages intended for the LED driver are inadvertently picked up by the sensor? Or maybe one of the power supplies has dips or spikes on it at that instant due to the load change from the LED. If this is not a familiar phenomenon to you, I can put a scope to the supplies to see what happens. If it's a timing issue on the I2C bus that might be a little harder to catch.
Posted by MikerVee on 9 June 2016 at 19:39. |
| Well, somehow today was a good Monday (they exist!).
I printed the relevant parts of all data sheets, checked the name codes on all the chips and all seemed correct.
Then I moved the whole setup to my electronics bench, to get it near the oscilloscope and other equipment. Getting ready for more head-bashing. Check the reset signal, power supplies, and ultimately the I2C bus.
Doing what I did N times before, I connected everything (using a DAQ box with original firmware) and started the control software.
Hit the Connect button. White screen. Without applying a hard reset, I played with the fps setting, and of course nothing happened. Then pulled the exposure slider to the left and released the mouse button. Suddenly the white screen changed to dark and the sensor responded to light. Exposure and gain controls do what they should. It works! It appears that, after changing the fps setting, I still need to move the exposure slider back and forth to get the CMOS going again. Maybe that'll repair itself automagically as well.
Nothing changed in the setup, apart from its location.
We're happy! Now to check if this works on Tuesdays and other locations as well ;-)
Regards,
Mike
Posted by MikerVee on 13 June 2016 at 16:07. |
| |