aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fsm/i2c.c2
-rw-r--r--src/fsm/main.c2
-rw-r--r--src/fsm/pio.c16
-rw-r--r--src/fsm/pio.h30
-rw-r--r--src/fsm/pio.txt30
-rw-r--r--src/fsm/usart.c5
6 files changed, 61 insertions, 24 deletions
diff --git a/src/fsm/i2c.c b/src/fsm/i2c.c
index 687f7be..556b55f 100644
--- a/src/fsm/i2c.c
+++ b/src/fsm/i2c.c
@@ -32,6 +32,8 @@
#include "task.h"
#include "semphr.h"
+/* I2C 1 on PB9 and PB6
+ * See pio.txt for PIO allocation details */
const uint16_t GPIOB_PIN_SDA = GPIO_Pin_9;
const uint16_t GPIOB_PIN_SCL = GPIO_Pin_6;
diff --git a/src/fsm/main.c b/src/fsm/main.c
index f50e144..1e897ab 100644
--- a/src/fsm/main.c
+++ b/src/fsm/main.c
@@ -267,7 +267,7 @@ static void exercise_fsm(void *pvParameters)
struct fsm_output_signals_t fsm_out;
fsm_get_outputs(&fsm_out);
- pio_set_led_red(fsm_out.tx_on);
+ pio_set_tx(fsm_out.tx_on);
pio_set_led_yel(fsm_out.modulation);
pio_set_led_grn(fsm_input.carrier);
diff --git a/src/fsm/pio.c b/src/fsm/pio.c
index fd9347b..2a8aa40 100644
--- a/src/fsm/pio.c
+++ b/src/fsm/pio.c
@@ -41,14 +41,21 @@ void pio_init()
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
- GPIO_InitStructure.GPIO_Pin = PIO_OUTPUT_PINS;
+ GPIO_InitStructure.GPIO_Pin = GPIOC_OUTPUT_PINS;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_Init(GPIOC, &GPIO_InitStructure);
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
+ GPIO_InitStructure.GPIO_Pin = GPIOC_OPENDRAIN_PINS;
+ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
+ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+ GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
+ GPIO_Init(GPIOC, &GPIO_InitStructure);
+
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
- GPIO_InitStructure.GPIO_Pin = PIO_INPUT_PINS;
+ GPIO_InitStructure.GPIO_Pin = GPIOC_INPUT_PINS;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
@@ -81,13 +88,16 @@ void read_fsm_input_task(void *pvParameters)
}
}
-void pio_set_led_red(int on)
+void pio_set_tx(int on)
{
+ // Led is active high, TX_n is inverted logic
if (on) {
GPIO_SetBits(GPIOC, GPIO_PIN_LED_red);
+ GPIO_ResetBits(GPIOC, GPIO_PIN_TX_n);
}
else {
GPIO_ResetBits(GPIOC, GPIO_PIN_LED_red);
+ GPIO_SetBits(GPIOC, GPIO_PIN_TX_n);
}
}
diff --git a/src/fsm/pio.h b/src/fsm/pio.h
index 3209f41..7752e34 100644
--- a/src/fsm/pio.h
+++ b/src/fsm/pio.h
@@ -31,18 +31,9 @@
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_gpio.h"
-/*
-Blue in QRP_n PC1
-Violet out LED red PC2
-Grey in 1750 PC4
-White out LED yel PC5
-Black - GND GND
-Brown in RX_n PC6
-Red in U_n PC8
-Orange out LED grn PC9
-Green in D_n PC11
-*/
+/* See pio.txt for PIO allocation details */
+/* On GPIO C */
#define GPIO_PIN_QRP_n GPIO_Pin_1
#define GPIO_PIN_LED_red GPIO_Pin_2
#define GPIO_PIN_1750 GPIO_Pin_4
@@ -51,17 +42,24 @@ Green in D_n PC11
#define GPIO_PIN_U_n GPIO_Pin_8
#define GPIO_PIN_LED_grn GPIO_Pin_9
#define GPIO_PIN_D_n GPIO_Pin_11
+#define GPIO_PIN_TX_n GPIO_Pin_13
+
+#define GPIOC_OUTPUT_PINS GPIO_PIN_LED_red | \
+ GPIO_PIN_LED_yel | \
+ GPIO_PIN_LED_grn
-#define PIO_OUTPUT_PINS GPIO_Pin_2 | GPIO_Pin_5 | GPIO_Pin_9
+#define GPIOC_OPENDRAIN_PINS GPIO_PIN_TX_n
-#define PIO_INPUT_PINS GPIO_Pin_1 | GPIO_Pin_4 | \
- GPIO_Pin_6 | GPIO_Pin_8 | \
- GPIO_Pin_11
+#define GPIOC_INPUT_PINS GPIO_PIN_QRP_n | \
+ GPIO_PIN_1750 | \
+ GPIO_PIN_RX_n | \
+ GPIO_PIN_U_n | \
+ GPIO_PIN_D_n
void pio_init(void);
-void pio_set_led_red(int on);
+void pio_set_tx(int on);
void pio_set_led_yel(int on);
void pio_set_led_grn(int on);
diff --git a/src/fsm/pio.txt b/src/fsm/pio.txt
new file mode 100644
index 0000000..c1326bc
--- /dev/null
+++ b/src/fsm/pio.txt
@@ -0,0 +1,30 @@
+Allocation of PIOs to functions
+===============================
+
+Test logic
+----------
+- out TX_OFF PC13
+
+u-blox NEO-M8N GPS module connection
+------------------------------------
+Yellow out UART TX to GPS RX PD8
+Orange in UART RX to GPS TX PD9
+
+For the little test board with the 3 LEDs and switches
+------------------------------------------------------
+Blue in QRP_n PC1
+Violet out LED red PC2
+Grey in 1750 PC4
+White out LED yel PC5
+Black - GND GND
+Brown in RX_n PC6
+Red in U_n PC8
+Orange out LED grn PC9
+Green in D_n PC11
+
+I2C to Audio Codec
+------------------
+- i/o SDA PB9
+- i/o SCL PB6
+
+
diff --git a/src/fsm/usart.c b/src/fsm/usart.c
index d12b51f..c606814 100644
--- a/src/fsm/usart.c
+++ b/src/fsm/usart.c
@@ -32,10 +32,7 @@
#include "queue.h"
/* USART 3 on PD8 and PD9
- *
- * board TX to GPS RX on PD8
- * board RX to GPS TX on PD9
- */
+ * See pio.txt for PIO allocation details */
const uint16_t GPIOD_PIN_USART3_TX = GPIO_Pin_8;
const uint16_t GPIOD_PIN_USART3_RX = GPIO_Pin_9;