Hi
I am using Atmel studio 7 1417.
I am using a ATmega1284P
I am trying to get the USART in SPI master mode.
I copied the following code from the datasheet:
void USART_Init( unsigned int baud ) { UBRRn = 0; XCKn_DDR |= (1<<XCKn); // changed this with my own names in my example UCSRnC = (1<<UMSELn1)|(1<<UMSELn0)|(0<<UCPHAn)|(0<<UCPOLn); UCSRnB = (1<<RXENn)|(1<<TXENn); UBRRn = baud; }
as I am using USART0 for that, I replaced all the lower case 'n' s with '0'
and all the defines then are OK except for 1 that is not recognised "UCPHA0"
in the datasheet it looks exactly the same:
If on the UCSR0C register I click on "Goto implementation"
the file "iom1284p.h" opens and I jump to the USCR0C register, and there the following is described:
#define UCSR0C _SFR_MEM8(0xC2)
#define UCPOL0 0
#define UCSZ00 1
#define UCSZ01 2
#define USBS0 3
#define UPM00 4
#define UPM01 5
#define UMSEL00 6
#define UMSEL01 7
This does not match the datasheet.
Am I missing something here ?
or is this a thing that should be raised as a bug to atmel/microchip?
for now I will workaround adding "#define UCPHA0 1" to my code but that should in my opinion not be needed, so something is not right.