WinAVR do not want to work with USART1 Atmega644

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys.
When compiling project for Atmega644 faced with the problem.
For example

#include 
int main(void)
{   
   UCSR1B |= (1<<RXEN1)|(1<<TXEN1);

   while(!(UCSR1A & (1<<UDRE1)));
   UDR1='a';
}

WinAVR-20100110 shows an error ".. / Temp.c: 5: error: 'RXEN1' undeclared (first use in this function)".
I check the necessary libraries with definitions iom644.h, iomxx4.h. They correct and connected. For USART0 (UCSR0B, ...) everything goes smoothly.
For Atmega644p return this kind of error "c: / winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr5/crtm644p.o: file not recognized: File format not recognized ". For lower controllers 164/324/p there is no problems.
Makefile - automatic from the studio 4.16.
Need a hint.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
WinAVR-20100110 shows an error ".. / Temp.c: 5: error: 'RXEN1' undeclared (first use in this function)"

The above is an error message from the compiler (due to a coding error on your part), while this
Quote:
c: / winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr5/crtm644p.o: file not recognized: File format not recognized

is an error from the linker.

The errors are totally unrelated. The latter hints at the file crtm644p.o being corrupted.

Try reinstalling WinAVR.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you have the M644 or the M644p chip? Have you selected the correct one from the dropdown menu? As you may know the M644 doesn't have a second USART but the M644p does.

edit just to confirm I rebuilt a M164p project with the M644p and there is no issues with either USARTs.

Studio 4.18 SP3, winAvr 20100110

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Johan. I know difference between linker and compiler. I've already try to reinstall WinAVR - the same result.
My mistake with M644 :( I downloaded documentation on M644p and was thinking that USARTs are same. But steel there is an linker error in *.o.
The thing is that on the "totally clean" other computer this error also occurs with WinAVR2010+4.16.
Both OS WinXP_SP3_2600.
WinAVR2008+4.16 works fine on both computers.
Mystery.
Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just tried avr-readelf -a with \winavr2010\avr\lib\avr5\crtm644p.o and it reads OK. For the record my one's MD5 is as follows:

E:\WinAVR-20100110\avr\lib\avr5[i386_vc]>for %a in (crtm644*) do md5sum %a

E:\WinAVR-20100110\avr\lib\avr5[i386_vc]>md5sum crtm644pa.o
41e69cb3e961ba85bae2ce493c6f2da0 *crtm644pa.o

E:\WinAVR-20100110\avr\lib\avr5[i386_vc]>md5sum crtm644.o
16bdc9634b21ca978a63f2c7036322eb *crtm644.o

E:\WinAVR-20100110\avr\lib\avr5[i386_vc]>md5sum crtm644p.o
41e69cb3e961ba85bae2ce493c6f2da0 *crtm644p.o

E:\WinAVR-20100110\avr\lib\avr5[i386_vc]>md5sum crtm644a.o
41e69cb3e961ba85bae2ce493c6f2da0 *crtm644a.o

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

lets recap.
you use teh Mega644 and NOT the Mega644P
if that is the case, there is NO uart1 so you will get an error from the compiler that the register ending with a 1 does not exist.
If you use the P version the registers ending with a 1 do exist and should be usable.

Did you check in the project options ( not the programming window) that you have selected the correct device?

regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mega644P

## General Flags
PROJECT = Temp
MCU = atmega644p

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
WinAVR2010+4.16.
You may just be asking for troubles with an old version of Studio and the newer version of winAvr.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Problem solved. AVR Studio 4.19 + WinAvr2010 (with manualy "/bin/avr-gcc.exe", "utils/bin/make.exe"). Last couple years I was renew WinAvr from sourceforge, and AVR Studio... well, there was no problems. That is why 4.16 + 2010.
A have another question - what with this Toolchain in/and 4.19? Is it WinAVR? Will I need to remake my existing projects due to its ... I do not know ...defferences?
Definitely I am not grown enough for AVR Studio 5.0 :-)

Last Edited: Tue. Jan 17, 2012 - 12:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is no "toolchain in 4.19", only an assembler. You install the compiler yourself - either WinAVR (working) or Atmel AVR Toolchain (just not working) - you are to decide :lol:

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I am not grown enough for AVR Studio 5.0
You WILL be by the time it works well.. :mrgreen:

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js wrote:
Quote:
I am not grown enough for AVR Studio 5.0
You WILL be by the time it works well.. :mrgreen:

lets hope we're not all in retirement when that happens....