Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 6 years ago

The issue I had was if you didn't read the full image, but tried to read only part of the image the start positions were not correctly calculated. No issue if full images were read.

Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

Thanks, will bring my branch back to your repository and remove mine when I get a chance to play with it again. I'll look at the cam86 driver to see what was done there.

Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

Temporarily forked off a copy of your cam84 at github. I guess I would need you to give me access to create a branch on your repository and edit it. In any event, I expect once I finish the code we can merge back to a single branch.

I fixed the code to allow image sections to be read with working starting positions.

There are some additional changes and investigations in the code in my updates branch, some of these are highlighted in the readme file.

I am working on modifying the exposure timing logic (and there was probably a bug in the previous version for multi-second exposures.)

Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

speaking of the version indi_cam84_ccd on GitHub, did you incorporate the fix for the read? If not, I could probably create a branch today with those changes and request a "pull" back to the master branch.

Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

Glad it works for you.

The old netbook I want to run the camera on gets lots of retries during a read at the 150 setting, but is successful. Sometimes goes to 4 or 5 retries. I had some hiccups with only 1 us of sleep where the read actually failed due to max number of retries but 10 us worked fairly well.

Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

Below are two diffs showing a quick mod that appears to take care of the "timing" issue due to the differences between D2XX and ftdi.

First I changed the calls to ftdi_read_data to ftdi_read_data_modified and created a new function ftdi_read_data_modified that continually calls ftdi_read_data until either too many attempts are made or all the data has been collected. This is a quick and dirty solution that appears to care of the problem. The number of tries and the usleep time are somewhat arbitrary and probably could be tuned. Not the cleanest solution, but this should allow your code to work with the ftdi library.

Michael

First in libcam84.h changes are

18,23d17
< #ifdef D2XX
< #else
< struct ftdi_context;
< int ftdi_read_data_modified(struct ftdi_context *ftdi, unsigned char *buf,  int size);
< #endif
< 

