Other Parts Discussed in Thread: MSP430G2955
Hi,
I'm having troubles of synchronism with the MSP430G2955 (I tried on the G2553 but still happen) when I use the 16MHz clock. When I configure to 1MHz works fine.
I tried to divide to configure the SMCLK using the code:
BCSCTL2 |= DIVS_1;
But occur a lost of synchronism.
When I tried to use the prescaler the lost of synchronism also occur.
The problem is no the slave device, a flash memory because the limit clock is 25MHz. Using a logic analyser i can see the lost of synchronism.
What is the problem?
- My code configuring the SPI and clock in 1MHz and working:
WDTCTL = WDTPW + WDTHOLD; BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; UCB0CTL1 = UCSWRST; UCB0CTL0 |= UCMSB + UCMST + UCSYNC + UCCKPL; UCB0CTL1 |= UCSSEL_2; UCB0CTL1 &= ~UCSWRST;
This code works fine and I can send and receive data.
- My code adapted to 16MHz, don't working.
WDTCTL = WDTPW + WDTHOLD; BCSCTL1 = CALBC1_16MHZ; DCOCTL = CALDCO_16MHZ; //BCSCTL2 |= DIVS_3; // SMCLOCK /8 = (16 / 8) = 2MHz UCB0CTL1 = UCSWRST; UCB0CTL0 |= UCMSB + UCMST + UCSYNC + UCCKPL; UCB0BR0 = 16; // clock = SMCLK / 16 = 1MHz UCB0CTL1 |= UCSSEL_2; UCB0CTL1 &= ~UCSWRST;
In this code, or using the divider to SMCLK the lost of synchronism occur.