Moin,
versuche gerade vom ATXMEGA256A3BU den SPI vom USARTD0 zum leben zu
bewegen.
Ich habe die Vermutung das die Berechnung der „Baudrate“ nicht passt..
Ist die Berechnung falsch?
1 | #define SPI_USART_CALC_BSEL(BSEL) (uint16_t) ( F_CPU / ( 2 * ( BSEL + 1 ) ) )
|
2 | #define SPI_USART_CALC_BAUD(BAUD) (uint16_t) ( ( F_CPU / ( SPI_USART_CALC_BSEL(BAUD) * 2 ) ) - 1 )
|
3 | usartx->usartUnit->BAUDCTRLA = ( SPI_USART_CALC_BAUD( baud ) & 0x00FF );
|
4 | usartx->usartUnit->BAUDCTRLB = ( ( SPI_USART_CALC_BAUD( baud ) & 0x0F00 ) >> 8 );
|