From user:
I'm writing code in C using seabreeze to control a customized QE-pro (QEP00937). I find some problems regarding unrecognized features. I cannot use the strope/lamp control function (sbapi_lamp_set_lamp_enable) to enable the lamp (I tried to use it to control an external shutter), when I ran the api_test program, it read out No lamp capabilities found. I addition, I also found that I cannot use the shutter control to control the internal shutter, it also says No shutter capabilities found. I test another spectrometer (HR2000+), and everything works fine. I'm wondering how can I solve this problem?
—zhangyaonju@
Hi zhangyaonju,
There are two parts of your question: strobeEnable, and internal shutter control.
I would have expected strobeEnable to work on the QEPro. We will take a look at that.
As you may know, newer QEPro units have a built-in shutter, which can be controlled with GPIO 4 (see http://oceanoptics.com/wp-content/uploads/OEM-Data-Sheet-QEPRO.pdf, p8). There are basically 3 paths to controlling this internal QEPro shutter, if your spectrometer is so equipped.
2a. The first and most sensible would be to implement the existing shutter commands in SeaBreezeAPI for the QEPro. I will add this to our "to-do" list, but it is unscheduled at this time:
2b. The second would be to add GPIO commands to SeaBreezeAPI and optionally SeaBreezeWrapper. I believe this is also worth doing, and is also on the to-do list:
void seabreeze_gpio_set_mux()
void seabreeze_gpio_set_direction()
void seabreeze_gpio_set_value()
2c. The third, which is the only option which does not involve changing SeaBreeze itself, would be to use the raw USB commands to control GPIO from the calling application. We have bits and pieces of sample code showing how to do some of this for both OceanBinaryProtocol (OBP) spectrometers (like the QEPro), and older FX2-based spectrometers (like the QE65Pro). We can answer questions about these examples, and I can personally confirm that I have used code like these to successfully control GPIO via SeaBreeze from a number of customer projects.
OBP (C#): https://sourceforge.net/p/seabreeze/code/HEAD/tree/trunk/util/OBP_Library/OBP_Library/OBPMessages.cs#l4665
OBP (C): https://sourceforge.net/p/seabreeze/code/HEAD/tree/trunk/SeaBreeze/sample-code/c/demo-qepro-api.c#l59
FX2 (C#): https://sourceforge.net/p/seabreeze/code/HEAD/tree/trunk/util/PulseGenerator/src/SpectrometerSeaBreeze.cs#l292
FX2 (C): https://sourceforge.net/p/seabreeze/code/HEAD/tree/trunk/SeaBreeze/sample-code/c/demo-raw-usb.c#l87
Regards,
Mark
Hi Mark,
Thanks for your suggestions. I know most of these functions can be easily releaized through OmniDriver, but I try to use a Raspberry Pi 3 to control these spectrometers therefore I have to use Seabreeze.
for the solution to the first problem, I'm not sure did you mean the function "sbapi_lamp_set_lamp_enable" in SeabreezeAPI, but I did not find any fuction called strobeEnable. Hope to see your test result soon.
for the second solution, I think I have no choice but to take the thrid option for now. but it seems a little bit difficult for me to understand the code. I will try.
Thanks for your help!
Best,
Yao
Hi Mark,
I have carefully read the materials you gave me, but I still have some questions. As you know, when I try to control the internal shutter of QE-Pro using this OBP protocol, we need two arguments (1st value, 2nd mask) set in one message, can we put these two arguments in the header or we need to put it in the payload? I read the examples you give me in C language, but theres is no functions with 2 arguments. If possible, would you please write a simple function which can control the internal shutter of QE-pro in C with using the header "api/seabreezeapi/SeaBreezeAPI.h"
I would be very appreciated if you can help!
Hi Yao…
The data should go in the immediate data area (not the extended payload). A hex print of the binary data that should be sent is shown below:
Turn GPIO #4 “On”
Offset:
0000: C1 C0 00 11 00 00 00 00 10 03 20 00 00 00 00 00
0010: 00 00 00 00 00 00 00 08 10 00 00 00 10 00 00 00
0020: 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 C5 C4 C3 C2
Turn GPIO #4 “Off”
Offset:
0000: C1 C0 00 11 00 00 00 00 10 03 20 00 00 00 00 00
0010: 00 00 00 00 00 00 00 08 00 00 00 00 10 00 00 00
0020: 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 C5 C4 C3 C2
Enable GPIO #4 as output
Offset:
0000: C1 C0 00 11 00 00 00 00 10 01 20 00 00 00 00 00
0010: 00 00 00 00 00 00 00 08 10 00 00 00 10 00 00 00
0020: 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 C5 C4 C3 C2
From: Yao Zhang [mailto:zhangyaonju@users.sf.net]
Sent: Friday, May 06, 2016 11:48 AM
To: [seabreeze:tickets]
Subject: [seabreeze:tickets] Re: #21 strobeEnable / shutter support for QEPro
Hi Mark,
I have carefully read the materials you gave me, but I still have some questions. As you know, when I try to control the internal shutter of QE-Pro using this OBP protocol, we need two arguments (1st value, 2nd mask) set in one message, can we put these two arguments in the header or we need to put it in the payload? I read the examples you give me in C language, but theres is no functions with 2 arguments. If possible, would you please write a simple function which can control the internal shutter of QE-pro in C with using the header "api/seabreezeapi/SeaBreezeAPI.h"
I would be very appreciated if you can help!
[tickets:#21]https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.net_p_seabreeze_tickets_21_&d=CwMGaQ&c=FwLVSQ1jiqJEAitAXTqnwQ&r=pwwDj1lxDqofpU5NaZS0yu7-Uq4s6xLcwF-pDplrymI&m=BWHVviQhv5Tdr2vC0ElkmpZDmHApLZm2QzpPQpw8cjg&s=z1aV5y1L3gGUHjo36XriqG1p5t_6SfMQQW1jdhZTR9I&e= strobeEnable / shutter support for QEPro
Status: open
Milestone: 3.0
Created: Tue Apr 05, 2016 05:12 PM UTC by Mark Zieg
Last Updated: Tue Apr 05, 2016 05:32 PM UTC
Owner: nobody
From user:
I'm writing code in C using seabreeze to control a customized QE-pro (QEP00937). I find some problems regarding unrecognized features. I cannot use the strope/lamp control function (sbapi_lamp_set_lamp_enable) to enable the lamp (I tried to use it to control an external shutter), when I ran the api_test program, it read out No lamp capabilities found. I addition, I also found that I cannot use the shutter control to control the internal shutter, it also says No shutter capabilities found. I test another spectrometer (HR2000+), and everything works fine. I'm wondering how can I solve this problem?
—zhangyaonju@
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/seabreeze/tickets/21/https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.net_p_seabreeze_tickets_21_&d=CwMGaQ&c=FwLVSQ1jiqJEAitAXTqnwQ&r=pwwDj1lxDqofpU5NaZS0yu7-Uq4s6xLcwF-pDplrymI&m=BWHVviQhv5Tdr2vC0ElkmpZDmHApLZm2QzpPQpw8cjg&s=z1aV5y1L3gGUHjo36XriqG1p5t_6SfMQQW1jdhZTR9I&e=
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.net_auth_subscriptions_&d=CwMGaQ&c=FwLVSQ1jiqJEAitAXTqnwQ&r=pwwDj1lxDqofpU5NaZS0yu7-Uq4s6xLcwF-pDplrymI&m=BWHVviQhv5Tdr2vC0ElkmpZDmHApLZm2QzpPQpw8cjg&s=Yk4NnllToCSHVlMvDwwaKEzWLVlLMONWFFkohDYALqo&e=
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If you are not the addressee, any disclosure, reproduction,
copying, distribution, or other dissemination or use of this communication is
strictly prohibited. If you have received this transmission in
error please notify the sender immediately and then delete this e-mail.
E-mail transmission cannot be guaranteed to be secure or error free as
information could be intercepted, corrupted lost, destroyed, arrive late or
incomplete, or contain viruses.
The sender therefore does not accept liability for any errors or omissions
in the contents of this message which arise as a result of e-mail
transmission. If verification is required please request a hard copy
version.
Related
Tickets: #21
Thanks douga, your answer is very helpful! I will try to see if it works. wish me good luck!
When using OBP, the GPIO commands expect the value bits and the mask bits as four bytes each, all packed together:
VVVVMMMM
...where each V is part of the value bitvector and each M is the corresponding mask. These are formatted LSB first.
Since this is all less than 16 bytes, it is probably best to put it into the "immediate" part of the OBP header (just be sure to set the length of the "immediate data" field to 8). It doesn't actually matter -- you could also put it into the "payload" area after the header, provided that the "bytes remaining" field was set correctly (28 in this case) and the "immediate data length" was zero. It is important that the arguments are kept together contiguously, but they can go into either place.
According to the QEPro datasheet, GPIO 4 is connected to the shutter. To switch between shutter states on this pin, I think you would send the following arguments in an OBP message (using the "set GPIO value" command, 0x00200310):
GPIO 4 low: 0x00 00 00 00 10 00 00 00
GPIO 4 high: 0x10 00 00 00 10 00 00 00
Of those, bit 4 of each 4-byte word corresponds to the shutter, so you just need to be sure that the value matches what you want and that the mask is set to cause that pin to update. The rest of the pins will be left unchanged.
It would be good to also make sure that pin 4 is set as an output before setting the value. Do this using command 0x00200110 with this for the arguments:
0x10 00 00 00 10 00 00 00
While I do not believe it would be necessary, you could also set the alternate function to "normal" using command 0x00200210 with these arguments:
0x00 00 00 00 10 00 00 00
I am not really set up to write a sample C function to do this, but hopefully this clears up the confusion.
Thanks Aaron, your answer is very explicit. Together with douga's answer, I think I know what to do, Thank you very much!
Yao, did you get this to work. I can see the Feature and protocol helper for the Shutter. In the QEPro.cpp hte SHutter Feature .h and the OBP impl .h are included, but the feature is never added to the spectrometer. If you got this to work, would you please let me know how you did it? I need to get this done as wella nd am running on a raspberry pi.
OO stated that they will not cross compile the OMNIDriver native libs for ARM so this is our only route.
Thanks
Chris
Hello Chris,
Yes, I think I solved this problem, using the method they suggested. They did not provide the function for us to control the internal shutter for QE-Pro, but we can write this function by ourselves, by directly sending the binary code to QE-Pro through USB. You can find my code on github (https://github.com/zhangyaonju/seabreeze_control/blob/master/RP3_fluorescence_v1.00.c). the function I used is between line 220-267, hope it helps.
If you have any questions, please do not hesitate to let me know. One more thing, to make sure the internal shutter exist and functioning, you may want to test it using OceanView on a PC. It happens to me sometimes the internal shutter does not work because of the low temperature.
Best,
Yao
From: Chris Morton [mailto:moretone@users.sf.net]
Sent: 2017年5月9日 11:33
To: [seabreeze:tickets] 21@tickets.seabreeze.p.re.sf.net
Subject: [seabreeze:tickets] #21 strobeEnable / shutter support for QEPro
Yao, did you get this to work. I can see the Feature and protocol helper for the Shutter. In the QEPro.cpp hte SHutter Feature .h and the OBP impl .h are included, but the feature is never added to the spectrometer. If you got this to work, would you please let me know how you did it? I need to get this done as wella nd am running on a raspberry pi.
OO stated that they will not cross compile the OMNIDriver native libs for ARM so this is our only route.
Thanks
Chris
[tickets:#21] https://sourceforge.net/p/seabreeze/tickets/21/ strobeEnable / shutter support for QEPro
Status: open
Milestone: 3.0
Created: Tue Apr 05, 2016 05:12 PM UTC by Mark Zieg
Last Updated: Fri May 06, 2016 08:40 PM UTC
Owner: nobody
From user:
I'm writing code in C using seabreeze to control a customized QE-pro (QEP00937). I find some problems regarding unrecognized features. I cannot use the strope/lamp control function (sbapi_lamp_set_lamp_enable) to enable the lamp (I tried to use it to control an external shutter), when I ran the api_test program, it read out No lamp capabilities found. I addition, I also found that I cannot use the shutter control to control the internal shutter, it also says No shutter capabilities found. I test another spectrometer (HR2000+), and everything works fine. I'm wondering how can I solve this problem?
—zhangyaonju@
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/seabreeze/tickets/21/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/