and in libcam84.c the changes are
312c312
<       dwBytesRead=ftdi_read_data_modified(CAM8A,FT_In_Buffer,0);
---
>       dwBytesRead=ftdi_read_data(CAM8A,FT_In_Buffer,0);
338c338
<       dwBytesRead=ftdi_read_data_modified(CAM8A,FT_In_Buffer, 8*mdeltX);
---
>       dwBytesRead=ftdi_read_data(CAM8A,FT_In_Buffer, 8*mdeltX);
367c367
< 	  dwBytesRead=ftdi_read_data_modified(CAM8A,FT_In_Buffer, 2*mdeltX);
---
> 	  dwBytesRead=ftdi_read_data(CAM8A,FT_In_Buffer, 2*mdeltX);
965,980d964
< }
< 
< int ftdi_read_data_modified(struct  ftdi_context * ftdi, unsigned char * buf, int size)
< {
< 	int rsize = ftdi_read_data(ftdi, buf, size);
< 	int nsize=size-rsize;
< 	int retry=0;
< 	while((nsize>0)&(retry<20))
< 	{
< 		retry++;
< 		usleep(500);
<  //	     	 fprintf(stderr,"Try %d since %d<>%d \n",retry, rsize,size);
< 	        rsize = rsize+ftdi_read_data(ftdi, buf+rsize, nsize);
< 		nsize = size - rsize;
< 	}
< 	return rsize;


Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

I am trying a few things. I think this is solvable with a modified version of ftdi_read_data. If so we should be able to make this work. Might be a while before I can work some more on this.

Michael

Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

(Still using sudo.)

However, I think I found the key issue that is causing the read errors. It is that the ftdi library's ftdi_read_data and the D2XX FT_Read have very different behaviors. See developer.intra2net.com/mailarchive/html...i/2012/msg00149.html for example. Looks like we might need to implement some variant of the function given in the patch. However, that version appears to be windows specific but could easily be linux compatible (it uses windows timer function.)

Need to investigate further but I think this is the key issue; it looks like there should be an easy fix. I'll investigate further.

Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

Success, went back to the latest build with the ftdi lib and set the baudrate down to 50 baud, (and was playing with the timers also) and the read errors went away. Figuring out what settings do what will have to come later. I ended up with an image! So with the right settings the driver does work, just not sure what the right settings need to be.

Don't currently have any other indi items, cam8 is my first step down this path so not sure what I can use to test the usb serial adapter. I do have a Arduino that I am using to build a TEC controller and it uses the usb so that might be a good test. I'll have to dig it out later and test it while running the indi cam8 driver.

Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

D2XX isn't working for me, again probably user error. I can't connect to the camera with D2XX and the current build with D2XX enabled.

sudo indiserver -v -m 100 indi_cam84_ccd
2016-11-26T22:28:22: startup: indiserver -v -m 100 indi_cam84_ccd 
2016-11-26T22:28:22: Driver indi_cam84_ccd: pid=3386 rfd=3 wfd=6 efd=7
2016-11-26T22:28:22: listening to port 7624 on fd 4
2016-11-26T22:28:22: Driver indi_cam84_ccd: snooping on Telescope Simulator.EQUATORIAL_EOD_COORD
2016-11-26T22:28:22: Driver indi_cam84_ccd: snooping on Telescope Simulator.TELESCOPE_INFO
2016-11-26T22:28:22: Driver indi_cam84_ccd: snooping on CCD Simulator.FILTER_SLOT
2016-11-26T22:28:22: Driver indi_cam84_ccd: snooping on CCD Simulator.FILTER_NAME
2016-11-26T22:28:31: Client 0: new arrival from 127.0.0.1:57556 - welcome!
2016-11-26T22:28:34: Driver indi_cam84_ccd: USING D2XX***********************************
2016-11-26T22:28:34: Driver indi_cam84_ccd: unable to open ftdi device: 1 (2)
2016-11-26T22:28:34: Driver indi_cam84_ccd: stderr EOF
2016-11-26T22:28:34: Driver indi_cam84_ccd: restart #1
2016-11-26T22:28:34: Driver indi_cam84_ccd: pid=3393 rfd=3 wfd=7 efd=8
2016-11-26T22:28:34: Driver indi_cam84_ccd: snooping on Telescope Simulator.EQUATORIAL_EOD_COORD
2016-11-26T22:28:34: Driver indi_cam84_ccd: snooping on Telescope Simulator.TELESCOPE_INFO
2016-11-26T22:28:34: Driver indi_cam84_ccd: snooping on CCD Simulator.FILTER_SLOT
2016-11-26T22:28:34: Driver indi_cam84_ccd: snooping on CCD Simulator.FILTER_NAME
2016-11-26T22:29:23: Driver indi_cam84_ccd: USING D2XX***********************************
2016-11-26T22:29:23: Driver indi_cam84_ccd: unable to open ftdi device: 1 (2)
2016-11-26T22:29:23: Driver indi_cam84_ccd: stderr EOF
2016-11-26T22:29:23: Driver indi_cam84_ccd: restart #2
2016-11-26T22:29:23: Driver indi_cam84_ccd: pid=3396 rfd=3 wfd=7 efd=8
2016-11-26T22:29:24: Driver indi_cam84_ccd: snooping on Telescope Simulator.EQUATORIAL_EOD_COORD
2016-11-26T22:29:24: Driver indi_cam84_ccd: snooping on Telescope Simulator.TELESCOPE_INFO
2016-11-26T22:29:24: Driver indi_cam84_ccd: snooping on CCD Simulator.FILTER_SLOT
2016-11-26T22:29:24: Driver indi_cam84_ccd: snooping on CCD Simulator.FILTER_NAME

But I can get the "read" example from the D2XX package.
 ./read
Library version = 0x10306
Opening port 0
FT_Open succeeded.  Handle is 0x823b680
FT_GetDeviceInfo succeeded.  Device is type 6.
FT_EE_Read succeeded.

Signature1 = 0
Signature2 = -1
Version = 3
VendorId = 0x0403
ProductId = 0x6010
Manufacturer = FTDI
ManufacturerId = CA
Description = cam8
SerialNumber = CAM8
MaxPower = 100
PnP = 1
SelfPowered = 0
RemoteWakeup = 0
Returning 0

Will shift back to the ftdi build and try to answer your other questions but any suggestions regarding D2XX, would like to have it for a comparison.

Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

Won't have time until this evening to play with it.

Probably don't have the group memeberships correct yet. Evidently don't have a dialout group. Will fix.

Using Ubuntu 16.10 from a lubuntu distro.

Will try the D2XX lib as you suggested for debugging purposes. I had downloaded and initially tried it with the first attempt you posted. Was glad to see the port to libftdi since D2XX requires rmmod of ftdio_sio which breaks internet and lots of stuff on the netbook.

Read More...

Michael F. Toups replied to the topic 'Help with DIY CCD driver' in the forum. 7 years ago

GIlles,

Thanks for the suggestion, it helped.

So I ran the indiserver from the command line and used KStars to connect to it as a remote on 127.0.0.1.

(Yes I did install the udev rules.)

So evidently I have a problem with ftdi connecting to the camera. So this was very bad, but see next block for an improvement,

indiserver -v -m 100 indi_cam84_ccd
2016-11-25T23:41:12: startup: indiserver -v -m 100 indi_cam84_ccd 
2016-11-25T23:41:12: Driver indi_cam84_ccd: pid=8414 rfd=3 wfd=6 efd=7
2016-11-25T23:41:12: listening to port 7624 on fd 4
2016-11-25T23:41:12: Driver indi_cam84_ccd: snooping on Telescope Simulator.EQUATORIAL_EOD_COORD
2016-11-25T23:41:12: Driver indi_cam84_ccd: snooping on Telescope Simulator.TELESCOPE_INFO
2016-11-25T23:41:12: Driver indi_cam84_ccd: snooping on CCD Simulator.FILTER_SLOT
2016-11-25T23:41:12: Driver indi_cam84_ccd: snooping on CCD Simulator.FILTER_NAME
2016-11-25T23:42:08: Client 0: new arrival from 127.0.0.1:54250 - welcome!
2016-11-25T23:42:18: Driver indi_cam84_ccd: USING LIBFTDI********************************
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error open interface A
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error open interface B
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error set bitbang mode interface B
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error set baud interface A (-3:USB device unavailable)
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error set baud interface B (-3:USB device unavailable)
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi BRA=-1 BRB=-1 TA=5000 TB=5000
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error set latency interface A
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error set latency interface B
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi BRA=-1 BRB=-1 TA=24000 TB=24000
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi interface A read chunksize 4096
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi interface B read chunksize 4096
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi interface A write chunksize 4096
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi interface B write chunksize 4096
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error purge RX interface A
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error purge TX interface A
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error purge RX interface B
2016-11-25T23:42:18: Driver indi_cam84_ccd: libftdi error purge TX interface B
2016-11-25T23:42:18: Driver indi_cam84_ccd: write failed on channel 2)
2016-11-25T23:42:18: Driver indi_cam84_ccd: write failed on channel 2)
2016-11-25T23:42:18: Driver indi_cam84_ccd: write failed on channel 2)
2016-11-25T23:42:18: Driver indi_cam84_ccd: write failed on channel 2)
2016-11-25T23:42:18: Driver indi_cam84_ccd: write failed on channel 2)
2016-11-25T23:42:18: Driver indi_cam84_ccd: write failed on channel 2)
2016-11-25T23:42:18: Driver indi_cam84_ccd: write failed on channel 2)

