Switch DBG pins to GPIO when using any debug commands. Reboot to restore.
authorKeith Packard <keithp@keithp.com>
Thu, 15 Jul 2010 02:07:02 +0000 (19:07 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 15 Jul 2010 02:10:04 +0000 (19:10 -0700)
If you want to use TeleMetrum as a debug dongle, you need to flip the
three pins used to talk to the remote debug port from SPI mode to GPIO
mode.

This patch doesn't provide any way to get back to SPI mode, so you'll
have to reboot the TeleMetrum to write out config parameters or log
flight data after using any debug commands.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao_dbg.c

index e7fbd7ad8d207c709997d9b02c3dfac2311cc1dd..0d9ec8c0db958a306b9b3b5bc95f1bdf0e14ac3e 100644 (file)
@@ -164,6 +164,12 @@ ao_dbg_read_byte(void)
 static void
 ao_dbg_set_pins(void)
 {
 static void
 ao_dbg_set_pins(void)
 {
+       /* Make the DBG pins GPIOs. On TeleMetrum, this will
+        * disable the SPI link, so don't expect SPI to work after
+        * using the debugger.
+        */
+       DBG_PORT_SEL &= ~(DBG_CLOCK|DBG_DATA|DBG_RESET_N);
+
        /* make DBG_DATA tri-state */
        DBG_PORT_INP |= DBG_DATA;
 
        /* make DBG_DATA tri-state */
        DBG_PORT_INP |= DBG_DATA;