dhhagan / py-opc

Python wrapper for the Alphasense OPC-N2 built around py-spidev
MIT License
30 stars 26 forks source link

RPi connection failure - FirmwareError #14

Closed Myszka closed 7 years ago

Myszka commented 8 years ago

I can not connect with OPC-N2 sensor, which reports under the Alphasense software firmware version: "FirmwareVer=OPC-017b...............................BD". During initialization with command: alpha = opc.OPCN2(spi) I get FirmwareError: Cannot determine correct firmware for this OPC:

Additionally in the official manual I found different wiring for the molex 6w plug for OPC-N2 (attached). opc-n2-spipins

dhhagan commented 8 years ago

Yup. You're correct. These are pinouts from a breakout board I had designed for the board. I'm very sorry about this. I will change it in the docs immediately.

louisanb commented 8 years ago

Sorry i don't get what is wrong with the wiring? I got the same error with SCK-CLK SDO-MISO SDI-MOSI /SS-CE0 Is this the right one ?

dhhagan commented 8 years ago

Can you give me a bit more information? What firmware version is your opc?

louisanb commented 8 years ago

OPC 1.0.5591.26628 I looked it up in the document it came with and it says firmware can be found when it is first connected to the software and this is what is shown. "0.5591" is the version?

louisanb commented 8 years ago

oh sorry Firmware version=17 Found USB-ISS versioin 6 USBISS SerialNo=00021780 Device interface=USBISS Device info String=OPC-N2 FirmwareVer=OPC Device type set to OPC_N2 Firmware version=17

dhhagan commented 8 years ago

Ok okay! It should work then. How are you powering it? On Fri, Mar 18, 2016 at 6:53 PM louisanb notifications@github.com wrote:

oh sorry Firmware version=17 Found USB-ISS versioin 6 USBISS SerialNo=00021780 Device interface=USBISS Device info String=OPC-N2 FirmwareVer=OPC Device type set to OPC_N2 Firmware version=17

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/dhhagan/py-opc/issues/14#issuecomment-198571366

Regards,

David H Hagan PhD Student | Atmospheric Chemistry & Physics Department of Civil & Environmental Engineering Massachusetts Institute of Technology Cambridge, MA 02139 P: 707.227.6695 | E. dhagan@mit.edu | W. https://davidhagan.me

louisanb commented 8 years ago

A battery pack with 4 AA 1.5V i measured the output volts out of the battery pack which is 5.6V

dhhagan commented 8 years ago

Is it powering both the pi and the opc? On Fri, Mar 18, 2016 at 6:58 PM louisanb notifications@github.com wrote:

A battery pack with 4 AA 1.5V i measured the output volts out of the battery pack which is 5.6V

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/dhhagan/py-opc/issues/14#issuecomment-198572146

Regards,

David H Hagan PhD Student | Atmospheric Chemistry & Physics Department of Civil & Environmental Engineering Massachusetts Institute of Technology Cambridge, MA 02139 P: 707.227.6695 | E. dhagan@mit.edu | W. https://davidhagan.me

dhhagan commented 8 years ago

Can you attach a picture or diagram? On Fri, Mar 18, 2016 at 6:59 PM David Hagan david@davidhhagan.com wrote:

Is it powering both the pi and the opc? On Fri, Mar 18, 2016 at 6:58 PM louisanb notifications@github.com wrote:

A battery pack with 4 AA 1.5V i measured the output volts out of the battery pack which is 5.6V

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/dhhagan/py-opc/issues/14#issuecomment-198572146

Regards,

David H Hagan PhD Student | Atmospheric Chemistry & Physics Department of Civil & Environmental Engineering Massachusetts Institute of Technology Cambridge, MA 02139 P: 707.227.6695 | E. dhagan@mit.edu | W. https://davidhagan.me

Regards,

David H Hagan PhD Student | Atmospheric Chemistry & Physics Department of Civil & Environmental Engineering Massachusetts Institute of Technology Cambridge, MA 02139 P: 707.227.6695 | E. dhagan@mit.edu | W. https://davidhagan.me

louisanb commented 8 years ago

No just the opc. i am using the wall power cable thing came with the pi for powering the pi alone right now

dhhagan commented 8 years ago

Ahh okay..there may be some grounding issues but probably not. Do you know if the batteries supply enough current? It needs at least 260 mA On Fri, Mar 18, 2016 at 7:01 PM louisanb notifications@github.com wrote:

No just the opc. i am using the wall power cable thing came with the pi for powering the pi alone right now

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/dhhagan/py-opc/issues/14#issuecomment-198572441

Regards,

David H Hagan PhD Student | Atmospheric Chemistry & Physics Department of Civil & Environmental Engineering Massachusetts Institute of Technology Cambridge, MA 02139 P: 707.227.6695 | E. dhagan@mit.edu | W. https://davidhagan.me

dhhagan commented 8 years ago

Otherwise I would try verifying the connections are good? On Fri, Mar 18, 2016 at 7:02 PM David Hagan david@davidhhagan.com wrote:

Ahh okay..there may be some grounding issues but probably not. Do you know if the batteries supply enough current? It needs at least 260 mA On Fri, Mar 18, 2016 at 7:01 PM louisanb notifications@github.com wrote:

No just the opc. i am using the wall power cable thing came with the pi for powering the pi alone right now

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/dhhagan/py-opc/issues/14#issuecomment-198572441

Regards,

