www.flickr.com
tres frijoles' photos More of tres frijoles' photos
You are here: tearsoffire.org > Projects Web > ElectronicsProjects > BlackfinProjects > BlackfinAstroCam r11 - 09 Jan 2008 - 13:50 - ChristopherPepe


Start of topic | Skip to actions

BlackfinAstroCam



about

This is a slow moving, long term project that I am doing with my wifes father. As an avid amatuer astronomer he has shown me many of the common ways that people gather images of the stars. Most of them involve modified webcams that need digital IO as well as a laptop with USB to gather raw images and then stack them. Two issues are that webcam are typically fairly low-res and use CMOS sensors which are not as good as CCD sensors.

Two approachs to this project are using a webcam or analog camera with video capture card. The capture card requires new hardware so I started with the webcam. I also made demo which uses a network camera. Its gross overkill but works and was easy. Check out my FlexStack demo using python

Image Stacking

The basic idea is that one takes lots of pictures (including 'dark frames' or images with the lens cap on) and subtracts out the noise that the camera picks up.

SRV-1

I see no reason to go forward with this project because the SRV-1 meets the requirements of the project.

Webcam

This approach with use the BlackfinOne SBC which has a USB host controller and DIO. Images will be stored on the SD card and later processed.

Building V4L and webcam tools

  • had to modify w3cam source
    • libjpeg and libpng includes needed to be modified (i.e. from #include <libjpeg.h> to #include "lib/libjpeg/libjpeg.h" )
    • w3cam.cgi linking failed and i manually added LDLIBS += -L/home/antics/hacking/blackfinOne/uClinux-dist/lib/libpng -L/home/antics/hacking/blackfinOne/uClinux-dist/lib/libjpeg to the Makefile - this is not the best method!
  • lib/libpng/png.h needed the same modifications as the w3cam source however this breaks the libpng build if you have to rebuild just that library

Quickcam Chat

This is my webcam that I got for $10 at Staples in 2005 or so. There is a good v4l driver for it and I used to use it with my desktop so it has a good chance of working with the blackfin.

The ISP1362 uClinux driver doesn't support isochronous transfers. Guess how my Logitech Chat Quickcam speaks?

/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/Sunplus/spca561.h: [spca561_init:497] Find spca561 USB Product ID 92c
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [spca5xx_set_light_freq:1858] Sensor currently not support light frequency banding f./home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 13
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 12
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 11
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 10
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 9
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 8
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 7
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 6
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 5
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 4
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 3
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 2
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [gspca_set_isoc_ep:881] ISO EndPoint found 0x81 AlternateSet 1
Isochronous transfers not supported
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
/home/antics/hacking/blackfinOne/webcam/gspcav1-20070110/gspca_core.c: [spca5xx_open:1923]  DEALLOC error on init_Isoc

Can't open device /dev/video
Still this is promising.
  • The w3cam tools built (I'm going to be using vidcat)
  • I was able to cross compile the gspca kernel module
  • v4l loads and functions properly

ToUCam

Very popular camera for amatuer astronomers. Ultimately this is the camera that I will need to support as it is the one that Ron has and plans to use. I've been playing with the ToUCam Pro becuase it is supported by the pwc driver which is included in the blackfin source tree. I've been working with the latest driver outside of the bfin source tree however and if i get it to work i plan on merging the changes into the main source.

changes to pwc

  • led_on and led_off are defined in many places in the blackfin code so i've changed them to pwc_led_on and pwc_led_off
  • the kernel complains that _vmalloc_to_pfn isn't defined due to this line of code: page = vmalloc_to_pfn((void *)pos);
    • this is due to it being a nommu system and thus i repalced the above line with page = page_to_pfn(virt_to_page((void *)pos));
    • this is a hack but one is just a wrapper for the other since there is no vmalloc in uClinux (no mmu remember)

I've had to modify a few trivial things in the driver but uClinux doesn't seem too happy about it.

root:~> vidcat -f jpeg -o test1.jpg
Data access misaligned address violation
 - Attempted misaligned data memory or data cache access.

No Valid pid - Either things are really messed up, or you are in the kernel
return address: 0x000e7aa0; contents of [PC-16...PC+8]:
ac5c 1811 e14d 2010 e148 2020 320e e10d
0000 e108 0000 3210 e0b2 2005 9528 9500 X
9448 9720 4c02 4907 0207 5056 42fa 3002

RETE:  00000000  RETN: 0018fcb4  RETX: 000e7aa0  RETS: 000e7a6e
IPEND: 9030  SYSCFG: 0036
SEQSTAT: 00000024    SP: 0018fbd8
R0: 000000c5    R1: 0133dd5f    R2: 00000008    R3: fffff5a0
R4: 00000001    R5: 00000000    R6: 0133dd5f    R7: 00000008
P0: 20200000    P1: 0133dd5f    P2: 00000004    P3: 016d0cc8
P4: 20000000    P5: 20100000    FP: 00000000
A0.w: 00000000    A0.x: 00000000    A1.w: 00000000    A1.x: 00000000
LB0: 000ae632  LT0: 000ae616  LC0: 00000000
LB1: 000e7aa2  LT1: 000e7a9c  LC1: 00000004
B0: 0000004c  L0: 00000000  M0: 0000001f  I0: ffffffff
B1: 00000067  L1: 00000000  M1: 016d7f84  I1: 00000000
B2: 0014b008  L2: 00000000  M2: 00000000  I2: 000c2888
B3: 00000000  L3: 00000000  M3: 00000000  I3: 00000000

USP: 00190000   ASTAT: 02003044
DCPLB_FAULT_ADDR=20100000
ICPLB_FAULT_ADDR=000e7aa0


Hardware Trace:
 0 Target : <0x00004a2c> { _trap_c + 0x0 }
   Source : <0x00008110> { _exception_to_level5 + 0xb4 }
 1 Target : <0x0000805c> { _exception_to_level5 + 0x0 }
   Source : <0x0000805a> { _ex_trap_c + 0x4e }
 2 Target : <0x0000800c> { _ex_trap_c + 0x0 }
   Source : <0x000081b0> { _trap + 0x28 }
 3 Target : <0x00008188> { _trap + 0x0 }
   Source : <0x000e7a9e> { _isp1362_write_buffer + 0x62 }
 4 Target : <0x000e7a6e> { _isp1362_write_buffer + 0x32 }
   Source : <0x000e6a7a> { _isp1362_write_addr + 0x4e }
 5 Target : <0x000e6a62> { _isp1362_write_addr + 0x36 }
   Source : <0x000ae656> { ___udivsi3 + 0xc6 }
 6 Target : <0x000ae650> { ___udivsi3 + 0xc0 }
   Source : <0x000ae636> { ___udivsi3 + 0xa6 }
 7 Target : <0x000ae5c6> { ___udivsi3 + 0x36 }
   Source : <0x000ae59c> { ___udivsi3 + 0xc }
 8 Target : <0x000ae590> { ___udivsi3 + 0x0 }
   Source : <0x000e6a5e> { _isp1362_write_addr + 0x32 }
 9 Target : <0x000e6a2c> { _isp1362_write_addr + 0x0 }
   Source : <0x000e7a6a> { _isp1362_write_buffer + 0x2e }
10 Target : <0x000e7a64> { _isp1362_write_buffer + 0x28 }
   Source : <0x000e6a96> { _isp1362_write_data16 + 0x1a }
11 Target : <0x000e6a7c> { _isp1362_write_data16 + 0x0 }
   Source : <0x000e7a60> { _isp1362_write_buffer + 0x24 }
12 Target : <0x000e7a5c> { _isp1362_write_buffer + 0x20 }
   Source : <0x000e6a7a> { _isp1362_write_addr + 0x4e }
13 Target : <0x000e6a62> { _isp1362_write_addr + 0x36 }
   Source : <0x000ae656> { ___udivsi3 + 0xc6 }
14 Target : <0x000ae650> { ___udivsi3 + 0xc0 }
   Source : <0x000ae636> { ___udivsi3 + 0xa6 }
15 Target : <0x000ae5c6> { ___udivsi3 + 0x36 }
   Source : <0x000ae59c> { ___udivsi3 + 0xc }
Stack from 0018fbb8:
        00000000 00008114 00192790 00192790 0019278c 00000000 00000000 00000000
        000e7aa0 00009030 00000024 00000000 0018fcb4 000e7aa0 000e7aa0 000e7a6e
        000000c5 02003044 000e7aa2 000ae632 000e7a9c 000ae616 00000004 00000000
        00000000 00000000 00000000 00000000 00000000 0014b008 00000067 0000004c
        00000000 00000000 00000000 00000000 00000000 00000000 016d7f84 0000001f
        00000000 000c2888 00000000 ffffffff 00190000 00000000 20100000 20000000
Call Trace:
       <0x000e834e> { _isp1362_read_ptd + 0x42 }
       <0x000e7b72> { _isp1362_write_ptd + 0x56 }
       <0x000e7bb2> { _submit_req + 0x1e }
       <0x000e7ce4> { _submit_req + 0x150 }
       <0x000e834e> { _isp1362_read_ptd + 0x42 }
       <0x000e8926> { _postproc_ep + 0x146 }
       <0x000e8054> { _start_atl_transfers + 0x5c }
       <0x000e9768> { _isp1362_irq + 0x548 }
       <0x000ae616> { ___udivsi3 + 0x86 }
       <0x000e815c> { _start_atl_transfers + 0x164 }
       <0x000ae632> { ___udivsi3 + 0xa2 }
       <0x000a0100> { _blk_queue_end_tag + 0xb8 }
       <0x000dd6ca> { _usb_hcd_irq + 0x26 }
       <0x000053ea> { ___do_irq + 0x36 }
       <0x000054e6> { _do_level_IRQ + 0x46 }
       <0x00008c76> { _bf533_demux_gpio_irq + 0x5a }
       <0x00014d0e> { _run_timer_softirq + 0xa }
       <0x000053ea> { ___do_irq + 0x36 }
       <0x00005760> { _asm_do_IRQ + 0x3c }
       <0x0001155e> { ___do_softirq + 0x5a }
       <0x00008c76> { _bf533_demux_gpio_irq + 0x5a }
       <0x00005760> { _asm_do_IRQ + 0x3c }
       <0x0014597e> { ___sched_text_start + 0x35e }
       <0x000083ac> { _new_old_task + 0x0 }
       <0x0014597e> { ___sched_text_start + 0x35e }
       <0x00145960> { ___sched_text_start + 0x340 }
       <0x000e7aa2> { _isp1362_write_buffer + 0x66 }
       <0x000ae3b6> { _memcpy + 0x2e }
       <0x000e7a9c> { _isp1362_write_buffer + 0x60 }
       <0x000ae3b4> { _memcpy + 0x2c }
       <0x0014b008> { _twist_table.11978 + 0x0 }
       <0x000c2888> { _sysdev_suspend + 0x98 }
       <0x000083ac> { _new_old_task + 0x0 }
       <0x0000ffe0> { _do_setitimer + 0x40c }
       <0x0000ffe0> { _do_setitimer + 0x40c }
       <0x00001ab2> { _cpu_idle + 0x16 }
       <0x000011ee> { _real_start + 0x92 }

Kernel panic - not syncing: Kernel exception

Camera

I recovered a nice B&W CCD camera from some old equipment that has a NTSC output. This approach involves creating a video capture card which has obvious other uses as well. There is already a reference design available through the ADI blackfin site.

-- ChristopherPepe - 22 Dec 2006

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r11 < r10 < r9 < r8 < r7 | More topic actions
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding tearsoffire.org? Send feedback