Fixed SSP, tested with Oscilloscope Write work fine (tested SPI Mode).

For more details on tests see ssp/README.
This commit is contained in:
TitanMKD
2012-06-06 00:30:25 +02:00
parent 416f633dbb
commit 8adc873e84
5 changed files with 51 additions and 12 deletions

View File

@@ -26,6 +26,16 @@
void gpio_setup(void)
{
/* Configure all GPIO as Input (safe state) */
GPIO0_DIR = 0;
GPIO1_DIR = 0;
GPIO2_DIR = 0;
GPIO3_DIR = 0;
GPIO4_DIR = 0;
GPIO5_DIR = 0;
GPIO6_DIR = 0;
GPIO7_DIR = 0;
/* Configure SCU Pin Mux as GPIO */
scu_pinmux(SCU_PINMUX_LED1, SCU_GPIO_FAST);
scu_pinmux(SCU_PINMUX_LED2, SCU_GPIO_FAST);
@@ -44,16 +54,6 @@ void gpio_setup(void)
scu_pinmux(SCU_SSP1_SCK, (SCU_SSP_IO | SCU_CONF_FUNCTION1));
scu_pinmux(SCU_SSP1_SSEL, (SCU_SSP_IO | SCU_CONF_FUNCTION1));
/* Configure all GPIO as Input (safe state) */
GPIO0_DIR = 0;
GPIO1_DIR = 0;
GPIO2_DIR = 0;
GPIO3_DIR = 0;
GPIO4_DIR = 0;
GPIO5_DIR = 0;
GPIO6_DIR = 0;
GPIO7_DIR = 0;
/* Configure GPIO as Output */
GPIO2_DIR |= (PIN_LED1|PIN_LED2|PIN_LED3); /* Configure GPIO2[1/2/8] (P4_1/2 P6_12) as output. */
GPIO3_DIR |= PIN_EN1V8; /* GPIO3[6] on P6_10 as output. */
@@ -64,10 +64,12 @@ int main(void)
int i;
u8 ssp_val;
u8 serial_clock_rate;
u8 clock_prescale_rate;
gpio_setup();
/* FIX Me freq */
/* Freq About 1.12MHz => Freq = PCLK / (CPSDVSR * [SCR+1]) with PCLK=PLL1=288MHz */
clock_prescale_rate = 2;
serial_clock_rate = 128;
ssp_init(SSP1_NUM,
@@ -75,6 +77,7 @@ int main(void)
SSP_FRAME_SPI,
SSP_CPOL_0_CPHA_0,
serial_clock_rate,
clock_prescale_rate,
SSP_MODE_NORMAL,
SSP_MASTER,
SSP_SLAVE_OUT_ENABLE);