Chris Carl

Trouble interfacing with camera

Discussion created by Chris Carl on Apr 22, 2010
Latest reply on Apr 26, 2010 by bigmac

Hey Guys,

 

I'm trying to interface with the C328R JPEG camera module through UART with the mc9s12dt256 and codewarrior 5.9.

The protocol is to send a SYN message to the camera that is the following 6 bytes:  AA 0D 00 00 00 00

Once it connects with the camera, it sends an ACK message to verify.  My problem is that i send the SYNC message continually and never get an ACK message.  I debug it and set a breakpoint at the start of the ISR for the rx line, but the program runs forever and the interrup never gets generated.  Here is the code i have doing this.  Do you have any suggestions?  Also, remember this is just to test and see if i can get aANY data to send from the camera, i can't get t he interrupt to generate at all.

 

            ORG  $FFD6            ; SCI0 interrupt vector setup
        DC.W SCI0ISR

 

MyCode:     SECTION
main:
_Startup:
Entry:      LDS  #__SEG_END_SSTACK  ; initialize the stack pointer

            ldaa      #$00
            staa      SCI0BDH
           ldaa      #$09          ; Baud Rate 14,400
            staa      SCI0BDL       ; = 1/2 of the Bus Clock of 4 MHz

            ldaa      #$2C
            staa      SCI0CR2     
          
            cli
            jsr       cameraConnection  ; connect to the camera.

 

cameraConnection
            jsr     sendSYNC     
            bra     cameraConnection

 

sendSYNC
       
            ldaa    #$AA
            jsr     putchar
            ldaa    #$0D
            jsr     putchar
            ldaa    #$00
            jsr     putchar
            jsr     putchar
            jsr     putchar
            jsr     putchar
                        
            rts

 

putchar     brclr SCI0SR1,#%10000000,putchar   ; wait for transmit buffer empty
            staa  SCI0DRL                       ; send a character
            rts

 

SCI0ISR    
            brclr   SCI0SR1, %00100000, SCI0ISRdone
            ldaa    SCI0DRL
            jsr     putchar                      
           
SCI0ISRdone
             RTI

 

 

sendSYNC

            ldaa    #$AA
            jsr     putchar
            ldaa    #$0D
            jsr     putchar
            ldaa    #$00
            jsr     putchar
            jsr     putchar
            jsr     putchar
            jsr     putchar
                        
            rts

Outcomes