Hi everyone!
In my project, I connect Uart0 to an accelerometer, by modifying the code in cma3000.c. Everything goes fine except the SPI SCK frequency is not what I need.
From scope, I read the SCK frequency is about 60Hz, but In my Code it is configured to 2MHz(System Frequency is 32MHz).
PS. My SDK version is 1.1a and IDE is IAR workbench 7.6.
__________________________________________________
Here is my configuration.
void HalSpi0_Init(void)
{
/*** Setup the SPI interface ***/
/* USART 0 at alternate location 2 */
PERCFG &= ~BV(0);
/* Give priority to USART 0 over Timer 1 for port 0 pins. */
P2DIR &= ~0xC0;
/* Peripheral function on MISO, MOSI and SCK (P0_2, P0_3, P0_5) */
P0SEL |= 0x2C;
/* GPIO function on CS(P0_4) */
P0SEL &= ~0x10;
/* Configure CS (P0_4) as output */
P0DIR |= 0x10;
SPI0_CS = SPI0_CS_DISABLE;
/* SPI in master mode */
U0CSR &= 0x00;
/* Positive clock polarity, MOSI @ ^^\__ clk, MSB first */
U0GCR |= 0xE0;
/* SCK frequency = 2MHz */
U1GCR |= 0x10; // BAUD_E = 16
U0BAUD = 0x00; // BAUD_M = 0
}