[En-Nut-Discussion] U R G E N T !!! Ethernut 1 -using PORTF

Henrik Maier hmlists at focus-sw.com
Tue Mar 11 00:28:44 CET 2008


That happens when you publish code snippets out of longer code, I forgot to
include the definitions.

There is a define further up which defines the JTAG_REG depending on the
type of CPU:

#if defined (__AVR_AT90CAN128__)
#  define JTAG_REG MCUCR
#else
#  define JTAG_REG MCUCSR
#endif

Henrik
http://www.proconx.com

> -----Original Message-----
> From: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-
> bounces at egnite.de] On Behalf Of Alexander Baranov
> Sent: Tuesday, 11 March 2008 3:24 AM
> To: Ethernut User Chat (English)
> Subject: Re: [En-Nut-Discussion] U R G E N T !!! Ethernut 1 -using PORTF
> 
> Hello, Henrik.
> Where does the     _SFR_IO_ADDR(JTAG_REG   come from? My WinAVR-2005
> compiler does not see it.
> Alexander.
> 
> 
> ----- Original Message -----
> From: "Henrik Maier" <hmlists at focus-sw.com>
> To: "'Ethernut User Chat (English)'" <en-nut-discussion at egnite.de>
> Sent: Monday, March 10, 2008 1:32 AM
> Subject: Re: [En-Nut-Discussion] U R G E N T !!! Ethernut 1 -using PORTF
> 
> 
> >> -----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
> >
> >
> >
> > _______________________________________________
> > http://lists.egnite.de/mailman/listinfo/en-nut-discussion
> >
> 
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list