×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Help with DIY CCD driver

  • Posts: 13
  • Thank you received: 2
So I tried the ftdi code and it appears to do something, but the image that is returned appears to be nothing but zeros according to the KStars FITS Viewer statistics tool. I am sure it is some sort of user error on my part since I am new to using INDI as well as using cmake to build the needed code.

Suggestions as to how to debug and where to turn on debugging options?

Also what does TimerA, LatencyA, TimerB, and LatencyB do?

I am attempting to run on an old netbook using lubuntu and am using libftdi1-2 version 1.3-2. This is a not the most powerful machine, but the cam8 does work under windows with the ascom drivers on this machine.
7 years 4 months ago #12648

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

If you haven't done that already, watch the video in the Setting Development Environment . It shows you how to setup debug for INDI drivers as well.
The following user(s) said Thank You: Michael F. Toups
7 years 4 months ago #12650

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 Toups,

you've helped me a lot in building my Cam84 : thank you for that and for taking the time to test this driver !
i've just commited my actual revision, it works better with libftdi, thank to Rome from ukrainian forum

Can you post the output of the command line ?
you should have something like :
2016-11-25T22:14:59: startup: indiserver -v -m 100 ./indi_cam84_ccd 
2016-11-25T22:14:59: Driver ./indi_cam84_ccd: pid=29271 rfd=3 wfd=6 efd=7
2016-11-25T22:14:59: listening to port 7624 on fd 4
2016-11-25T22:14:59: Driver ./indi_cam84_ccd: snooping on Telescope Simulator.EQUATORIAL_EOD_COORD
2016-11-25T22:14:59: Driver ./indi_cam84_ccd: snooping on Telescope Simulator.TELESCOPE_INFO
2016-11-25T22:14:59: Driver ./indi_cam84_ccd: snooping on CCD Simulator.FILTER_SLOT
2016-11-25T22:14:59: Driver ./indi_cam84_ccd: snooping on CCD Simulator.FILTER_NAME
2016-11-25T22:15:14: Client 0: new arrival from 127.0.0.1:46531 - welcome!
2016-11-25T22:15:15: Driver ./indi_cam84_ccd: USING LIBFTDI********************************
2016-11-25T22:15:15: Driver ./indi_cam84_ccd: libftdi BRA=1400000 BRB=5600000 TA=5000 TB=5000
2016-11-25T22:15:15: Driver ./indi_cam84_ccd: libftdi BRA=1400000 BRB=5600000 TA=24000 TB=24000
2016-11-25T22:15:15: Driver ./indi_cam84_ccd: libftdi interface A read chunksize 4096
2016-11-25T22:15:15: Driver ./indi_cam84_ccd: libftdi interface B read chunksize 4096
2016-11-25T22:15:15: Driver ./indi_cam84_ccd: libftdi interface A write chunksize 4096
2016-11-25T22:15:15: Driver ./indi_cam84_ccd: libftdi interface B write chunksize 4096
2016-11-25T22:15:19: Driver ./indi_cam84_ccd: Start exposure bin 1 x 0 y 0 w 3000 h 2000 s 1.000000 l 1
2016-11-25T22:15:20: Driver ./indi_cam84_ccd: write exp tick
2016-11-25T22:15:20: Driver ./indi_cam84_ccd: reading : begin
2016-11-25T22:15:20: Driver ./indi_cam84_ccd: write 15V tick
2016-11-25T22:15:38: Driver ./indi_cam84_ccd: reading : end

i'm actually running on a Odroid XU4, and tried on a old eeePC (both are 32 bits...)
Timer and Latency options where added to mess around with ftdi options, they should be moved to another tab, or simply disapear if i find a good solution.

Are you able to run other server, like eqmod or anything using usb/serial adapter ?
EDIT:
Did you install the udev rules ? :
sudo cp 99-cam84.rules /etc/udev/rules.d/
sudo service udev restart

Gilles.
Last edit: 7 years 4 months ago by gehelem.
7 years 4 months ago #12652

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

  • Posts: 13
  • Thank you received: 2
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.