Starting the indiserver using a sudo was much better but have tons of read errors and the image is garbage. At least values are being returned now.


ccd: USING LIBFTDI********************************
2016-11-26T02:49:27: Driver indi_cam84_ccd: libftdi BRA=1400000 BRB=5600000 TA=5000 TB=5000
2016-11-26T02:49:27: Driver indi_cam84_ccd: libftdi BRA=1400000 BRB=5600000 TA=24000 TB=24000
2016-11-26T02:49:27: Driver indi_cam84_ccd: libftdi interface A read chunksize 4096
2016-11-26T02:49:27: Driver indi_cam84_ccd: libftdi interface B read chunksize 4096
2016-11-26T02:49:27: Driver indi_cam84_ccd: libftdi interface A write chunksize 4096
2016-11-26T02:49:27: Driver indi_cam84_ccd: libftdi interface B write chunksize 4096
2016-11-26T02:49:40: Driver indi_cam84_ccd: libftdi BRA=800000 BRB=3200000 TA=24000 TB=24000
2016-11-26T02:50:09: Driver indi_cam84_ccd: Start exposure bin 1 x 0 y 0 w 3000 h 2000 s 5.000000 l 1
2016-11-26T02:50:10: Driver indi_cam84_ccd: write 15V tick
2016-11-26T02:50:14: Driver indi_cam84_ccd: write exp tick
2016-11-26T02:50:14: Driver indi_cam84_ccd: reading : begin
2016-11-26T02:50:15: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 851<>12000 - 4 / 999 
2016-11-26T02:50:15: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 10667<>12000 - 5 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 7221<>12000 - 6 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 256<>12000 - 7 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 6539<>12000 - 10 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 4608<>12000 - 20 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 3499<>12000 - 28 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 7562<>12000 - 29 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 0<>12000 - 30 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 10038<>12000 - 31 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 6656<>12000 - 32 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 512<>12000 - 36 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 0<>12000 - 37 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 8672<>12000 - 38 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 85<>12000 - 39 / 999 
2016-11-26T02:50:16: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 1792<>12000 - 42 / 999 
2016-11-26T02:50:17: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 6027<>12000 - 45 / 999 
2016-11-26T02:50:17: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 11573<>12000 - 48 / 999 
2016-11-26T02:50:17: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 5888<>12000 - 52 / 999 
2016-11-26T02:50:17: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 7221<>12000 - 57 / 999 
2016-11-26T02:50:17: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 1878<>12000 - 58 / 999 
2016-11-26T02:50:17: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 256<>12000 - 62 / 999 
..........................etc................

Note I need to run about 80 baud or so (at least with the Ascom drivers) or the image is partially or totally corrupted.

Michael

Read More...