| Author |
Message |
|
|
Posted: Feb 24, 2012 - 06:20 PM |
|

Joined: Jan 16, 2007
Posts: 124
|
|
Hi All,
Im working with a fresh copy of AVR Studio 5.1, new project for AVR GCC with device AT90USB1287.
When I try to set things in code like UBBRHL0 or any register like that, I get compile errors, even for something simple like:
Code:
UBBRL0 = 0;
Code completion is also broken for registers UBBRL, etc...
However, if I go into project setting and change the device to for example an ATMega168, then code completion works and it compiles fine. Change it back and everything is broken again.
Any ideas?
Thanks,
Dan |
|
|
| |
|
|
|
|
|
Posted: Feb 24, 2012 - 06:25 PM |
|


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
Your 0 is in the wrong place. Atmel put the UART (or whatever) instance number BEFORE any H or L to show high/low byte splits. Try:
Code:
UBRR0L
|
_________________
|
| |
|
|
|
|
|
Posted: Feb 24, 2012 - 06:48 PM |
|

Joined: Jan 16, 2007
Posts: 124
|
|
Thanks clawson,
I really wish it was that simple, I've tried every variant of that and other registers, and it still wont compile or code complete. Of note, I have always coded UBRR0L, but the 1287 data sheet specifies UBRRLn, so when code compleation didnt work and it would not compile I tried it in that format. Just changed it back to UBRR0L and tried to compile, still fails.
Here is my code:
Code:
#include <avr/io.h>
int main(void)
{
UBRR0L = 0;
while(1)
{
//TODO:: Please write your application code
}
}
And the error I get:
Code:
Error 1 'UBRR0L' undeclared (first use in this function) C:\Projects\USBScaleHost\AVRGCC1\AVRGCC1\AVRGCC1.c 5 2 AVRGCC1
When I change the device for the project to a ATMega168 and rebuild, it compiles. Change the device back to a AT90USB1287 and compile, then it fails again.
Thanks |
|
|
| |
|
|
|
|
|
Posted: Feb 24, 2012 - 06:53 PM |
|


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
This would seem to suggest those chips only have UART1:
Code:
C:\Program Files\Atmel\AVR Studio 5.1\extensions\Atmel\AVRGCC\3.3.1\AVRToolchain\avr\include\avr>grep UB iousbxx6_7.h
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
#define TCN2UB 4
#define OCR2AUB 3
#define OCR2BUB 2
#define TCR2AUB 1
#define TCR2BUB 0
/* Combine UBRR1L and UBRR1H */
#define UBRR1 _SFR_MEM16(0xCC)
#define UBRR1L _SFR_MEM8(0xCC)
#define UBRR1H _SFR_MEM8(0xCD)
|
_________________
|
| |
|
|
|
|
|
Posted: Feb 24, 2012 - 06:55 PM |
|

Joined: Jan 16, 2007
Posts: 124
|
|
Thank you, I really don't know how I overlooked that.
Kinda feel like an idiot right now, must be having a bad day.
Thanks for the help!
Dan |
|
|
| |
|
|
|
|
|