QHYCCD

QHY CFW3 firmware source code?

Nico

QHY CFW3 firmware source code?
« on: March 11, 2021, 02:04:41 AM »
Hi,

sorry for the double posting, but I am not getting any feedback on my other thread here https://www.qhyccd.com/bbs/index.php?topic=8465.0

I would need a recent version of the arduino-compatible firmware (source code) for CFW3. As stated in the product page, the firmware should be open source, but I cannot find it anywhere. The copy I received on my other thread was not functional and most probably outdated.

Could you point me to a repository for the source code? I would of course send you back a copy after adding some features, which I believe could improve the filter wheel accuracy.

Thanks a lot,

Nico



Re: QHY CFW3 firmware source code?
« Reply #1 on: March 11, 2021, 07:25:52 PM »
Hi,
    Here is the newest version,you can check it.
Best Regards,
QinXiaoXu

Nico

Re: QHY CFW3 firmware source code?
« Reply #2 on: March 13, 2021, 04:20:31 AM »
Dear QinXiaoXu,

thanks: I have tried to upload the firmware you gave me to my CFW3 but the wheel behaved erratically on initialization.
Moreover, by looking at the code it seems that the variable t is not declared as volatile, which means it can't work in the interrupt function counter().

Could you please advice?

Thanks a lot,

Nico

Nico

Re: QHY CFW3 firmware source code?
« Reply #3 on: March 13, 2021, 04:50:42 AM »
Please have a look at the code I wrote: it implements all the functions in your arduino firmware (except for Q9cam(), so this code does not work with Q9 cameras) and it also has a user-definable backlash compensation. The backlash, both in forward (i.e. when filter position is incrementing) or backward (when position is decrementing) can be set by connecting to the wheel using the arduino Serial Monitor (wheel must be in serial mode) and using the commands FB+, FB-, BB+, BB- for setting the values of backlash in the forward and backward directions, respectively (e.g. FB+ increments the value of backlash in forward direction, FB- decrements it. Backlash can be positive or negative). Once happy, one can store the backlash values in the filter wheel EEPROM by typing STR.
Note that if the firmware is uploaded with the line #define DEBUG uncommented, then the wheel prints debug info to the arduino Serial monitor.

However, the filter wheel is not detected by the camera, so it is possible to control it only in serial mode. I suspect that there are some additional commands needed in the firmware to have the wheel recognized by the camera...

Nico

Nico

Re: QHY CFW3 firmware source code?
« Reply #4 on: March 15, 2021, 05:46:37 AM »
Dear QinXiaoXu,

the latest firmware for QHYCFW3 available for download (https://www.qhyccd.com/index.php?m=content&c=index&a=show&catid=68&id=176) is timestamped 20181114: unfortunately, only the .hex file is available. Would it be possible to have the arduino source code?

Thanks,

Nico

Re: QHY CFW3 firmware source code?
« Reply #5 on: March 15, 2021, 08:38:29 PM »
Hi,
    Here is the 20181114 version.
Best Regards,
QinXiaoXu

Nico

Re: QHY CFW3 firmware source code?
« Reply #6 on: March 16, 2021, 02:02:06 AM »
Dear QinXiaoXu,

thanks a lot: I will test it and give you back my feedback.

Best,

Nico

Nico

Re: QHY CFW3 firmware source code?
« Reply #7 on: April 24, 2021, 10:38:04 AM »
Dear QinXiaoXu,

the firmware you sent me does not work. After uploading it, my filter wheel keeps rotating and is not able to index. I had to upload the hex firmware.
Could you maybe share the source code corresponding to the lates firmware, which can be downloaded from your web page and is named 20190227013557956.zip?

Thanks,

Nico

Re: QHY CFW3 firmware source code?
« Reply #8 on: April 24, 2021, 08:36:39 PM »
Hi,
    I didn't find this version of source code on our SVN,on SVN,the newest version is 20181114,and could you read the version with 20190227013557956.zip?And where do you download it?Please send the page to me.
Best Regards,
QinXiaoXu

Nico

Re: QHY CFW3 firmware source code?
« Reply #9 on: April 25, 2021, 03:10:56 AM »
Hi,

I have downloaded the firmware from QHY web pages (https://www.qhyccd.com/uploadfile/2019/0227/20190227013557956.zip)

This firmware reports the same version number as the one you gave me (20181114), but if I try to upload the code you provided, the wheel does not work (keeps up spinning and does not get indexed).

I am attaching a copy of the firmware I wrote: it works (the wheel get properly indexed and it is possible to correct for the offset when changing filters, see documentation in the code) but unfortunately with my firmware the wheel can only be controlled through the serial interface (i.e. not through the camera connection). I suspect that there are some other commands which need to be implemented for making the filter wheel recognized when attached to a QHY camera. Moreover, the firmware I wrote is also having troubles with your ASCOM driver, even if I am implementing the same commands. It would be helpful to have a look at the ASCOM driver, or even better having access to the source code of the .hex which I linked in this message.

Thanks,

Nico

Re: QHY CFW3 firmware source code?
« Reply #10 on: April 27, 2021, 02:08:53 AM »
Hi,
    Please use Arduino 1.0.5 to compile it,and setup like attachment screenshot.
Best Regards,
QinXiaoXu

Nico

Re: QHY CFW3 firmware source code?
« Reply #11 on: May 01, 2021, 04:43:14 AM »
Dear QinXiaoXu,

I confirm that the original sketch works with the Arduino IDE 1.05

I am now trying to port the code to the most recent Arduino version but I am a but stuck. Is there any effort at QHY in this sense?

Best,

Nico

Nico

Re: QHY CFW3 firmware source code?
« Reply #12 on: May 01, 2021, 07:35:00 AM »
Dear QinXiaoXu,

I managed to have my new firmware working properly. Here some comments:

1) The version string must represent a valid date: the camera does check upon connection if the firmware replies to the command VRS with a date higher than  (apparently the camera does check the firmware version before attempting to connect with the wheel)
2) The variable used in the IRQ function (counter) must be declared as volatile int: older arduino compilers were less strict about that, but on newer compilers the code only works if the variable is properly declared
3) There might be an issue with timing: since the wheel expects serial commands which are NOT terminated by e.g. a carriage return, reading the correct sequence of characters should be performed within a certain time, which might depend on the PC speed. In my case, I had to experiment with the delay in serialEvent() to get stable performances. I would recommend sending a term char but this would imply changing the firmware of the camera as well as the ASCOM driver.

I have implemented several additional commands to set the backlash compensation: at the moment, these commands are only accessible through a serial monitor (e.g. switching the wheel to serial and connecting to it using the Arduino serial monitor). The commands are FB (Forward Backlash) and BB (Backward Backlash. The syntax is FBxxx, where xxx is a number, positive or negative, representing the backlash that should be corrected for when moving in the forward direction (i.e. when switching from filter 0 to 1, or 2 to 3 or generally when the motor is turning the wheel in the forward direction). For my wheel, the correct value is 130. Similarly, BBxxx will set the backlash in the opposite direction. For my wheel, the correct value is -130. Using the command STR, the values are stored in the EEPROM of the wheel and read during initialization.

I could expose the commands to change the backlash if I get the source code of the ASCOM driver, or try to implement unidirectional motion: I am attaching here a copy of my new firmware.

PLEASE NOTE: I did NOT test my firmware with a QHY9 camera, since I don't have one available. I therefore only left a placeholder in the code for adding the functions needed to control the wheel with such a camera. This firmware is NOT working with a QHY9!!!

Thanks,

Nico
« Last Edit: May 01, 2021, 07:51:52 AM by Nico »