sudo indiserver -v -m 100 indi_cam84_ccd
[sudo] password for michael: 
2016-11-26T03:10:53: startup: indiserver -v -m 100 indi_cam84_ccd 
2016-11-26T03:10:53: Driver indi_cam84_ccd: pid=8960 rfd=3 wfd=6 efd=7
2016-11-26T03:10:53: listening to port 7624 on fd 4
2016-11-26T03:10:53: Driver indi_cam84_ccd: snooping on Telescope Simulator.EQUATORIAL_EOD_COORD
2016-11-26T03:10:53: Driver indi_cam84_ccd: snooping on Telescope Simulator.TELESCOPE_INFO
2016-11-26T03:10:53: Driver indi_cam84_ccd: snooping on CCD Simulator.FILTER_SLOT
2016-11-26T03:10:53: Driver indi_cam84_ccd: snooping on CCD Simulator.FILTER_NAME
2016-11-26T03:11:53: Client 0: new arrival from 127.0.0.1:54440 - welcome!
2016-11-26T03:11:58: Driver indi_cam84_ccd: USING LIBFTDI********************************
2016-11-26T03:11:58: Driver indi_cam84_ccd: libftdi BRA=1400000 BRB=5600000 TA=5000 TB=5000
2016-11-26T03:11:58: Driver indi_cam84_ccd: libftdi BRA=1400000 BRB=5600000 TA=24000 TB=24000
2016-11-26T03:11:58: Driver indi_cam84_ccd: libftdi interface A read chunksize 4096
2016-11-26T03:11:58: Driver indi_cam84_ccd: libftdi interface B read chunksize 4096
2016-11-26T03:11:58: Driver indi_cam84_ccd: libftdi interface A write chunksize 4096
2016-11-26T03:11:58: Driver indi_cam84_ccd: libftdi interface B write chunksize 4096
2016-11-26T03:12:13: Driver indi_cam84_ccd: libftdi BRA=800000 BRB=3200000 TA=24000 TB=24000
2016-11-26T03:12:23: Driver indi_cam84_ccd: libftdi BRA=800000 BRB=3200000 TA=24000 TB=24000
2016-11-26T03:12:25: Driver indi_cam84_ccd: libftdi BRA=800000 BRB=3200000 TA=24000 TB=24000
2016-11-26T03:12:26: Driver indi_cam84_ccd: libftdi BRA=800000 BRB=3200000 TA=24000 TB=24000
2016-11-26T03:12:27: Driver indi_cam84_ccd: libftdi BRA=800000 BRB=3200000 TA=24000 TB=24000
2016-11-26T03:12:29: Driver indi_cam84_ccd: Start exposure bin 1 x 0 y 0 w 3000 h 2000 s 1.000000 l 1
2016-11-26T03:12:30: Driver indi_cam84_ccd: write exp tick
2016-11-26T03:12:30: Driver indi_cam84_ccd: reading : begin
2016-11-26T03:12:30: Driver indi_cam84_ccd: write 15V tick
2016-11-26T03:12:32: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 5715<>12000 - 7 / 999 
2016-11-26T03:12:32: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 11403<>12000 - 8 / 999 
2016-11-26T03:12:32: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 11659<>12000 - 10 / 999 
2016-11-26T03:12:32: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 11317<>12000 - 12 / 999 
2016-11-26T03:12:32: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 4864<>12000 - 13 / 999 
2016-11-26T03:12:32: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 10123<>12000 - 15 / 999 
2016-11-26T03:12:32: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 7221<>12000 - 16 / 999 
2016-11-26T03:12:32: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 11061<>12000 - 17 / 999 
2016-11-26T03:12:32: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 7766<>12000 - 18 / 999 
2016-11-26T03:12:33: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 7562<>12000 - 30 / 999 
2016-11-26T03:12:33: Driver indi_cam84_ccd: poseExecute bin==1 readfailed 4011<>12000 - 31 / 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

P.S. This is using the latest code that was just uploaded.
The following user(s) said Thank You: gehelem
Last edit: 7 years 4 months ago by Michael F. Toups. Reason: fix code snapsho
7 years 4 months ago #12656

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

ok,

About permissions :
udev rules should prevent from using sudo, but clearly it doesn't...
is your user in group DIALOUT ?

About errors :
this is exactly what i'm working on, try to increase timer values, e.g. 100000, and reduce baudrate

If you're a player, there is a way to try with D2XX wich is much more stable (but makes losing usage of all other usual fdti devices),
just remove the comment //#define D2XX in the header, an recompile
(i think D2XX library are installed by default with ubuntu)
unload ftdi_sio before running indi :
sudo rmmod ftdi_sio

btw : are you using ubuntu ? wich version ?

Gilles.
Last edit: 7 years 4 months ago by gehelem.
7 years 4 months ago #12659

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

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

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

don't spend too much time with D2XX, it is really not the good solution :lol:
Can you check if you can still use other usb devices, like a focuser or your mount ?
7 years 4 months ago #12675

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

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

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

  • Posts: 13
  • Thank you received: 2
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.

P.S. Tweaked a setting and now the image looks bad. Will need to investigate further but enough of this for one day.
Last edit: 7 years 4 months ago by Michael F. Toups. Reason: P.S.
7 years 4 months ago #12685

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

good news, thank you for the report
did it work "without sudo" ? what did you change ?
there are many other drivers you can try, eg dslr, filterwheel, focuser, mounts, other cameras ...
7 years 4 months ago #12695

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

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

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

this is the conclusion i was afraid of, as understanding the way this library works is much beyond my skills...
thank you for your help Mikael !
Gilles.
7 years 4 months ago #12724

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

Time to create page: 1.645 seconds