summaryrefslogtreecommitdiff
path: root/software/mpu
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2013-08-04 22:09:52 +0000
committerChristian Pointner <equinox@mur.at>2013-08-04 22:09:52 +0000
commit0c3f04f34e81a0c13c093e8fa2cc5720d58e78b6 (patch)
tree92b4acbd61e7512186f8ef6a774e08a801734909 /software/mpu
parentimproved serial level shifter (diff)
improved board config for MPU chibios
git-svn-id: https://svn.spreadspace.org/mur.sat@822 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/mpu')
-rw-r--r--software/mpu/board.mk5
-rw-r--r--software/mpu/board/board.h43
-rw-r--r--software/mpu/main.c13
3 files changed, 21 insertions, 40 deletions
diff --git a/software/mpu/board.mk b/software/mpu/board.mk
deleted file mode 100644
index 391e200..0000000
--- a/software/mpu/board.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-# List of all the board related files.
-BOARDSRC = board/board.c
-
-# Required include directories
-BOARDINC = board/
diff --git a/software/mpu/board/board.h b/software/mpu/board/board.h
index 4839948..53a5e37 100644
--- a/software/mpu/board/board.h
+++ b/software/mpu/board/board.h
@@ -30,7 +30,6 @@
/*
* Setup for mur.sat MPU board.
- * copy from setup for Olimex STM32-P103 proto board.
*/
/*
@@ -42,7 +41,7 @@
/*
* Board frequencies.
*/
-#define STM32_LSECLK 32768
+#define STM32_LSECLK 0
#define STM32_HSECLK 8000000
/*
@@ -53,17 +52,8 @@
/*
* IO pins assignments.
*/
-#define GPIOA_BUTTON 0
-#define GPIOA_SPI1NSS 4
-
-#define GPIOB_SPI2NSS 12
-
-#define GPIOC_USB_P 4
-#define GPIOC_MMCWP 6
-#define GPIOC_MMCCP 7
-#define GPIOC_CAN_CNTL 10
-#define GPIOC_USB_DISC 11
-#define GPIOC_LED 12
+#define GPIOA_LED 8
+#define GPIOA_USB_DISC 13
/*
* I/O ports initial setup, this configuration is established soon after reset
@@ -92,37 +82,30 @@
/*
* Port A setup.
* Everything input with pull-up except:
- * PA0 - Normal input (BUTTON).
* PA2 - Alternate output (USART2 TX).
* PA3 - Normal input (USART2 RX).
+ * PA8 - Push Pull output (LED).
+ * PA13 - Push Pull output (USB DISC).
*/
-#define VAL_GPIOACRL 0x88884B84 /* PA7...PA0 */
-#define VAL_GPIOACRH 0x88888888 /* PA15...PA8 */
+#define VAL_GPIOACRL 0x88884B88 /* PA7...PA0 */
+#define VAL_GPIOACRH 0x88388883 /* PA15...PA8 */
#define VAL_GPIOAODR 0xFFFFFFFF
/*
* Port B setup.
* Everything input with pull-up except:
- * PB13 - Alternate output (MMC SPI2 SCK).
- * PB14 - Normal input (MMC SPI2 MISO).
- * PB15 - Alternate output (MMC SPI2 MOSI).
*/
#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
-#define VAL_GPIOBCRH 0xB4B88888 /* PB15...PB8 */
+#define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */
#define VAL_GPIOBODR 0xFFFFFFFF
/*
* Port C setup.
* Everything input with pull-up except:
- * PC4 - Normal input because there is an external resistor.
- * PC6 - Normal input because there is an external resistor.
- * PC7 - Normal input because there is an external resistor.
- * PC10 - Push Pull output (CAN CNTRL).
- * PC11 - Push Pull output (USB DISC).
- * PC12 - Push Pull output (LED).
+ * nothing here
*/
-#define VAL_GPIOCCRL 0x44848888 /* PC7...PC0 */
-#define VAL_GPIOCCRH 0x88833388 /* PC15...PC8 */
+#define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */
+#define VAL_GPIOCCRH 0x88888888 /* PC15...PC8 */
#define VAL_GPIOCODR 0xFFFFFFFF
/*
@@ -162,12 +145,12 @@
/*
* USB bus activation macro, required by the USB driver.
*/
-#define usb_lld_connect_bus(usbp) palClearPad(GPIOC, GPIOC_USB_DISC)
+#define usb_lld_connect_bus(usbp) palClearPad(GPIOA, GPIOA_USB_DISC)
/*
* USB bus de-activation macro, required by the USB driver.
*/
-#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOC, GPIOC_USB_DISC)
+#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOA, GPIOA_USB_DISC)
#if !defined(_FROM_ASM_)
#ifdef __cplusplus
diff --git a/software/mpu/main.c b/software/mpu/main.c
index dd34960..e4c6a5b 100644
--- a/software/mpu/main.c
+++ b/software/mpu/main.c
@@ -38,9 +38,9 @@ static msg_t Thread1(void *arg) {
(void)arg;
chRegSetThreadName("blinker");
while (TRUE) {
- palClearPad(GPIOC, GPIOC_LED);
+ palClearPad(GPIOA, GPIOA_LED);
chThdSleepMilliseconds(500);
- palSetPad(GPIOC, GPIOC_LED);
+ palSetPad(GPIOA, GPIOA_LED);
chThdSleepMilliseconds(500);
}
}
@@ -71,12 +71,15 @@ int main(void) {
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
+ * run tests after initialization is complete
+ */
+ TestThread(&SD2);
+
+ /*
* Normal main() thread activity, in this demo it does nothing except
- * sleeping in a loop and check the button state.
+ * sleeping in a loop.
*/
while (TRUE) {
- if (palReadPad(GPIOA, GPIOA_BUTTON))
- TestThread(&SD2);
chThdSleepMilliseconds(500);
}
}