Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/05/03 16:08
Read: times


 
#38319 - To Erik : NoTouch
Hi Erik,

I've some troubles to implement the NoTouch feature in my code.

Below is what I've wrote. Note that the UART routine works correctly and when writing 'boot' with HyperTerminal, the '.' is returned and then the GoToBoot function should be called. Then, my code seems to stop but I can't download any code using FlashMagic. I've still to reset manually.

The code below is part of my UART.C code. I've been inspired from the FlashMagic sample for bootcode. The GoToBoot prototype is declared in the UART.H file as 'extern void GoToBoot(void);'
// the command which will place the device into BootROM mode
const char code bootrom_init_cmd[] = "boot";
// pointer used to keep track of how much of the command has been received
const char code *pcmd = bootrom_init_cmd;

/*******************************************************************************/
/* 			        PROGRAM CODE				       */
/*******************************************************************************/  

/*-------------------------------------------------------------------------------
Interrupt routine
	void uart_isr (void)
-------------------------------------------------------------------------------*/
void uart_isr (void) interrupt 4 using 1
{
	if (RI != 0)		/* Received data interrupt */
  	{
  		RI = 0;		/* Clear interrup flag */
		if (SBUF == *pcmd)
			{
     			// echo character
     			while (TI !=0);
  	  		TI = 0;
	  		SBUF = *pcmd;
			
		  	// move to next character in command
		  	pcmd++;
		  	
		  	// if null terminator reached then whole command received
		  	if (!*pcmd)
	 	  	{
		    		// echo '.' to indicate success
		    		while (TI !=0);
				TI = 0;
				SBUF = '.';
				// disable interrupts
		    		//EA = 0;
	        		GoToBoot();
		  	}
		}
		else
		{
	      		// character received wasn't next character in command
			// so start over again
      			pcmd = bootrom_init_cmd;
			// application processing of serial input goes here
		}
  
  		if ((u8ReceiveIn + 1) != u8ReceiveOut)
    		au8ReceiveBuffer [u8ReceiveIn++] = SBUF;
    	}



The GoToBoot function is :
AUXR1	DATA	0A2h;
WDTRST	DATA	0A6h;

	PUBLIC	GoToBoot

BOOTIT	SEGMENT CODE

	RSEG	BOOTIT

GoToBoot:
	mov 	AUXR1,#020h	; enable boot
	mov 	r0,#18		; oscillator freq=18MHz
	mov 	r1,#6h		; program status byte
	mov 	dptr,#0		; specify status byte
	mov 	a,#0ffh		; non zero required
	call 	0fff0h   	;
	jmp 	$	        ; wait for watchdog reset

	end

The OBJ file is linked in my project.
Note that my crystal is 18.432 MHz. I don't understand where you set the bootvector to 0xFC in the code above ??? Concerning the watchdog timer, is it launched by 'CALL 0fff0h' ?

As I'm loosing my bootvectors nearly as quickly as I'm testing my code, I'm affraid to have no remaining microcontroller before ending debugging this code. Per wouldn't like to program again my chips !!
Your comment would be appreciated.

Regards
Stephane



List of 21 messages in thread
TopicAuthorDate
To Erik : NoTouch            01/01/70 00:00      
   RE: To Erik : NoTouch            01/01/70 00:00      
      RE: To Erik : NoTouch            01/01/70 00:00      
      Actually necessary signals to ISP /NOTOU            01/01/70 00:00      
         RE: Actually necessary signals to ISP /NOTOU            01/01/70 00:00      
   RE: To Erik : NoTouch            01/01/70 00:00      
      RE: To Erik : NoTouch            01/01/70 00:00      
         RE: To Erik : NoTouch            01/01/70 00:00      
            RE: it works !            01/01/70 00:00      
               RE: it works !            01/01/70 00:00      
                  RE: it works !            01/01/70 00:00      
         RE: To Erik : NoTouch            01/01/70 00:00      
            RE: To Erik : NoTouch            01/01/70 00:00      
               RE: To Erik : NoTouch            01/01/70 00:00      
                  RE: To Erik : NoTouch            01/01/70 00:00      
                     RE: To Erik : NoTouch            01/01/70 00:00      
                        RE: To Erik : NoTouch            01/01/70 00:00      
                           RE: To Erik : NoTouch            01/01/70 00:00      
                              RE: To Erik : NoTouch            01/01/70 00:00      
            RE: To Erik : NoTouch            01/01/70 00:00      
               RE: To Erik : NoTouch            01/01/70 00:00      

Back to Subject List