AMcTools Forum 
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Problems with SPI configuration (Read 2942 times)
VasylYE
YaBB Newbies
*
Offline

VMLAB!

Posts: 6
UA
Gender: male
Problems with SPI configuration
10/07/10 at 14:54:51
 
I configure SPI interface with Double Speed:
mcu ATmega162

[code]
  PORTB |= (1 << PB4);
   DDRB |= (1 << DDB4);

   // master mode and Fosc/2 clock:
   SPSR |= (1<<SPI2X);
   SPCR |= (1<<SPE)|(1<<MSTR);
[/code]

but when running simulation, in SPI section of Peripherals window
I see, that Mode is Master, and [color=#ff0000]Clock is CK/4[/color]. Why?
Back to top
 
 
WWW VasylYE 40082775   IP Logged
ThVortex
Global Moderator
*****
Offline



Posts: 160
Austin, TX, USA
Gender: male
Re: Problems with SPI configuration
Reply #1 - 10/10/10 at 22:18:59
 
That looks like a bug in the internal AVR definition. It should be CK/2. Although, are you only referring to the speed displayed in the GUI or is the actual clock speed on the SCK pin also wrong?
Back to top
 
 
WWW   IP Logged
VasylYE
YaBB Newbies
*
Offline

VMLAB!

Posts: 6
UA
Gender: male
Re: Problems with SPI configuration
Reply #2 - 10/11/10 at 15:20:59
 
MCU running on 14,318 MHz
Actual clock speed on the SCK pin is ~7.16 MHz (period 139.6ns in Scope), so simulation running good.

Ok, I understood, Thank You
Back to top
 
« Last Edit: 10/11/10 at 17:27:56 by VasylYE »  
WWW VasylYE 40082775   IP Logged
Pages: 1
Send Topic Print