David H Hagan PhD Student | Atmospheric Chemistry & Physics Department of Civil & Environmental Engineering Massachusetts Institute of Technology Cambridge, MA 02139 P: 707.227.6695 | E. dhagan@mit.edu | W. https://davidhagan.me

Regards,

David H Hagan PhD Student | Atmospheric Chemistry & Physics Department of Civil & Environmental Engineering Massachusetts Institute of Technology Cambridge, MA 02139 P: 707.227.6695 | E. dhagan@mit.edu | W. https://davidhagan.me

louisanb commented 8 years ago

Oh i see! it might be the connections which seems solid but it maybe causing the problem here. The ground issues thing is a good call too i will check that.

About the Current I m using regular Energizer battery http://www.amazon.com/Energizer-Max-Alkaline-Battery-24-Count/dp/B004U429AQ/ref=sr_1_1_s_it?s=hpc&ie=UTF8&qid=1458342479&sr=1-1&keywords=energizer+batteries I assume it is fine. The fun will be turned on when i connect the batter pack (it takes about a minute for the fun to be turned on which i assume is an indicator it is being powers properly)and that is how i know the connection is good ( at least the power ones and i assume others should be good too but i will try to find a way to check)

louisanb commented 8 years ago

I am checking the current now!

dhhagan commented 8 years ago

Hey @louisanb did you solve your issues with the OPC?

louisanb commented 8 years ago

Oh sorry i did not see this. Thank you very much for asking! I just got the perfect wire and crimp that i bought to eliminate bad connections concern today. It still has the same error. I am still trying to solve the problem and i am going to do some troubleshooting on the grounding issue you mentions before. besides that i noticed i have to only connect the power and GND pin to power it up first then connect other pins on Rpi to at least turn OPC on. If i just connect all the pins all at once the OPC won't be turned on. Also when the power source is off the and all connection remain the same, the voltage between SCK-SDI is 2.75v SCK-SDI=2.75 SCK-SDO=.41 SCK-SS=.37 SCK-Vcc=1.89 SCK-GND=.77 SDI-SDO=2.3 SDI-SS=2.3 SDI-Vcc=.86 SDI-GND=1.98 SDO-SS=.034 SDO-Vcc=1.48 SDO-GND=.36 SS-Vcc=1.51 SS-GND=.39
Vcc-GND=1.13 vs power on: Number in () is the measurement collected once in while which i think is measurement errors SCK-SDI= 3.3v SCK-SDO=0 SCK-SS=0 SCK-Vcc=2.77 (5.5) SCK-GND=1.18 (0) SDI-SDO=3.29 SDI-SS=3.29 SDI-Vcc=2.17 (0) SDI-GND=3.3 (1.18 4.5) SDO-SS=.0 SDO-Vcc=5.5 SDO-GND=0 SS-Vcc=2.76 SS-GND=0 Vcc-GND=5.5 firmwareerror

louisanb commented 8 years ago

wrong picture deleted here

dhhagan commented 8 years ago

Awesome. Any chance you could tell me which color wires are where on the OPC?

louisanb commented 8 years ago

Oh yea Vcc-Red SCK-Brown SDO-Green SDI-Yellow (connects to purple wire on Rpi) SS-Blue GND-Black

dhhagan commented 8 years ago

Okay. I can't see the connection to the OPC which is the most likely error. Can you label which colors are plugged into pins 1-6 on the OPC?

louisanb commented 8 years ago

1-Vcc-Red (1 being on the bottom left of the OPC as shown in the picture below)-battery + 2-SCK-Brown-Rpi SCLK(GPIO11) 3-SDO-Green-Rpi MISO(GPIO9) 4-SDI-Yellow (connects to purple wire on Rpi)-Rpi MOSI(GPIO10) 5-SS-Blue-Rpi CE0_N(GPIO8) 6-GND-Black-battery img_6159 img_6160 img_6158

louisanb commented 8 years ago

For Rpi to read the firmware of OPC, does OPC need to be powered? Also please discard the first picture set i accidently switched the blue pin/wire with the purple one when i took the picture

dhhagan commented 8 years ago

Hmm. The wiring is definitely fine. I assume it's a connection? Otherwise I'm not sure. Have you enabled SPI on the RPi through rapsi-config? And yes, it needs to be powered.

louisanb commented 8 years ago

Yea i did enable it. I did not do much on Rpi codewise besides debugging or trying to make the code/OPC to work. The only thing i did was enable SPI and download the code/library from your github and tried to run it and make it work with OPC. I did not check the SPI alone after enable it like the way in one of the pictures below. spi test rpi spi disabled by default spienabled

dhhagan commented 8 years ago

@louisanb Interesting. I'm not exactly sure what's going on then aside from it being a bad connection. If you still are powering them separately, I would try using a central PSU.

louisanb commented 8 years ago

Thank you very much! I will definitely try the PSU, i feel like it is the cause.

dhhagan commented 7 years ago

Hey @louisanb any update on this?

louisanb commented 7 years ago

Hi David:

I don't work there anymore and thank you very much for checking!

louis


From: David H Hagan notifications@github.com Sent: Thursday, November 17, 2016 7:41:12 AM To: dhhagan/py-opc Cc: louis an; Mention Subject: Re: [dhhagan/py-opc] RPi connection failure - FirmwareError (#14)

Hey @louisanbhttps://github.com/louisanb any update on this?

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/dhhagan/py-opc/issues/14#issuecomment-261263678, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIRYjJPtr-cJQs4mSEMF-MA6t72B5ECBks5q_GeIgaJpZM4G-bS5.