summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-05-06 22:42:58 -0700
committerKeith Packard <keithp@keithp.com>2011-05-06 22:42:58 -0700
commit514348055630edec12224c4b0964240b929759a3 (patch)
treec404cefaee0402d8d98778f786fc1e1dfec8949b /src
parent22e3ac0eb014b8255029763ae8180ad3527ba306 (diff)
altos: Debugging TBT issues -- check pin configuration after boot
Make sure the serial pins are configured as peripherals Make sure the ser_reset and bt_link pins are going the right direction. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r--src/ao_btm.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/ao_btm.c b/src/ao_btm.c
index 4b3c5209..490b2667 100644
--- a/src/ao_btm.c
+++ b/src/ao_btm.c
@@ -17,6 +17,21 @@
#include "ao.h"
+#if BT_LINK_ON_P2
+#define BT_PICTL_ICON PICTL_P2ICON
+#define BT_PIFG P2IFG
+#define BT_PDIR P2DIR
+#define BT_PINP P2INP
+#define BT_IEN2_PIE IEN2_P2IE
+#endif
+#if BT_LINK_ON_P1
+#define BT_PICTL_ICON PICTL_P1ICON
+#define BT_PIFG P1IFG
+#define BT_PDIR P1DIR
+#define BT_PINP P1INP
+#define BT_IEN2_PIE IEN2_P1IE
+#endif
+
int8_t ao_btm_stdio;
__xdata uint8_t ao_btm_connected;
@@ -166,6 +181,15 @@ ao_btm(void)
*/
ao_delay(AO_SEC_TO_TICKS(3));
+#if BT_LINK_ON_P1
+ if ((P1DIR & (1 << 6)) == 0)
+ ao_panic(AO_PANIC_BT);
+ if ((P1DIR & (1 << 7)) != 0)
+ ao_panic(AO_PANIC_BT);
+ if ((P0SEL & ((1 << 5) | (1 << 4) | (1 << 3) | (1 << 2))) !=
+ ((1 << 5) | (1 << 4) | (1 << 3) | (1 << 2)))
+ ao_panic(AO_PANIC_BT);
+#endif
#if HAS_BEEP
ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
#endif
@@ -212,21 +236,6 @@ ao_btm(void)
__xdata struct ao_task ao_btm_task;
-#if BT_LINK_ON_P2
-#define BT_PICTL_ICON PICTL_P2ICON
-#define BT_PIFG P2IFG
-#define BT_PDIR P2DIR
-#define BT_PINP P2INP
-#define BT_IEN2_PIE IEN2_P2IE
-#endif
-#if BT_LINK_ON_P1
-#define BT_PICTL_ICON PICTL_P1ICON
-#define BT_PIFG P1IFG
-#define BT_PDIR P1DIR
-#define BT_PINP P1INP
-#define BT_IEN2_PIE IEN2_P1IE
-#endif
-
void
ao_btm_check_link() __critical
{