[cpia] IEEE 1284 Negotiation and Termination

J114(G.M.REYNOLDS) G.M.REYNOLDS@bham-eee-fs4.bham.ac.uk
Mon, 18 Feb 2002 19:58:48 -0000


Hi,

I am trying to connect a Creative Video Blaster II to a Mitsubishi M16C
microcontroller.

So far I have got as far as receiving the ID string in nibble mode.

I then try to negotiate ECP mode. This appears to work (all the status lines
change accordingly).

I then send the GetCameraStatus command to the camera. This appears to clock
through (all data lines change accordingly).

I then terminate the 1284 mode. One of the status lines does not change
here. I have included by code below. Any help is really appreciated.


 /* end the 1284 nibble mode transfer - works up to here!! */
  Camera_End1284(); 

/* now take the camera into ECP transfer mode */
  Camera_GotoECPMode();
  Camera_SendECPCommand(GET_CAMERA_STATUS);  

/* doesn't get passed this bit */
  Camera_End1284();


Definitions of my functions:

void Camera_GotoECPMode(void)
{
  ECP_DATA_OUT;
  ECP_DATA = REQUEST_ECP;
  ECP_SELECTIN_ON;
  ECP_AUTOFEED_OFF;
 
  while( ECP_ACK == true );
  while( ECP_PE == false );
  while( ECP_ERROR == false );
  while( ECP_SELECT == false );
   
  
  ECP_STROBE_OFF;
  sleep(PULSE_DELAY);
  
  ECP_AUTOFEED_ON;
  ECP_STROBE_ON;

  while( ECP_PE == true );
  while( ECP_ERROR == true );
  while( ECP_SELECT == false );
  
  while( ECP_ACK == false );

  /* we are now in ECP transfer mode for forward and backward direction */
g_ECPMode = true;

}

/* send a command to the camera - does all IEEE 1284 overhead when sending
command */
void Camera_SendECPCommand(unsigned char ucCommand)
{ 
  assert( g_ECPMode == true );

  ECP_DATA_OUT;  
  
  ECP_AUTOFEED_ON;
  ECP_SELECTIN_ON; 
  ECP_INIT_ON;
  
  ECP_AUTOFEED_OFF;
   
  //sleep(10000); 
     
  while ( ECP_PE == false );
  
  while ( ECP_ACK == true );
    
  ECP_STROBE_OFF;
   
  sleep(PULSE_DELAY);
  
  ECP_STROBE_ON;
  
  ECP_AUTOFEED_ON;
  
  while( ECP_ACK == false );
  
  ECP_AUTOFEED_OFF;

  //  while ( ECP_PE == false );
  
  sleep(PULSE_DELAY);
  
  ECP_AUTOFEED_ON;

  ECP_STROBE_OFF;  
    
  while( ECP_BUSY == true );
  
  // got here so ok to send command 
  ECP_DATA = ucCommand; 
 
  ECP_STROBE_ON;
  
  sleep(PULSE_DELAY);
  
  ECP_STROBE_OFF;
}

-- end of code --

The information for sending the ECP command comes from the data sheet.
Perhaps I have interpreted it incorrectly. I have also tried to correlate it
to the source for the DOS driver.

If you can see what's wrong, or can give me a summary of the process of
negotation, sending, termination and receiving I would be appreciative.

Cheers.

Greg.