aboutsummaryrefslogtreecommitdiff
path: root/examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c')
-rw-r--r--examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c b/examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c
index 388afc8..cdb3702 100644
--- a/examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c
+++ b/examples/lpc43xx/hackrf-jellybean/ssp/sspdemo.c
@@ -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);