Home

PDF manual - GHI Electronics

image

Contents

1. GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Booting ALCAM UART Configuration e The defaults are o Baudrate 115200 o Data bits 8 o Parity None o Stop bits 1 e At boot time the SPI_SCK pin is internally pulled high If this pin is pulled low during reset or power up the UART baud rate will be 9600 instead of 115200 baud e The baud rate can be changed at run time using the B Change Baud Rate command Due to interrupt handling ALCAM may need to pause data exchange with the MCU this is indicated with a BUSY pin Because the interrupts are related to loading data into or out of a 4KB buffer the checks must occur at 4KB boundaries in the data The 4KB number only applies to file data read written on an SD Card or USB drive Command bytes used by the MCU are not counted Checks are not necessary if the data totals no more than 4KB After 4KB has been transferred read or written the MCU samples the BUSY pin it must pause while the pin is high SPI Interface Mode With the SPI interface ALCAM is a slave device It uses five hardware signals 1 SPI SSEL slave select SPI MOSI mosi SPI MISO miso SPI SCK clock BUSY This can be monitored while sending data to ALCAM When it is high no more data should be exchanged with ALCAM until it goes low Bn me MC IM Page 56 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCA
2. COMMAND SYNTAX Command Synopsis P C filename Capture to file PR Take Picture and send to MCU P T gt filename Capture to file Produce a thumbnail picture Command Descriptions C capture image to storage media P C gt filename Arguments Filename optional If filename is supplied it should have an appropriate extension Default YYYYMMDD HHMMSS xxx ext Where YYYY is year MM month 01 12 DD day 01 31 HH hours 00 23 MM minutes 00 59 SS seconds 00 59 xxx is an internally generated number 000 999 ext is either jpg or bmp Precedence of media selection SD card then USB Results IRR Initial result code If it is 00 the picture is being taken SHHHHHHHH The size of the image written to the storage device IRR Final result code Page 21 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set R capture Picture P R A still image is captured and then sent over the interface between ALCAM and the MCU Arguments None Results IRR Initial result code SHHHHHHHH Result size of the picture in bytes Specified in hexadecimal data stream RR The picture exactly SHHHHHHHH bytes will be sent followed by the Final result code Notes If the Final result code is an error ALCAM will still transmit exactly SHHHHHHHH bytes
3. Results Special effect See below IRR Final result code Special Effect Value Applied Effect 00000000 none 00000001 sepia 00000002 blue ish 00000003 Green ish 00000004 Red ish 00000005 Yellow ish 00000006 Black and White 00000007 Negative H Sharpness JH Results sharpness See below IRR Final result code sharpness a value from 00000000 to 00000008 Numbers above 00000000 correspond to increasing levels of sharpness Page 49 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set M Mirror and or Orientation setting J M Results mirroring orientation See below IRR Final result code Mirroring orientation Orientation value 00000000 Normal default 00000001 Flip 00000002 Mirror 00000003 Mirror and flip T Saturation value J T Results saturation See below IRR Final result code saturation a value from 00000000 to 00000008 Numbers above 00000000 correspond to increasing levels of saturation Z Zoom level J Z Page 50 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set Results zoom See below IRR Final result code zoom see Configure Zoom C Z K Get Free Space COMMAND SYNTAX Command Synopsis KS
4. 55 USACE Made Selgeoh c osa ra AA AA A Rda 55 Bostireset Protocolar adi ei 56 WART Menace OS accensa ihid e pie parue iun Rd Hc ET iMi S MM ML I MM EL t Ud 56 ugs jecur M 5T SPP Intenace Mode as creber xp EY Re pnis co PRETI RETE pO Mur bnt a 57 SPI BUS CONTIGUA M 58 EIE ERE E ED COLL TL DUI 58 RE A ne RET RE eo ee ee eee ee errr 60 2G Bus Ee E Oa A A T N EE EE SE E S E T aan E A T AS 60 9 The Bootloader sosaren a a ii ta 62 General Desornpi Oireiston EE 62 Connecting and Controlling the Bootloadet roro erento t ertet no eee repe ci 62 ES GMA ere C ommasrids sanna nap de e n io iui dE Eau nde IC rat prd spa aM Magd 62 10 Hardware Design CONS IO sia AE EHE ND D PESE REN VO POEM CU EE NOE ENS EXEC AREAS 64 POWER POE ve oU Rc RARO Ee ER app TU wana eed Re ped Reds inrer ERE ard teense Dra T 64 Main System OM 64 Camera POWE seision eaaa E a ea EE EE ENEE Sa a A EE aE N a aaa a Naa ai 64 Camera duas ter DB anann a AAA AI NR RR I UTR EQUA 64 Camera COMMON cci e PER ROS EEEEERERRORERE AAA EEE SETI EE EEES 65 O A 66 Canaan M 66 Main System GIO e 66 Real Time Clock SD Card Detec t Bootloader Access Ooi Comp ona TES sese e EELE TONES CH DENN ERU RO SO RUE IUS EEAU ERO Rd e et
5. minutes seconds YYYY MM DD Year Month 00 12 Day 00 31 IRR Final result code Page 35 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Note ALCAM Command Set The number representation for time and date as used above is in decimal not hexadecimal The fields are fixed width and padded with zero 0 Unlike most other commands there is no initial result code Page 36 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Q Format Media ALCAM Command Set COMMAND SYNTAX Command Synopsis QS Format SD card QU Format USB storage The speed of formatting can vary greatly size is one factor another is the type and or class of the media Warning Formatting erases all data on the selected media Use it with care The results are the same for both commands 100 Initial result code If it is 100 formatting has started HHHHHHHHHHHHHHHH Formatting is complete this is the free size in bytes 64 bit long number in hexadecimal IRR Final result code Note the initial result code is an acknowledgment that ALCAM is processing the command Due to extra processing this command can take longer than average The initial result code allows the MCU to adjust any timeout values and similar
6. RO ICS ALCAM SoC Processor User Manual February 10 2015 THIS IS A PRELIMINARY MANUAL ALL CONTENT IS SUBJECT TO CHANGE GHI Electronics LLC ALCAM SoC Processor User Manual Table of Contents Table of Contents Introduce Example Applications Key Features siii ME csi te i Siu T H P FAT File System Engine Memory Card Access SDHC SD or MMC Bootloader inaia Bom Initialization Commands Camera USB SD D desides PN P Picture Still Shot CONTO C capture image to storage media P CL flenamel s eite Roe a p bv KE RE Rl va duties rs 22 FR cape PICE aA APA Pe OT SUE EM 23 capture image and thumbnail P TP MENAM ursi i rint re Prae HEY IO AA Ae 24 F File Operations t MP 25 Wy wite bytes toa lia ad dea 26 R open and read bytes from a file F Rename ii 27 EOE eE A Ta E REC CPP 27 S E A a EE E a E E A E T teas azn S 28 D diee a Ue DMA nena AS A AAAA ES 28 tuere cu An MIcTeR aa 28 M Movie Operations snsc a a a tes Ea tE E NaSO N EAEE NEN ANE a
7. in which case the ENTER key is the NOP Page 52 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Standalone Mode 7 Standalone Mode Standalone mode on the ALCAM allows you to trigger different actions by using a button remote camera control or other input source connected to the standalone pin which is internally pulled low To trigger an action bring the pin high for the duration specified in the following table Duration Action Less than 3 seconds Take a picture 3 to 9 seconds Record a movie More than 9 seconds Load the configuration When taking a picture or recording a movie using this mode the default name rules are used See the default file names discussion in the command set section To stop recording a movie when in normal or time lapse mode bring the pin high for under one second When in stop motion mode after you begin recording a movie in standalone mode further presses will add a frame to the movie To stop recording the movie you must bring the pin high for three seconds When recording a movie you must wait for the error LED to illuminate after stopping the movie before removing the storage media The device needs some time to flush the data The load configuration action is useful because standalone mode allows the device to operate without a host MCU In order to configure the camera you can gener
8. the data is undefined Example P C gt U example jpg take a picture and put it in example jpg on the USB drive 100 0001FC46 picture file contains 103 118 bytes 100 the file was successfully written PR take another picture and send it to the MCU 100 0002FC66 ALCAM will send 195 686 bytes to the MCU data_stream 00 ALCAM sends 195 686 bytes to the MCU and signals success Page 22 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set T capture image and thumbnail P T filename Arguments filename optional This is the name of the file containing the full image It should have an appropriate extension The thumbnail name is filename Thumbnail ext with ext appropriate for the file format type Any original extension on filename is removed before Thumbnail ext is appended Default YYYYMMDD HHMMSS xxx ext Where YYYY is year MM month 01 12 DD day 01 31 HH hours 00 23 MM minutes 00 59 SS seconds 00 59 xxx is an internally generated number 000 999 ext is either jpg or bmp The thumbnail name will be the default name as above with ext replaced by Thumbnail ext The storage device is chosen by checking for the SD Card if present it is used otherwise the USB drive is used Results IRR Initial result code SHHHHHHHH Size of image written to st
9. 02 ALCAM SoC Processor User Manual Booting ALCAM MOSI 2 0xXA00 0 0 0 0 0 0 0 MISO D 0x8 0 1 2 3 415678 Due to interrupt handling ALCAM may need to pause data exchange with the MCU this is indicated with a BUSY pin Because the interrupts are related to loading data into or out of a 4KB buffer the checks must occur at 4KB boundaries in the data The 4KB number only applies to the file data read written on an SD Card or USB drive The 4KB number is independent of the 3 header bytes it is only the data bytes that matter Checks are not necessary if the the data count is less than or equal to 4KB After 4KB has been transferred read or written the MCU samples the BUSY pin it must pause while the pin is high 12C Interface Mode I2C interface uses three hardware signals 1 12C_SCL clock 2 12C_SDA data 3 BUSY While sending data to ALCAM if this is high then data transmission should pause until it goes low I2C Bus Configuration e ALCAM I2C slave address is 0x52 7 bit This is a fixed address and can not be changed e Bit zero is the RW bit O Write 1 Read e The maximum allowed I2C clock is 400KHz e The circuit must provide pull up resistors usually they are 2 2K on the bus as specified in the I2C specifications Transmitting and receiving data to and from ALCAM is preformed through standard I2C transactions e Transmitting ALCAM s I2C address w
10. Status Register is used there is no J F The C D restore configuration does not change time commands Page 38 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Sub command Descriptions Arguments ALCAM Command Set S Set frame image size C S size size as shown below Default value is 1 320x240 QVGA Results Size value Pixel dimensions Common name 0 160x120 QQVGA 1 320x240 QVGA 2 640x480 VGA 3 800x600 SVGA 4 1024x768 XGA 5 1280x720 720 HD IRR Final result code B Set brightness level C B gt brightness Arguments brightness a value from 0 to A 10 decimal Values above 0 increase the brightness Default 0 Values above 0 increase the brightness Results IRR Final result code Page 39 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set O Set contrast level C O contrast Arguments contrast is a value from 0 to A 10 decimal Each value above 0 increases the contrast Default 0 Results IRR Final result code A Manual or automatic white balance C A white balance Arguments white balance if 0 then automatic white balance is used otherwise a 6 byte hexadecimal number represents the white balance using Red Green and Blue RRG
11. activities Page 37 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual C Configure Camera ALCAM Command Set COMMAND SYNTAX Command Synopsis C S size Set frame image size C B brightness Set brightness level C O contrast Set contrast level C A white balance Manual or automatic setting of white balance C E gt special effect Select from a variety of special effect processing C H sharpness Select from different levels of sharpness C M gt mirroring orientation Mirror and or flip the image C T gt saturation Select different saturation values C F gt image format For still pictures choose image data format CW Write current configurations to non volatile storage EEPROM CD Restore Configuration to factory defaults C Z gt zoom Select zoom levels Important notes When configure commands are used they are not stored on the next reset or factory reset command C D they will be lost To store configuration for future resets make the desired changes then use the Write Configuration C W command For each Set Configuration command C there is a corresponding Get Configuration command J For instance for C A gt white_balance there is J A There is one exception to get the current file type JPEG or BMP of still images the J Get
12. are a few extra components needed for ALCAM to function properly listed as followed Resistors Pin 14 RESET Pull up to VCC 3 3V w 10k resistor Page 66 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Pin 37 Pin 48 Pin 69 Pin 79 Pin 91 Pin 94 Pin 95 Pin 96 Pc D PB2 Connect to ground w 10k resistor Serial RX IC SDA Pull up to VCC 3 3V w 10k resistor DCMI D1 Pull up to VCC 3 3V w 10k resistor SD D3 Pull up to VCC 3 3V w 10k resistor PB5 Pull up to VCC 3 3V w 10k resistor BOOTO Connect to ground w 10k resistor Camera l C SCL Pull up to VCC 3 3V w 2 2k resistor Camera l C SDA Pull up to VCC 3 3V w 2 2k resistor Capacitors Hardware Design considerations Pin 49 VCAP1 Connect a 2 2uF capacitor to ground Pin 73 VCAP2 Connect a 2 2uF capacitor to ground Connect a 47yF capacitor from VCC 3 3V to ground Electrical characteristics The ALCAM SoC is based on STM32F407VE Consult the processor datasheet for electrical characteristics as needed USB ALCAM supports USB drives along with SD cards for storage Only full speed 12Mbps mode is supported If you plan to use USB you must add a 22 ohm resistor in series with each of the following pins Pin 70 Function 10 USB D Pin 71 Function 11 USB D Page 67 of 75 www ghielectronics com GHI Electronic
13. d DX E R ppeaetirnaee omen nerarmanaininaeasy rexnfes eu e 68 Dol TT ERE 68 Te ALCAM OEM c 69 ALCAN COEN ir a 69 OEM Pidan aiii 69 EMOL o sio dede CORREO MERC DO on p ms edcels pau atbe eau ts Gapago aine Aaj wns eu dae omg necge aaooca ona sacle SUE eG apenas eT aS 70 re a A E o m 71 A P 21 Pushibuftomancdi zm li o diana Cd ERE 71 12 POMO io rii cedro rto eria epe bete eio nbn SAA AAA A O T2 ato UNS IG EE Sae AA A E n tea rao A A E A nay E E E E UR IAS imp Re he File ACCESS PO usage tau pee ie p Ete O D FS tU E HP HE NET Fio EO nisceanntpenuseaeeaieies Kx tada 72 Moe RESUL SS NR ins Ta QM SII Te ASTON EL a 0 LT LL 75 15 Legal Noi IPIE 76 A O nue nabatn denies ONDES NDA DL MDENMIESV M S T 76 Page 3 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Introduction 1 Introduction ALCAM is a System on Chip SoC which directly supports still shots video time lapse video and stop motion video This drop in SoC adds imaging and video to any project ALCAM can be attached to a PC for software prototyping and experimenting The underlying processing of image data from cameras is e
14. for time and date TA Initialize and use internal system clock for time and date T S gt timestamp Set Date and Time TG Get the date and time Sub command Descriptions B Use battery backed real time clock T B Unless an external battery is wired to the VBAT pin the Set Date and Time Get Date and Get Time commands will work identically as though the time was using system mode After issuing this command the time and date will be preserved through resets Arguments None Results IRR Final result code Use internal clock T Il In this mode the time and date commands use the internal system clock Every time ALCAM is reset the clock starts at 00 00 00 1980 01 01 Arguments None Results IRR Final result code Page 34 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set S Set date and time T S gt timestamp Arguments timestamp is a hexadecimal number representing 32 bits of encoded date and time as follows Bits s Field Description 31 25 Year Years since 1980 24 21 Month 1 12 20 16 Day 1 31 15 11 Hour 0 23 10 5 Minute 0 59 4 0 Second Results Seconds divided by 2 0 30 IRR Final result code For example 34212002 is 04 00 00 2006 01 01 D Get date and time T G Arguments None Results HH MM SS Hours 00 24
15. of movie begins 00F00000 the movie size is 15 728 640 bytes 100 movie file was successfully written IU Initialize the USB storage system 100 M B gt U test avi begin put the video file test avi on the USB drive 100 command succeeded recording is underway ME end a movie 100 success post processing of movie begins 00F00000 the movie size is 15 728 640 bytes 100 Page 19 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual D Power Control ALCAM Command Set Command Synopsis COMMAND SYNTAX DO Power camera up D1 Power down the camera D2 Reboots ALCAM and stays in bootloader mode By default the camera is powered up and initialized The power down command D 1 can be used to turn the camera off Subsequently D 0 is used to enable power When D 0 is used the camera is automatically initialized the equivalent of the C command Results 100 These commands always return 100 no error Note power state of the camera J Read Status and Configuration can be used to determine the current When using the D 2 you do not need to set the boot mode pins The device goes directly to the bootloader Page 20 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set P Picture still shot Control
16. recommended to have cleaner less noisy images However to keep the ground plane a single common ground you can use a 0 Ohm resistor by connecting the analog ground with the digital ground or create a small channel between the digital ground and analog ground with a small 10 mil trace or even through a via For a visual reference please see the ALCAM OEM schematic and PCB layout Camera Master Clock A typical camera sensor requires a 24 MHz crystal for proper functionality There are two options available 1 Provide your own external crystal or 2 Connect pin 67 MCO1 of ALCAM to the master clock pin of the camera sensor Page 63 of 75 www ghielectronics com ALCAM SoC Processor User Manual GHI Electronics LLC PRELIMINARY 0 02 Hardware Design considerations Please note that some camera sensors may already provide an oscillator crystal and would not require either option above Please review your camera sensor s datasheet for more information regarding crystals Camera Connection The following is an example of a typical 24 pin camera interface as found on the ALCAM OEM module ALCAM Pin ALCAM Name Camera Pin Camera Name 1 NC 2 Analog Ground 96 Camera I C SDA 3 C SDA 4 Analog 2 8V 95 Camera I C SCL 5 C SCL 86 Camera Reset 6 Camera Reset 93 DCMI VSYNC 7 VSYNC 40 PWR DOWN 8 Power Down 29 DC
17. takes a frame and adds it to the movie Arguments None Results IRR Final result code Page 32 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set E End the movie M E Arguments None Results 100 Initial result code Capturing has stopped ALCAM begins post processing HHHHHHHH Size of the movie file in hexadecimal IRR Final result code If it is 00 then the post processing is finished file operations are complete Notes For performance reasons ALCAM buffers data Before removing media shutting down ALCAM or resetting ALCAM the MCU should wait until the Final result code is received Get information on a movie file M I filename Arguments filename the file to get information on Results 100 Initial result code SHHHHHHHH The requested number of frames per second FPS for playback SHHHHHHHH This number is the total number of frames in the movie SHHHHHHHH The size dimension code as defined in the configure size C S size code command gives W x H IRR Final result code Page 33 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set T Time and Date Operations COMMAND SYNTAX Command Synopsis TH Initialize and use battery backed RTC
18. 2 FUNCTION 3 13 FUNCTION 4 14 FUNCTION 5 STANDALONE MODE 15 FUNCTION 6 16 FUNCTION 7 17 FUNCTION 8 18 FUNCTION 9 19 FUNCTION 10 USB D 20 FUNCTION 11 USB D 21 VBAT 22 FUNCTION 12 23 RESET Page 69 of 75 SD Connector Pinout ALCAM SD card Interface Pin 1 Vcc N C SD CD SD DO SD D1 SD CMD SD D2 SD D3 Qo 00 AJOIN SD CLK e GND www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM OEM Error LED The error LED will blink a number of times when something has gone wrong when using standalone mode as shown below If the LED keeps blinking then a movie is being recorded Number of blinks Description Capturing images using the standalone function The camera has not been initialized I command There is no SD card or USB drive connected The SD card or USB drive has not been initialized I command An error occurred during movie recording Opening a file failed The operation failed co o0o o0 AI OJ gt Status LED The status LED will be on if the ALCAM is ready to capture or record If it is off it means the camera module is bad or there is no SD card or USB drive connected or they are not initialized If the status LED is blinking quickly it means the configuration was successfully loaded and applied You should res
19. 3 3V Power Connect a 1pF capacitor to ground 29 DCMI HSYNC Camera Horizontal Sync Pin 30 ISPI CLK SPI Clock Interface to External MCU 31 DCMI PIXCK Camera Pixel Clock Pin 32 SPI MOSI od ea In Interface to External MCU Boot 33 DNC Do Not Connect 34 DNC Do Not Connect 35 DNC Do Not Connect 36 DNC Do Not Connect 37 PB2 Connect to ground w 10k resistor 38 DNC Do Not Connect 39 DNC Do Not Connect 40 PWRDOWN Camera Power down Pin 41 DNC Do Not Connect 42 LED1 ALCAM Error Code Indicator LED 43 DNC Do Not Connect 44 Function 5 Standalone mode trigger 45 Function 6 TBD 46 Function 7 TBD 47 UART TX lC SCL UART TX Pin and C Clock Pin Interface to External MCU 48 UART RX C SDA UART RX Pin and C Data Pin Interface to External MCU Pull up to VCC 3 3V w 10k resistor Page 10 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Pinout Pin Name Description Notes 49 VCAP1 Connect a 2 2yF capacitor to ground 50 VDD4 3 3V Power Connect a 1pF capacitor to ground 51 DNC Do Not Connect 52 DNC Do Not Connect 53 Function 8 TBD 54 Function 9 TBD 55 DNC Do Not Connect 56 DNC Do Not Connect 57 DNC Do Not Connect 58 DNC Do Not Connect 59 DNC Do Not Connect 60 DNC Do Not Connect 61 DNC Do Not Connect 62 DNC Do Not Connec
20. ALCAM SoC Processor User Manual ALCAM Command Set Results vn n n The Firmware Version IRR Final result code Notes The bootloader has its own version code See the Bootloader Commands section The use of decimal here is an exception to ALCAM s rule of returning numbers in hexadecimal with a fixed field length Example V v0 0 1 100 Page 17 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set Initialization Commands Camera USB SD COMMAND SYNTAX Command Synopsis IC Initialize the camera S gt clock Initialize the SD card IU Initialize the USB The initialize commands reset and establish a default state for devices Under normal circumstances initialization will occur automatically During start up the camera is initialized if present SD Card and or USB initialization occurs During active running if an SD card or USB device is inserted appropriate initialization takes place The time taken to initialize either the SD Card or USB device is variable based on the physical device This time can be significant on the order of multiple seconds Initialization of the camera takes approximately 500 milliseconds In general there is no need to use initialization commands they can be used to perform a software reset If ALCAM cannot initialize a sto
21. C Z gt zoom zoom level Enlargement 0 None default 1 1 25 12596 2 1 50 150 3 1 75 175 Support for zoom levels vary by dimension size Zoom Pixel Common Size Value see C S gt size Supported Dimensions Name Yes 160x120 QQVGA 0 Yes 320x240 QVGA 1 Yes 640x480 VGA 2 Yes 800x600 SVGA 3 No O only 1024x768 XGA 4 No O only 1280x720 720 HD 5 Results IRR Final result code Note Zoom is performed algorithmically consequently larger levels of zoom will have greater image degradation Page 44 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set J Read Status and Configuration COMMAND SYNTAX Command Synopsis J Query ALCAM for current settings and storage device status JS Get frame image size JB Get brightness level JO Get contrast level JA Get white balance setting JE Get special effect setting JH Get level of sharpness JM Get mirror flipping setting JT Get saturation value JZ Get zoom levels The J commands return the current values in effect For example if the level of brightness held in stored configuration data was 00000001 and a reset or C D command occurred then J B would return 00000001 If a subsequent C B gt 0 command was issued then J B would
22. Connect to VCC 3 3V w 10k resistor 92 DCMI D5 Camera Data Pin 93 DCMI VSYNC Camera Vertical Sync Pin 94 BOOTO Connect to ground w 10k resistor 95 Camera C SCL eee Pin Interface Pull up to VCC 3 3V 96 Camera C SDA Se Data Pin Interface Pull up to VCC 3 3V w 2 2k 97 DCMI D2 Camera Data Pin 98 DCMI D3 Camera Data Pin 99 VSS4 Ground 100 VDD6 3 3V Power Connect a 1pF capacitor to ground Page 12 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set 6 ALCAM Command Set These specifications are subject to change including but not limited to re definition additions and or deletions of commands arguments and results Terminology and Syntax of Command Definitions e Examples and declarations are color coded Items going from the controlling MCU to the ALCAM are red Items transmitted from ALCAM to the MCU are in green e All commands sent from the MCU and all responses sent back by ALCAM are 8 bit readable ASCII characters The only exception to this is when raw data is sent to or from ALCAM as part of streaming images and or file contents e All commands and all responses are terminated by a newline n 0xA In this manual if a command or response is transmitted with multiple newline separated strings the examples will show them sequentially on separate lines For example when queried for the
23. GBB The maximum value is FFFFFF Default O Examples C A gt 0 100 C A gt 400511 100 The first command set the white balance to automatic The 2 command sets it to red 64 green 5 and blue 17 in decimal Results IRR Final result code Page 40 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set E Special effect processing C E gt special effect Arguments special effect a number from the Value column Default 0 Special Effect Value Applied Effect 0 None Sepia Blue tint Green tint Red tint Yellow tint Black and White NO Oo C 2 Negative Results IRR Final result code Arguments H Sharpness C H gt sharpness sharpness a value from 0 to 8 Numbers above 0 correspond to increasing levels of sharpness Default 0 Results IRR Final result code Page 41 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set M Mirror and or flip the image C M mirroring orientation Arguments mirroring orientation a number from the value column Default O Mirroring Orientation Orientation Value 0 Normal the Default 1 Flip 2 Mirror 3 Mirror and flip Results IRR Final re
24. INARY 0 02 ALCAM SoC Processor User Manual The Bootloader 9 The Bootloader General Description The bootloader is the software that runs when ALCAM is powered up or reset It has two primary functions 1 Boots and initializes the state of the hardware verifies and starts execution of the ALCAM firmware 2 GHI Electronics periodically releases new firmware the bootloader provides the interface to install firmware on ALCAM Connecting and Controlling the Bootloader e The bootloader is entered by resetting ALCAM with SPI SSEL low and SPI MOSI high e Firmware transfer uses the XMODEM protocol with 1K packets and 16bit CRC over UART Bootloader Commands Command Description R Run Exit loader run firmware X Transfer Erase current firmware and flash new firmware V Version Print the bootloader version number The format is vn n n e Commands and their result codes are readable ASCII characters e Successful commands return OK while unsuccessful commands return an error message Both are followed by a carriage return 0x0D and line feed 0x0A e Commands are case insensitive and are followed by carriage return or line feed e APC terminal console program that supports XMODEM will work for updating e Another way to perform firmware updates is to add XMODEM software to the controlling MCU With this method the controller can perform in field firmware updates Page 61 of 75 www ghielect
25. M SoC Processor User Manual Booting ALCAM SPI Bus Configurations e The maximum SPI clock is 24 MHz e SPI clock idle state is low e Sampling is on the rising edge e Slave select is active low e Multibyte transfers are supported SPI Frames When using SPI the data exchanged between the MCU and ALCAM is broken up into frames e Frames are classified as either 1 Write MCU sending data to ALCAM MOSI 2 Read ALCAM sending data to MCU MISO e All frames start with a header 1 The first byte indicates whether it is write 1 or read 2 2 The next 2 bytes are the data count Count is a 16 bit number with the Least Significant Byte LSB sent first Frame sizes can be adjusted to the designer s needs using the data count Here is an example of SPI frames used to perform the Get Firmware Version command V The SPI framing chosen here is one frame for the command and one frame for each result If the version of the firmware is 1 0 0 the high level serial based dialog looks like this V MCU sends command v1 0 0 MCU reads version sent by ALCAM 00 MCU reads Result code sent by ALCAM The SPI frames are 1 Write Frame MOSI1 2 0 V n MSOB 8H ai 2 Read Frame first line of result Page 57 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Booting ALCAM MOSI 2 700 0 00 0 0 0 MI
26. MI HSYNC 9 HSYNC 10 Digital 1 8V 11 Digital 2 8V 5 DCMI D7 12 D9 gt D7 67 MCO1 13 Master Clock 4 DCMI D6 14 D8 gt D6 15 Digital Ground 92 DCMI D5 16 D7 e D5 31 DCMI PIXCK 17 Pixel Clock 3 DCMI D4 18 D6 gt D4 68 DCMI DO 19 D2 e DO 98 DCMI D3 20 D5 gt D3 69 DCMI D1 21 D3 e D1 97 DCMI D2 22 D4 gt D2 23 D1 Page 64 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Hardware Design considerations ALCAM Pin ALCAM Name Camera Pin Camera Name ES 24 DO Status LEDs ALCAM communicates to the user visually with two indicator LEDs They are as followed Pin 26 Status Indicator LED2 Pin 42 Error Code Indicator LED1 Crystals Main System Clock The main oscillator is to be connected to pin 12 OSC IN and pin 13 OSC OUT External crystal capacitors should be placed in parallel with the oscillator and the oscillator pins Please NOTE It may be necessary to place a 0 Ohm resistor in series of pin 13 and the crystal Please see the ALCAM OEM schematics for reference ALCAM s Main Crystal Specifications Frequency 12 MHz Frequency Tolerance 25 C 30ppm Load Capacitance Ci 18pF External Input and Output Crystal Capacitors 18pF Real Time Clock An optional external crystal is required for the use of keeping accurate time while ALCAM is powered down or in a hibernation Ther
27. ORTANT Read the command references carefully as there are exceptions to the above rules Page 15 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set Command Classes Commands are grouped by class Multiple commands in any class use the same Command Set Letter for the first character of the command and are usually followed by a sub command letter and or optional arguments Command Set Class or Function Letter M Movie Operation Controls P Picture Operation Controls C Camera Configurations D Power Control T Time and Date Operations F File Operations Initializes Device Drivers J Read Status Register and Configurations K Get Available Storage on Media Q Format media B Change Baud Rate of UART Interface NOP Newline is a No Operation Command V Get Version Number of Firmware NOP is not the letter for the No Operation COMMAND the command is sent as either a newline or a carriage return This is convenient for the case where a terminal program on a PC is being used over UART in which case a blank line ENTER key is the NOP and causes no error V Get Firmware Version COMMAND SYNTAX Command Synopsis V Return Current Version of ALCAM s Firmware Arguments None Page 16 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02
28. Report available space on SD card KU Report available space on USB storage The speed of this command can be longer than many of the other commands Arguments None Results are the same format for both commands IRR Initial result code 64 bit value which is the number of free bytes on the media IRR Final result code HHHHHHHHHHHHHHHH Page 51 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set B Change Baud Rate COMMAND SYNTAX Command Synopsis B baudmsta Set the baudrate of ALCAM when using UART Arguments baudrate Default 1C200 115200 decimal Results IRR Initial result code If it is 100 ALCAM will change the UART baud rate This Initial result code code is transmitted using current baud rate not the new baudrate If there is an error the baud rate will not be changed and the Final result code will not be sent IRR Final result code transmitted using the new baudrate Note The default baud rate is re established on reset No operation NOP COMMAND SYNTAX Command Synopsis Sending a line feed 0xA or carriage return OxD n or r to ALCAM causes no change in the state of ALCAM Results 100 Final result code This command is useful when a terminal program on a PC is being used over UART to control ALCAM
29. SO U T 0 y 115 Pu Q t 0 n 3 Read Frame second line of result MOSI 2 4 00 0 0 0 MISO B 4 0 oon For a second example the software designer uses one frame for all the results perhaps for efficiency in this case the frames look like this 1 Write Frame N eo lt Z gt MOSI 1 misom 4 4 M M 2 Read Frame MOS 2 0xB00 0 0 0 O O O 00 0 0 MISO U OxB 0 y q V 0 pA 0 n T O 0 n Because ALCAM buffers MISO bytes based on the last data transfer the initial MISO byte of a new frame is designated as undefined Thereafter in a frame where a byte from ALCAM has no significance ALCAM transmits a 1 In the above examples undefined is shown as U Defined insignificant bytes are shown as fl A final note on read frames the 2 and 3 bytes of the MISO side of the SPI transaction is the actual count of data that ALCAM will return this may not be the same as the size that was requested in the Read Frame header For example look at the header of a read request for 10 bytes MOSI 2 0xA 0 MISO W 0x8 0 ALCAM indicates it only has 8 bytes to return The MCU must only read 8 bytes So the entire transaction would look like Page 58 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0
30. a standard 16x16mm LQFP100 The following table is a list of supported pins on ALCAM Pin Name Description Notes 1 BUSY UART_RTS Indicates that the ALCAM is busy 2 DNC Do Not Connect 3 DOMI D4 Camera Data Pin 4 DCMI D6 Camera Data Pin 5 DOMI D7 Camera Data Pin 6 VBAT 1 65V 3 6V for RTC backup typically 3 0V coin cell 7 DNC Do Not Connect 8 OSC32 IN a Rer ond crystal Connect an 18pF capacitor to 9 OSC32 OUT in fant lo crystal Connect an 18pF capacitor to 10 VSS1 Ground 11 VDD1 3 3V Power Connect a 1pF capacitor to ground 12 OSCIN und 12 MHz crystal Connect an 18pF capacitor to 13 OSC OUT und 12 MHz crystal Connect an 18pF capacitor to 14 RESET ALCAM Reset Pull up to VCC 3 3V w 10k resistor 15 DNC Do Not Connect 16 DNC Do Not Connect 17 DNC Do Not Connect 18 DNC Do Not Connect 19 VDD2 3 3V Power Connect a 1pF capacitor to ground 20 VSSA Ground 21 VREF 3 3V Power Page 9 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Pinout Pin Name Description Notes 22 VDDA 3 3V Power Connect a 1pF capacitor to ground 23 Function 12 TBD 24 Function 1 TBD 25 Function 2 TBD 26 LLED2 ALCAM Status Indicator LED 27 VSS2 Ground 28 VDD3
31. ame the file to contain the information length the size of the data that will be sent to ALCAM for the file specified in hexadecimal data stream the data NOTE no newline is sent after data stream IRR Initial result code HHHHHHHH Actual amount of data written to the file IRR Final result code If the initial result code is not 100 ALCAM will not send HHHHHHHH or the final result code The MCU must not send the data stream ALCAM will idle waiting for a command from the MCU If the filename doesn t exist it is created Data is always appended If the file is not open from a previous use of this command it is opened For performance reasons ALCAM buffers data Before removing media shutting down ALCAM or resetting ALCAM the MCU should wait until the final result code is received then close the file F C www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set R open and read bytes from a file F R gt filename Arguments filename the file that contains the desired information The file s data is sent to the MCU The data data stream is a raw stream of bytes Results IRR Initial result code SHHHHHHHH Size of data that ALCAM will send to MCU data stream RR HHHHHHHH bytes of data Followed immediately by the final result code Notes If the Initia
32. ate a configuration file using ALCAM Explorer and save the resulting file to the root of the connected storage media Make sure the configuration is named ALCAM cfg When using standalone mode you will not receive any output over the communication interface nor can standalone mode be controlled that way For example a movie begun in standalone mode can only be stopped using standalone mode In fact standalone mode is disabled when you begin a movie through the command interface Page 53 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Booting ALCAM 8 Booting ALCAM Interface Mode Selection The micro controller circuit can be connected to ALCAM using one of the following interfaces 1 UART 2 SPI 3 12C During initialization after reset or power up ALCAM detects which interface to use by reading SPI SSEL and SPI MOSI SPI SSEL SPI MOSI Interface low low UART low high Bootloader UART high low 12C high high SPI The bootloader is primarily used for firmware updates and can only be accessed using UART The Bootloader chapter explains this in greater detail SPI SSEL and SPI MOSI have internal pull down resistors Page 54 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Booting ALCAM Boot Reset Protocol 1 The MCU holds ALCAM s RESET pin low un
33. cessor User Manual ALCAM Command Set 00000001 320x240 QVGA 00000002 640x480 VGA 00000003 800x600 SVGA 00000004 1024x768 XGA 00000005 1280x720 720 HD B Brightness level of exposure J B Results brightness See below IRR Final result code brightness a value from 00000000 to 0000000A 10 decimal Values above 00000000 represent increased brightness Page 47 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Results ALCAM Command Set O Contrast level J O contrast See below IRR Final result code contrast is a value from 00000000 to 0000000A 10 decimal Each value above 00000000 is a higher level of contrast A Automatic white balance or explicit value J A Results white balance See below IRR Final result code white balance if 00000000 then automatic white balance is in use otherwise a hexadecimal number represents the white balance using Red Green and Blue 00RRGGBB where 00 is undefined The maximum value returned is 00FFFFFF Page 48 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set E Special effect processing J E
34. date and time ALCAM would send back 15 05 45 n2014 12 30 n 00 n The examples in this manual will show this as 15 05 45 2014 12 30 100 ALCAM will accept carriage return r in place of n e Every result returned by ALCAM includes a result code of the form IRR The value 00 signifies no error The result code can be looked up in the Result Codes chapter Most commands have two result codes an initial result code that is immediately sent back to MCU after ALCAM has received a new command and a final result code that comes at the very end of all data transfers to and or from the MCU and ALCAM If the initial result code represents an error the transaction should be terminated Here is an example of a successful File Read operation following that is the same example but with an error F R gt S test txt Page 13 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set 100 initial result code There were no errors data bytes will follow ssssssss 00 Exactly ssssssss bytes are sent followed by the final result code In this case after ALCAM transmits the final result code it goes into an idle state waiting to receive the next command In the case of an initial result code that signals an error ALCAM will go into the idle state immediately after transmitting the error F R gt S test txt 103 Initial result code indicates an
35. e are two requirements for the RTC circuit 1 A 32 768 kHz crystal and 2 A power supply that outputs from 1 65V to 3 6V commonly provided by a 3V coin cell battery The RTC crystal is to be connected to pin 8 OSC32 IN and pin 9 OSC32 OUT External crystal capacitors should be placed in parallel with the RTC crystal and the OSC32 pins A positive power terminal needs to be connected to pin 6 VBAT and a negative power terminal Page 65 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Hardware Design considerations to common ground ALCAM s RTC Crystal Specifications Frequency 32 768 kHz Frequency Tolerance 25 C 20ppm Load Capacitance C 7pF External Input and Output Crystal Capacitors 18pF SD Card Detect Pin 87 SD CD of ALCAM should be connected to the card detect pin of the SD connector to utilize the card detect feature on ALCAM otherwise connect pin 87 to ground if the card detect feature is not implemented Bootloader Access It is recommended to expose the following pins for bootloader access should GHI Electronics release any minor updates and or major firmware upgrades Pin 47 UART TX C SDA Pin 48 UART RX lC SCL Pin 32 SPI MOSI Pin 77 SPI SSEL Pin 14 RESET For more information please review the following sections Interface Mode Selection and The Bootloader Other Components There
36. efault 16 FPS Results IRR Final result code T Set movie mode to Time Lapse M T gt delay gt fps Arguments delay an integer in hexadecimal specifying the time between frame captures DEFAULT is 500ms fps Frames per second an optional hexadecimal number that refers to suggested playback speed It is embedded in the meta data of the video file It does not change the actual frames in the movie file Default 16 FPS Page 30 of 75 www ghielectronics com ALCAM SoC Processor User Manual GHI Electronics LLC ALCAM Command Set Results IRR Final result code Page 31 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set B Begin recording the movie M B gt filename Arguments filename optional the file to contain the information If filename is supplied it should have an appropriate extension Default YYYYMMDD HHMMSS xxx avi Where YYYY is year MM month 01 12 DD day 01 31 HH hours 00 23 MM minutes 00 59 SS seconds 00 59 xxx is an internally generated number 000 999 Precedence of media usage SD card then USB Results IRR Final result code A storage device must be initialized see the Initialization Commands Camera USB SD section C Capture a frame MC This command is used after a stop motion movie has begun ALCAM
37. error ALCAM does not send any bytes of data or the final result code ALCAM goes into the idle state immediately after transmitting the error All numbers sent between the controller and ALCAM are written as strings of hexadecimal digits The digits are encoded using ASCII For example to send the decimal number 16 to ALCAM the string transmitted would be 10 which is the byte value 0x31 ASCII for 1 followed by 0x30 ASCII for 0 Hexadecimal digits A to F must be upper case Numbers sent to ALCAM can be variable length for example the string shown above 10 can be sent as 0010 or 00000010 on the other hand ALCAM normally returns all numbers with a O zero left padded 8 character wide field Most numbers returned by ALCAM will be proceeded by a dollar sign ALCAM is space sensitive For example the Movie Begin command is y op if the MCU sends toe og an error will be returned ALCAM is case in sensitive For example if a command is defined as M B then m B will also be accepted FPS Frames per second refers to suggested playback speed it does not change the actual frames in the movie file It is added as part of the file s meta data Examples Page 14 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set If FPS was set to 30 and ALCAM took a movie in normal video mode consisting of 30
38. frames then when viewed the movie should play in one second If FPS was set to 30 in Stop Motion mode and 90 frames were taken over the course of an hour the playback should be 3 seconds e Filenames take the form device specifier path name Where the device specifier is either U for USB or S for SD card Path is a back slash separated list of directory folder names Examples 1 S my_picture jpg This filename refers to the SD card It will be in the root directory 1 2 U my_picture jpg The filename refers to the USB drive in the root Y directory 3 S rootfolder subfolder my_picture jpg The filename refers to the SD card in the directory rootfolder subfolder e Default Filenames have the format in commands that have an optional filename argument YYYYMMDD HHMMSS xxx Where YYYY is year MM month 01 12 DD day 01 31 HH hours 00 23 MM minutes 00 59 SS seconds 00 59 xxx is an internally generated number that is sequential 000 999 The name is suffixed appropriately for its contents movies avi single shot jpg or bmp If an SD card is connected the file will be there otherwise it will be on the USB drive For Example 20141230_130231_001 jpg If there is both a USB drive and an SD card available the filename refers to the SD card 8 20141230 130231 001 jpg The Get Last Filename command F G will return the last default name used IMP
39. ith R W bit set to zero is sent followed by the stream of bytes ALCAM processes the assembled payload bytes sequentially e Receiving The MCU starts by transmitting ALCAM s I2C address with R W bit set to Page 59 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Booting ALCAM one followed by reading of one or more bytes When a read request is sent to ALCAM and no data is available a No Data token 0x00 is returned This presents a problem when raw data such as file contents contains 0x00 in this case a two byte sequence is used Actual data bytes of 0x00 are transmitted by preceding them with an escape byte OxFF To resolve the problem of differentiating actual data values of OxFF versus its use as the escape byte it is followed by OxFF Actual Data coming from File Data transmitted by ALCAM 0x00 OxFF followed by 0x00 OxFF OxFF followed by OxFF 0x01 OXFE Data is sent as is Important e Atthe I2C level the number of bytes transmitted may not match the actual size of the file contents For example If a file has one byte and this byte value is zero ALCAM will actually send 2 bytes a OxFF followed by 0x00 The 12C interface processing code in the MCU should remove the escape bytes so higher level application code does not have to be aware of this Page 60 of 75 www ghielectronics com GHI Electronics LLC PRELIM
40. l result code is not 00 the command will be terminated neither data stream nor the final result code will be sent If the final result code is not 00 the data in the stream is undefined Arguments None Results C close a file FC IRR Final result code Page 26 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set S get the size of a file F S gt filename Arguments filename the file to get the size of Results IRR Initial result code SHHHHHHHH The size of the file in bytes IRR Final result code See also Get last default file name F G D delete a file F D gt filename Arguments filename the file to delete Results IRR Final result code See also Get last default file name F G G Get last default filename F G Arguments None Results Page 27 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set IRR Initial result code if not 00 rest of data from ALCAM will not be sent SHHHHHHHH The length bytes of the filename in hexadecimal Filename RR The file s name exactly name length characters Immediately followed by a Final result code If Final result code is not 00 Filename name is undefined If the initial result code i
41. lt Codes Result codes are always strings with 2 characters CODE VALUE STRING 00 SUCCESS 01 ERROR UNKNOWN CMD 02 ERROR INCORRECT PARAMETER 03 ERROR OPERATION FAILED 5 ERROR MEDIA FULL 10 ERROR NO OR NOT SUPPORT CAMERA 11 ERROR_CAM_NOT_INIT 12 ERROR INVALID FRAME 13 ERROR BMB SIZE TOO LARGE 14 ERROR INCORRECT CFG LEVEL PARAMETER 16 ERROR OV2640 NOT SUPPORT 17 ERROR AF NOT SUPPORT 18 ERROR AF NOT LOADED 19 ERROR AF ERROR 20 ERROR SD NOT DETECT 21 ERROR SD NOT INIT 22 ERROR OPEN FILE FAILED 23 ERROR INVALID FILENAME 30 ERROR MOVIE NOT RECORDING 31 ERROR MOVIE RECORDING 32 ERROR CMD ONLY IN STOPMOTION MODE 33 ERROR TIMELAPSE DELAY VALUE TOO SMALL 34 ERROR TIMELAPSE DELAY VALUE TOO LARGE 35 ERROR MOVIE NOT ACCEPT BMP FORMAT 40 ERROR USB0 NOT CONNECT 41 ERROR USBO NOT INIT 50 ERROR FILE OPEN FAILED 51 ERROR FILE CLOSE FAILED Page 72 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Result Codes 52 ERROR FILE WRITE FAILED 53 ERROR FILE READ FAILED 54 ERROR FILE NOT OPEN 55 ERROR FILE NOT FOUND 56 ERROR FILE DELETE FAILED OR FILE NOT FOUND 57 ERROR USB SD NOT INIT 58 ERROR LAST FILENAME NOT SAVED 1A ERROR ZOOM LEVEL NOT SUPPORTED Page 73 of 75 www ghielectronics c
42. ncapsulated in an API that is both simple and powerful The API uses standard photography video terminology that is transmitted as compact human readable commands For instance to start taking a movie the ASCII string M B Movie Begin is sent to the module subsequently M E Movie End is sent to to stop the recording and finalize processing of the captured video Movies still pictures and data files can be read by the micro controller MCU connected to ALCAM Standard interface pins for SD card reader writers and or USB Client mass storage devices memory sticks flash storage etc are fully exposed GHI Electronics supplies the ALCAM Explorer software that runs on a PC ALCAM Explorer provides both a GUI and command window for experimenting with ALCAM over a standard USB to UART cable virtual COM port Hardware integration between ALCAM and a controlling processor can be UART SPI or I2C Page 4 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Example Applications 2 Example Applications e Remote visual monitoring real time and or time lapse e Security systems e Automated machinery e Digital picture viewers incorporating built in loading of videos and stills e Point of sale terminal interfaces e Measurement tools and testers e Autonomous multi angle visual systems e Consumer products e Simplifies non IR or dista
43. nce based motion detectors Page 5 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Key Features 3 Key Features e Standard Time Lapse and Stop Motion video modes e Still images e Resolutions 720 HD 1024x768 800x600 640x480 320x240 160x120 e Serial interface choices for command and data I2C UART and SPI e Configuration settings available for brightness contrast white balance special effects sharpness saturation mirror rotate and the image file format e Simple human readable command protocol e Supports OV2640 image sensors e 5V tolerant GPIOs Page 6 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Architecture 4 Architecture ALCAM s firmware and pins directly support control of USB and SD cards The MCU s connection to ALCAM can be UART SPI or 12C whatever is the best fit for the project The circuit design is completed with the designer s choice of lens supported sensor image processor and storage media Commands All communications between the MCU and ALCAM use a well defined serial protocol which is compact and easy to implement Other than the raw data read or written to files Commands and their results are in human readable ASCII This allows for easier development and troubleshooting The simplicity of commands can be
44. om PRELIMINARY 0 02 ALCAM SoC Processor User Manual GHI Electronics LLC Revision History 14 Revision History Rev No Date Modification 02 10 15 Updated supported image resolutions Page 74 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Legal Notice 15 Legal Notice Disclaimer IN NO EVENT SHALL GHI ELECTRONICS LLC OR ITS PARTNERS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEQUENTIAL DAMAGES INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE SPECIFICATIONS ARE SUBJECT TO CHANGE WITHOUT ANY NOTICE GHI ELECTRONICS LLC LINE OF PRODUCTS INCLUDING ALCAM ARE NOT DESIGNED FOR LIFE SUPPORT APPLICATIONS ALCAM is a Trademark of GHI Electronics LLC Other Trademarks and Registered Trademarks are Owned by their Respective Companies Copyright GHI Electronics LLC 2015 Page 75 of 75 www ghielectronics com
45. orage device IRR Final result code Notes This command can take longer than Picture Capture P C as the thumbnail file is produced by taken a small picture before the actual picture Page 23 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual F File Operations ALCAM Command Set COMMAND SYNTAX Command Synopsis F W gt filename gt length data_stream Write stream of bytes to a file FC Close the current open file if any F D gt ilename Delete the file F S filename Get file size F R gt filename Read a file FG Get name of last file created by default The device containing the file must have been initialized see the Initialization Commands Camera USB SD Usage suggestions In addition to reading existing movies and stills this command allows the MCU to store and or read auxiliary information Example uses would be time stamps information from other sensors attached to the MCU data streams from other MCU communication links Ethernet UART CAN WiFi etc Page 24 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set Sub command Descriptions W write bytes to a file F W gt filename gt length data stream Arguments Results Notes Page 25 of 75 filen
46. raa LAT ENN HM 30 N Set movie mode regroupe 31 S SSi MONS made to Stop Motien M SIMS scort ape PEE EO M3 PY SQEMAS EE Ty FOR EYUS ARE ER PO SEED MEAS ER UY UII ed Reds 21 T Selmovie mode to time Lapse M Tedesco O a ii 31 B Begin recording the movie M B gt filename C Capture a frame M C E ipsu ug Get information ona movie file M I fileriame r rrr tab entr t rho etti on etre o 34 T TU ea Date Sellos ad derivados Ra ra di sige eb gba em esa M ESFAE SUR DR ea co anise AE S PRESSE FAR PAE SERO ER NASA RUE Ria 35 dU qoc deco orae cc el 35 Teer Cm leo lo PES 35 S Set date and time T SsBimestampiua ce cesi utis di Rai 36 page msrui eB cqe 36 eR ond e A ia 38 C Configure Came E 39 iE SII ML dM eoa A T EET 40 B Set brightness level O B bilgliffieSs com agere Ger Ra tO US DU HEP RO ONT E rRNA ENERO Au X IS Rees tis Pe oe ec n d eo ea ep 40 O Seteontrastlevel C Oscos p E 41 A Manual or automatic white balance C A gt Wwhite DA ante uoisrinicianic ri cr 41 E Special effect processing E gt speclal et cil 42 A elc EET DT LOO SENT E 42 Mi Mirter ander flip tie image CM sqmiroring OrfertallOl s eacve sec ea sir rt Haee er ere NERE vente Y Eo er 43 T Saturation values C T saturation F Se
47. rage device after the media is inserted for example due to timeouts the MCU can issue the initialize command explicitly and monitor the result with the Read Status command J If errors persist in initializing the media may be bad All commands have the same result syntax Result IRR Final result code The final result code acknowledges that the command has been accepted and the action has been started it does not indicate that initialization has completed Initialization is a blocking operation no other commands will be processed until completion To check for completion issue a command NOP J V etc then wait for the response The initialize SD card command take an optional argument clock Clock allows the card driver to be adjusted to card readers that do not function well at some Page 18 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual speeds ALCAM Command Set Values for clock are 0 24 MHz 1 16 MHz 2 12 MHz the default value 3 9 6 MHz 4 8 MHz ALCAM requires fast data transfer to SD cards At a minimum cards should be class 4 we recommend using cards with class 6 or 10 especially for large resolutions Example IS initialize SD 100 MB begin a movie by default it will be stored on the SD card 100 command succeeded recording is underway ME end a movie 100 success post processing
48. return 00000000 Sub command Descriptions J Read ALCAM Status J The J command returns bit fields describing the current state of ALCAM Results the high level format of the return is Page 45 of 75 www ghielectronics com ALCAM SoC Processor User Manual PRELIMINARY 0 02 GHI Electronics LLC ALCAM Command Set Page 46 of 75 Hexadecimal representation of HHHHHHHH si p the bit fields defined below IRR Final result code Bit Field definitions 7 6 5 4 3 2 1 0 Reserved Current Reserved Reserved Reserved SD Card SD Card Camera Initialized Image Detect Initialized 0 no Format 0 not 0 no 1 yes 0 JPEG detected 1 yes 1 BMAP 1 detected 15 14 13 12 11 10 9 8 Camera USB USB Detected Reserved Reserved Reserved Time Lapse Stop Motion Power Initialized 0 no 0 no 0 no 0 Powered 0 no 1 yes 1 yes 1 yes 1 Power Down 1 yes Mode 23 22 21 20 19 18 17 16 Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved 31 30 29 28 27 26 25 24 Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved S Get frame image size J S Results image size See below IRR Final result code Size value Pixel dimensions Common name 00000000 160x120 QQVGA www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Pro
49. ronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual The Bootloader e The transfer and run commands will ask for confirmation before executing Send Y followed by a carriage return or line feed to confirm e After you confirm the transfer command C s will be printed to the terminal to signal that the device is ready to receive the firmware Page 62 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Hardware Design considerations 10 Hardware Design Considerations WARNING this is preliminary set of instructions DO NOT DESIGN hardware based on this chapter Power Source Main System Power Use a clean and stable power supply of 3 3V We recommend adding 0 1uF capacitors as close as possible to each of the power VDD pins Camera Power A typical camera sensor uses two or three different power supplies depending on which camera sensor is being used Please review your camera sensor s datasheet for more information on which power supplies are needed The required power supplies found on the ALCAM OEM are as followed 2 8V Digital 2 8V Analog Some cameras may also require a 1 8V Digital power supply It is also recommended to add a 1uF capacitor as close as possible to each of the different power pins of the camera interface Isolating the analog ground from the digital ground is also
50. s 58 it signifies that no default filename has yet been used It Useful when the MCU needs to use file commands that require a filename argument Page 28 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual M Movie Operations ALCAM Command Set COMMAND SYNTAX Command Synopsis MN Configure movie to Normal mode default M S gt fps Configure movie to Stop Motion mode M T gt ddd gt fps Configure movie to Time Lapse mode M B gt filename Begin the movie MC Take a frame while in stop motion mode ME End the movie M I filename Get information on movie file Page 29 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set Sub command Descriptions N Set movie mode to Normal MN Normal mode is taking a movie with the fastest rate possible given the current configuration settings For example the size of a frame number of colors in the scene being recorded etc Arguments None Results IRR Final result code S Set movie mode to Stop Motion M S gt fps Arguments fps Frames per second an optional hexadecimal number that refers to suggested playback speed It is embedded in the meta data of the video file It does not change the actual frames in the movie file D
51. s LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual 11 ALCAM OEM ALCAM OEM GHI Electronics offers the ALCAM OEM board that use the ALCAM SoC This board exposes all of the needed signals to interface with ALCAM over UART SPI or I2C and provide a convenient connector for SD The board is easily mountable on existing or new products ALCAM OEM Board The ALCAM OEM Board is designed to allow projects to incorporate the full capabilities of ALCAM SoC with a minimal number of components and the ability for direct human control Features of the ALCAM OEM board include 3 3V regulator input 5V Micro SD card reader Standard 2 5mm remote camera control interface and button for triggering standalone mode Boot mode select pins allowing for firmware updates Standard FFC 24pin 0 5mm pitch sensor connector 2 LEDs to convey camera state Standard 3 3V IO pins On board crystal oscillator for RTC Full speed USB OEM Pinout ALCAM OEM Interface Pin Description 1 GND BUSY 5V UARTS3 RX I2C2 SDA UART3 TX I2C2 SCL SPI MISO NN OO Oo AJOIN SPI MOSI Page 68 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM OEM faris SEM Description nterface Pin 8 SPI CLK 9 SPI SSEL 10 FUNCTION 1 11 FUNCTION 2 1
52. seen with this example which begins recording a movie to a default file Send ALCAM the command MB ALCAM returns the string 100 the 00 the final result code indicates the command was processed with no errors During development this entire command sequence could be executed from a terminal program running on a PC FAT File System Engine The file system engine for the storage media uses FAT file system standards It has been optimized for high performance and reliability Memory Card Access SDHC SD or MMC ALCAM includes a memory card driver that supports SD SDHC and MMC cards This gives ALCAM the ability to access a wide range of memory cards such as standard or high capacity Page 7 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Architecture SD MSD cards or multimedia cards There is no limit on the card capacity Bootloader The bootloader is a small embedded application that e Initializes ALCAM e Verifies and launches the ALCAM firmware e Provides an interface for firmware updates The bootloader is accessed through the UART port It uses XMODEM 1K to transfer the firmware file to ALCAM The Bootloader chapter explains this in detail Page 8 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Pinout 5 Pinout The ALCAM SoC package is
53. sult code T Saturation values C T gt saturation Arguments saturation a value from O to 8 Numbers above 0 correspond to increasing levels of saturation Default 0 Results IRR Final result code Page 42 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual ALCAM Command Set F Set image data format C F gt image format Arguments image format one of J or B J for JPEG and B for BMAP Default J Results IRR Final result code Note Most configuration commands have a corresponding Get Configuration command in this case the command would be J F However the current image format is part of the Get Status Register command J with no sub command letter W Write current configuration to non volatile storage C W Arguments None Results IRR Final result code Note Configuration changes are temporary to establish a configuration that will be used after reset set the desired values then use this command D Restore factory defaults C D Arguments None Results IRR Final result code Note This removes any changes that were stored with the Write Configuration command C W Page 43 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Arguments ALCAM Command Set Z Zoom levels
54. t 63 DNC Do Not Connect 64 DNC Do Not Connect 65 SD DO SD Card Data Pin 66 SDD1 SD Card Data Pin 67 MCO4 24 MHz Signal Output Connect to Camera Master Clock pin if not using external 24 MHz crystal for camera sensor 68 DCMI DO Camera Data Pin 69 DCMI D1 Camera Data Pin Pull up to VCC 3 3V w 10k resistor 70 Function 10 TBD USB D Connect a 220 resistor to MCU D pin 71 Function 11 TBD USB D Connect a 220 resistor to MCU D pin 72 Function 3 TBD 73 VCAP2 Connect a 2 2uF capacitor to ground 74 VSS3 Ground 75 VDD5 3 3V Power Connect a 1pF capacitor to ground Page 11 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Pinout Pin Name Description Notes 76 Function 4 TBD 77 SPISSEL PEE E Interface to External MCU Boot mode 78 SDD2 SD Card Data Pin 79 SDD3 SD Card Data Pin Pull up to VCC 3 3V w 10k resistor 80 SD CLK SD Card Clock Pin 81 DNC Do Not Connect 82 DNC Do Not Connect 83 SD CMD SD Card Command Pin 84 DNC Do Not Connect 85 DNC Do Not Connect 86 Camera RESET Camera Reset Pin 87 SDCD SD Card Card Detect Pin 88 DNC Do Not Connect 89 DNC Do Not Connect SPI Master In Slave Out Interface to External MCU and UART 90 SPI MISO UART CTS CTS signal to MCU Connect to ground if not using UART handshaking 91 PB5
55. t image data format C F gt image format W Write current configuration to non volatile storage C W arreter ta 44 D Restore factory defaults Divan is A A a 44 Za LOW LALO AEE DIRAN NAAA EIA NEAL 45 DARE AGS a NUS ING CONO Na E PM rne este ud dpt EE A pueden a sed Fo pud on ep RS DH A E oM Eel di mu AMER S 46 J Read ALCAM Status 46 S Get Wame iMAage SIZEE IS e AAi 47 B Brightness level ar exposure J Binion nan iiaia iasad idikia iadi aii 48 O Contrast leveli Oiss 49 A cAutomaue wbite balance or expat vale JA oasis rm RS A AAA RAA S EAS AE N AA E 49 Special Sect processing dE casadas TENE INO N 50 Ie RIPE e Md MEE EL D D NE PE EN 50 Mi Mirror and or Orientation setting Mica riadas 51 DESCUUCUECIU 51 Lia 51 K Get Fies A e pp rub bodies pen rue RED Prod rM e Lipa pe nus DU HRS E BU eEpd 52 eec Baud RAIE eR E 53 nuege iuste ET 53 Page 2 of 75 www ghielectronics com GHI Electronics LLC ALCAM SoC Processor User Manual Table of Contents Ts mo CCA NONI VO usa sois cosa RH ERES SQUREEE EUER Ru M VR DDR LRL paussundaueasceaasaeasstanenccnasedsemaukees T S 54 8 Booting ALCAM
56. t supported a failure most often occurs at initialization command Less often rarely the media will initialize but then have problems with reading and or writing If the media mounts with no errors in most cases it is safe to assume it will function normally Make sure the power source to the media is reliable and there is a large enough capacitor placed as close as possible to the media connector We recommend adding 0 1uF and 22uF Low power may result in slower performance SD cards are rated for speed ALCAM can work with Class 4 cards however Class 6 or better yet Class 10 will perform the best File Access Speed There are many factors that affect file access speeds Some storage media devices have internal buffering others have high speed rating But even on the exact same media speeds might differ between different tests Factors such as fragmentation media life and voltage may affect the speed on the same media Fragmented storage runs slower because the system needs to spend more time or even read more sectors from the FAT table to find the needed cluster Formatting the media should take care of this fragmentation Also storage access speed decreases when the storage get closer to the end of life The time needed to erase sectors increases over usage time Page 71 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual 13 Result Codes Resu
57. tart the ALCAM to use the new values If it is blinking once per second it means the configuration failed to update The configuration will reset to the defaults once you restart the ALCAM Push Button and 2 5mm Jack The ALCAM OEM board has a push button and 2 5mm remote camera trigger jack The push button and a hard press of the remote trigger are both connected to function 5 standalone mode The light press of the remote trigger is connected to function 12 and is currently not implemented Page 70 of 75 www ghielectronics com GHI Electronics LLC PRELIMINARY 0 02 ALCAM SoC Processor User Manual Performance 12 Performance Selecting the right storage media The current storage media market is flooded with low grade devices These devices may work with a PC but that doesn t mean the device follows standards and will work with ALCAM Also other devices may have advanced features not suitable for embedded devices For example some USB memory drives have a built in USB hub We make our best effort to support a wide range of storage media that follow published standards But GHI Electronics does not guarantee that ALCAM will be able to access all storage media For products using ALCAM SoC it is important to test different media devices Then maintain a list of supported media for a product GHI Electronics does not recommend any specific brand but always recommends selecting a well known source If media is no
58. til the power is stable The MCU sets SPI SSEL and SPI MOSI to indicate which bus is chosen as shown in the table above After the interface selection pins are set the MCU sets RESET high The RESET pin is NOT 5V tolerant 4 The MCU delays for a time allowing ALCAM to initialize described below 5 If the UART interface is selected ALCAM samples samples SPI SCK If this pin is pulled low the UART baud rate will be 9600 otherwise it will be 115200 baud ALCAM sends the MCU a banner string which should be read to synchronize with ALCAM The total time from reset until ALCAM sends its banner consists of the following ALCAM configures itself approximately 50uS It initializes the camera equivalent to the C command approximately 500 ms If present it initializes the USB I B and SD Card I S due to differences in external devices this time is variable The total time could be anywhere from 2 to 10 seconds The MCU can begin checking for ALCAM s banner after approximately 50uS UART Interface Mode The UART interface uses four hardware signals 1 UART TX data sent from ALCAM to the controller UART RX data sent from the controller to ALCAM 3 UART CTS pin for data for control The MCU sets this pin low when it is ready to receive data UART RTS pin also known as the BUSY pin indicator pin for data flow control While high no data should be sent from MCU to ALCAM Page 55 of 75 www ghielectronics com

Download Pdf Manuals

image

Related Search

Related Contents

ASUS M5A97 User's Manual  家計における資産構成の在り方について      ダウンロード  iStarUSA DAGE840DE1BK-2MS disk array  Philips 40PFH6510 Android rendszerű Full HD LED televízió  Introduction:  quad screen 8 channel dual page real time 2x zoom time  Software Development Times Magazine  

Copyright © All rights reserved.
Failed to retrieve file