[En-Nut-Discussion] U R G E N T !!! Ethernut 1 -using PORTF
    Henrik Maier 
    hmlists at focus-sw.com
       
    Mon Mar 10 06:32:57 CET 2008
    
    
  
> -----Original Message-----
> disable your programmer. Right now I can't find the right register name,
> but you should disable JTAG in your application. This way it is enabled
> again after pressing reset.
> 
> Harald
>
The register concerned is the JTAG_REG and the bit is the JTD bit.
That's the code sequence I use to turn off JTAG by software (not fuse bits!)
and to read from port F into the variable "reg":
void postExecute()
{
   uint8_t reg;
   ...
   //
   // Disable JTAG for a short moment
   //
   cli();
   DDRF |= 0xF0; // Make them inputs
   PORTF |= 0xF0; // Enable pull-up
   __asm__ __volatile__(
      "in r24, %0"  "\n\t"             
      "ori r24, 1 << %1" "\n\t"        
      "out %0, r24" "\n\t"             
      "out %0, r24" "\n\t"
      "nop" "\n\t"
      "nop" "\n\t"
      "nop" "\n\t"
      "nop" "\n\t"
        :                              
        : "i" (_SFR_IO_ADDR(JTAG_REG)), 
          "i" (JTD)                    
        : "r24"                        
    );
   reg = PINF;
   __asm__ __volatile__(
      "in r24, %0"  "\n\t"             
      "andi r24, ~(1 << %1)" "\n\t"    
      "out %0, r24" "\n\t"             
      "out %0, r24" "\n\t"             
        :                              
        : "i" (_SFR_IO_ADDR(JTAG_REG)), 
          "i" (JTD)                    
        : "r24"                        
    );
   sei();
   ...
}
Use at your own risk! 
Cheers
Henrik
http://www.proconx.com
    
    
More information about the En-Nut-Discussion
mailing list