This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bootstrap Loader Question - Access to general purpose IO

We have bootstrap loader code as shown below:<br>
<br>

void far vMainFunction(void)
/*******************************************************************************
Description:  This the start of the code
Inputs:	 NONE
Outputs:	 NONE
Globals:  NONE
*******************************************************************************/
{
   BYTE bLastByte;
   WORD uRamData;
   WORD *puRamPtr;             // use 16 bit values
   BYTE idata *pbIramPtr;


#pragma asm
   ADDRSEL1 DEFR     0FE18H

   DISWDT                // Disable watchdog timer

   MOV	SYSCON,#6184H   // Stack size = 32 words, XRAM enabled
   NOP
	MOV	DPP0,#0         // Set the data page pointer to point at 1st 4 pages
	MOV	DPP1,#1	       // which is all of internal memory
	MOV	DPP2,#2
	MOV	DPP3,#3
   NOP
   MOV  ADDRSEL1,#0403H	 // CS1 active starting at 04'0000 (RAM)
   NOP
   MOV  BUSCON0,#04AFH	 //  CS is independent of write
   NOP
   MOV  BUSCON1,#04AFH	 // CS is independent of write
	EINIT
#pragma endasm

   // Set RS232 baudrate reload register,
   // Baud Rate = 20MHz / (16*2*[S0BG+1]). See (page 10-11) of Siemens C167
   // Derivatives
   S0BG = 0x001F; // Baud Rate = 19.5264 KBaud

   /// Configure the serial link for:
   //  8-bit data asynchronous operation
   /// one stop bit
   /// divide clock by reload value + constant
   /// Disable receiver
   S0CON = 0x0011;

   // Setup the Rs232 output port
   P3   |= 0x0400;     // set P3.10 output latch (TXD0)
   DP3  |= 0x0400;     // set P3.10 direction control (TXD0 output)
   DP3  &= 0xF7FF;     // reset P3.11 direction control (RXD0 input)

   // Enable the RS232 receiver
   S0R = 1;

   // Set ptr to start RAM address -> 0x40000
	puRamPtr = (WORD *) RAM_START;

   // Check RAM -> 0x40000 - 0x40800
   for ( puRamPtr = (WORD *) RAM_START, bLastByte = 0;
         puRamPtr <= RAM_END; puRamPtr++, bLastByte += 2 )
	{
      // Store a pattern of n+1, n.  For example; 0x01, 0x00
      uRamData = bLastByte + ( (bLastByte + 1) << 8 );

      // Put the WORD pattern into RAM
	   *puRamPtr = uRamData;

      // See if the pattern was stored
		if (*puRamPtr != uRamData)
		{
         // RAM did not hold pattern, flag fault and lockup
         putbyte(RAM_MEMORY_ERROR);
	      putbyte(0x5A);
         while(1);
		}
	}

   // RAM test passed, send indicator that FLASH loader download can begin
   putbyte(RAM_MEMORY_TEST_OK);

   // Load XRAM code -> continue loading FLASHLDR.SRE YES - ITSELF !
   // This code loads all the code in FLASHLDR.C
   // The code is loaded to XRAM which is internal memory
   for ( pbIramPtr =  (BYTE idata *)XRAM_START;
         pbIramPtr != (BYTE idata *)XRAM_END; pbIramPtr++ )
   {
      // Wait for a byte to come in on the serial port
      while (! S0RIR);

      // Store the byte in XRAM
      bLastByte = S0RBUF;
      *pbIramPtr = bLastByte;

      // See if the byte was stored correctly
      if (bLastByte != *pbIramPtr)
		{
         // Store failed, send XRAM error and lockup
			putbyte(XRAM_WRITE_ERROR);
			while(1);
		}

		// Clear receive interrupt flag
		S0RIR = 0;
	}
// Send the date and time through the serial port
vSendDateAndTime();

   // Running XRAM code, send write ready on the serial port
   putbyte(FLASH_MEMORY_WRITE_READY);

   // Erase the Flash, loaded by the code above
   vEraseFlash();

   // Program the Flash
   vProgramFlash();

   // Should never get here as software reset called in earlier process
   while(1);

}/* vMainFunction() */
<br>
We would like to access general IO pins P3.5,<br>
P3.6, and P3.7 during the loading process. We would like access to those pins so that we can communicate with a clock calendar chip.<br>
<br>
My question is as follows: during boot strap loading, are the general IO pins accessible or not? I can't seem to get access to the pins through the boot load functions (looking at the pins with a scope I see nothing happening...)<br>
<br>

void vSendDateAndTime( )
/*******************************************************************************
Description:  This routine sends the date from the calendar chip to the serial
              port transmitter, waiting for the port to empty before sending the
              next character.
Inputs:	NONE
Outputs:	NONE
Globals: NONE
*******************************************************************************/
{
   BYTE bIndex;

   /* Initialize the calendar port I/O lines */
   vInitCalendarPorts();

   /* Read in the date from the calendar port */
   vGetBcdDate( );

   /* Send the date through the serial port */
   for (bIndex=0; bIndex<=5; bIndex++)
   {
      vSendByte( bIndex );
   }

}/* vSendDateAndTime() */


void vInitCalendarPorts(void)
/*******************************************************************************
Description:   This function initializes the EC300 port lines which interface
               with the calendar chip.
Inputs:  NONE
Outputs: NONE
Globals: NONE
*******************************************************************************/
{
   /* Set the cal reset line (P3.7) as a push-pull input */
   P3 &= CAL_RESET_OUT_LOW;
   ODP3 &= CAL_RESET_PUSH_PULL_MODE;
   DP3 &= CAL_RESET_INPUT;

   /* Set the cal io line (P3.6) as an open drain ouput, set output high */
   P3 |= ~CAL_IO_OUT_LOW;
   P3 |= ~CAL_IO_PUSH_PULL_MODE;
   P3 |= ~CAL_IO_INPUT;

   /* Set the cal clock line (P3.5) as a push-pull output, set output low */
   P3 &= CAL_CLK_OUT_LOW;
   ODP3 &= CAL_CLK_PUSH_PULL_MODE;
   DP3 |= ~CAL_CLK_INPUT;

}/* vInitCalendarPorts() */

0