×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Help with DIY CCD driver

  • Posts: 13
  • Thank you received: 2
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;
7 years 4 months ago #12731

Please Log in or Create an account to join the conversation.

  • Posts: 167
  • Thank you received: 54

Replied by gehelem on topic Help with DIY CCD driver

very clever, it works for me quite well !
i can now run to baudrate 150 without errors
EDIT : never goes more than 1 or 2 retry, and ... 1us sleep...
Only first read often needs to wait
Last edit: 7 years 4 months ago by gehelem.
7 years 4 months ago #12732

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 2
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.
7 years 4 months ago #12734

Please Log in or Create an account to join the conversation.

  • Posts: 167
  • Thank you received: 54

Replied by gehelem on topic Help with DIY CCD driver

My new Cam86 is working, and this is my very first picture with brand new indi driver !! i'm so excited!! :woohoo: :woohoo:
[url=
File Attachment:
][/url]
very "beta test" but this is the first step
The following user(s) said Thank You: Jasem Mutlaq
7 years 2 months ago #13430

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 2
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.
7 years 2 months ago #13431

Please Log in or Create an account to join the conversation.

  • Posts: 167
  • Thank you received: 54

Replied by gehelem on topic Help with DIY CCD driver

Sorry, i though i did, but i didn't...
I've commited, you'll find new version on github
Gilles.
The following user(s) said Thank You: Michael F. Toups
7 years 2 months ago #13432

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 2
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.)
7 years 1 month ago #14848

Please Log in or Create an account to join the conversation.

  • Posts: 167
  • Thank you received: 54

Replied by gehelem on topic Help with DIY CCD driver

hi, thank you
i'm working now on Cam86, il will come back to software later.
I've added you as a collaborator on my repository, if you accept the invitation, we can work on the same repository
See also the code from cam86 driver on my repo : we've found good improvments with reading process
Gilles,
7 years 1 month ago #14858

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 2
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.
7 years 1 month ago #14871

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
Hello!

I am trying to port driver of the Cam10 guiding camera to linux, It almost working, but reading is "noisy"

Toups, I have similar problem with image as Gilles at his first image with cam86 (some posts above) and you've wrote:
What did you mean? I have some lines shifted. Is it the same issue?

Link for the alfa version below: ))
github.com/doctorandrey/indi_cam10_ccd

Sincerely,
Andrei
6 years 5 months ago #20344

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
Hello!
Toups, you wrote
I fixed the code to allow image sections to be read with working starting positions.

I'm working on the cam10 linux driver and have some lines shifted. Is it the same issue?

Here is code (based on Gilles driver)
github.com/doctorandrey/indi_cam10_ccd

Andrei
6 years 5 months ago #20345

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 2
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.
The following user(s) said Thank You: Andrei Prakapovich
6 years 5 months ago #20347

Please Log in or Create an account to join the conversation.

Time to create page: 1.165 seconds