]> git.gag.com Git - fw/altos/commitdiff
add support for TeleGPS v4.0
authorBdale Garbee <bdale@gag.com>
Wed, 14 Aug 2024 07:15:36 +0000 (01:15 -0600)
committerBdale Garbee <bdale@gag.com>
Wed, 14 Aug 2024 07:15:36 +0000 (01:15 -0600)
13 files changed:
Makefile.am
Releasing
altosui/Makefile.am
altosui/altos-windows.nsi.in
src/Makefile
src/telegps-v4.0/Makefile [new file with mode: 0644]
src/telegps-v4.0/ao_pins.h [new file with mode: 0644]
src/telegps-v4.0/ao_telegps.c [new file with mode: 0644]
src/telegps-v4.0/flash-loader/.gitignore [new file with mode: 0644]
src/telegps-v4.0/flash-loader/Makefile [new file with mode: 0644]
src/telegps-v4.0/flash-loader/ao_pins.h [new file with mode: 0644]
telegps/Makefile.am
telegps/telegps-windows.nsi.in

index 7e56ebc404c23246d6bb07022a6a4f5a463154e5..6c4eb1d7d86c8f47065f39e9f310205e1f3c78a5 100644 (file)
@@ -61,6 +61,8 @@ fat_altos = \
        src/teledongle-v3.0/teledongle-v3.0-$(VERSION).ihx \
        src/telegps-v1.0/telegps-v1.0-$(VERSION).ihx \
        src/telegps-v2.0/telegps-v2.0-$(VERSION).ihx \
+       src/telegps-v3.0/telegps-v3.0-$(VERSION).ihx \
+       src/telegps-v4.0/telegps-v4.0-$(VERSION).ihx \
        src/telemega-v1.0/telemega-v1.0-$(VERSION).ihx \
        src/telemega-v2.0/telemega-v2.0-$(VERSION).ihx \
        src/telemega-v3.0/telemega-v3.0-$(VERSION).ihx \
index 3cae28560a0e1836940fb1291acc24e99b40a37d..331ec7003f7fdcaf880aea166b5070586391a414 100644 (file)
--- a/Releasing
+++ b/Releasing
@@ -122,7 +122,7 @@ These are Bdale's notes on how to do a release.
           src/easytimer-v[1-2]/{*.elf,*.ihx,*.map} \
           src/telebt-v[3-4].0/{*.elf,*.ihx,*.map} \
           src/teledongle-v3.0/{*.elf,*.ihx,*.map} \
-          src/telegps-v[1-3].0/{*.elf,*.ihx,*.map} \
+          src/telegps-v[1-4].0/{*.elf,*.ihx,*.map} \
           src/telemega-v[1-6].0/{*.elf,*.ihx,*.map} \
           src/telemetrum-v[2-4].0/{*.elf,*.ihx,*.map} \
           src/telemini-v3.0/{*.elf,*.ihx,*.map} \
@@ -136,7 +136,7 @@ These are Bdale's notes on how to do a release.
           src/easytimer-v[1-2]/flash-loader/*.elf \
           src/telebt-v[3-4].0/flash-loader/{*.elf,*.bin,*.map} \
           src/teledongle-v3.0/flash-loader/*.elf \
-          src/telegps-v[1-3].0/flash-loader/{*.elf,*.bin,*.map} \
+          src/telegps-v[1-4].0/flash-loader/{*.elf,*.bin,*.map} \
           src/telemega-v[1-6].0/flash-loader/*.elf \
           src/telemetrum-v[2-4].0/flash-loader/*.elf \
           src/telemini-v3.0/flash-loader/{*.elf,*.bin,*.map} \
index de60fc5c652c085100a3a4385705d9b723429e20..750a85ac1a57baebb7156e7756673fa966cddc88 100644 (file)
@@ -162,7 +162,8 @@ FIRMWARE_ETIMER=$(FIRMWARE_ETIMER_1) $(FIRMWARE_ETIMER_2)
 FIRMWARE_TGPS_1_0=$(top_srcdir)/src/telegps-v1.0/telegps-v1.0-$(VERSION).ihx
 FIRMWARE_TGPS_2_0=$(top_srcdir)/src/telegps-v2.0/telegps-v2.0-$(VERSION).ihx
 FIRMWARE_TGPS_3_0=$(top_srcdir)/src/telegps-v3.0/telegps-v3.0-$(VERSION).ihx
-FIRMWARE_TGPS=$(FIRMWARE_TGPS_1_0) $(FIRMWARE_TGPS_2_0) $(FIRMWARE_TGPS_3_0)
+FIRMWARE_TGPS_4_0=$(top_srcdir)/src/telegps-v4.0/telegps-v4.0-$(VERSION).ihx
+FIRMWARE_TGPS=$(FIRMWARE_TGPS_1_0) $(FIRMWARE_TGPS_2_0) $(FIRMWARE_TGPS_3_0) $(FIRMWARE_TGPS_4_0)
 
 FIRMWARE_TLCO_2_0=$(top_srcdir)/src/telelco-v2.0/telelco-v2.0-$(VERSION).ihx
 FIRMWARE_TLCO=$(FIRMWARE_TLCO_2_0)
index 39f609a347dfc86130865055f925f7ad2ddefe37..1d938e259638254e9af2c72f17933c5c12f7b7f5 100644 (file)
@@ -127,6 +127,7 @@ Section "Firmware"
        File "../src/telegps-v1.0/telegps-v1.0-${VERSION}.ihx"
        File "../src/telegps-v2.0/telegps-v2.0-${VERSION}.ihx"
        File "../src/telegps-v3.0/telegps-v3.0-${VERSION}.ihx"
+       File "../src/telegps-v4.0/telegps-v4.0-${VERSION}.ihx"
        File "../src/teledongle-v3.0/teledongle-v3.0-${VERSION}.ihx"
        File "../src/telebt-v3.0/telebt-v3.0-${VERSION}.ihx"
        File "../src/telebt-v4.0/telebt-v4.0-${VERSION}.ihx"
index b3a3066c34dab114b6dcac5791eada88f6d87005..411956cfce67b1919d88b450a28d1aea32037da9 100644 (file)
@@ -35,6 +35,7 @@ ARMM3DIRS=\
        telegps-v1.0 telegps-v1.0/flash-loader \
        telegps-v2.0 telegps-v2.0/flash-loader \
        telegps-v3.0 telegps-v3.0/flash-loader \
+       telegps-v4.0 telegps-v4.0/flash-loader \
        telelco-v0.2 telelco-v0.2/flash-loader \
        telelco-v0.2-cc1200 telelco-v0.2-cc1200/flash-loader \
        telelco-v0.3 telelco-v0.3/flash-loader \
diff --git a/src/telegps-v4.0/Makefile b/src/telegps-v4.0/Makefile
new file mode 100644 (file)
index 0000000..0b1535c
--- /dev/null
@@ -0,0 +1,88 @@
+#
+# AltOS build
+#
+#
+
+TOPDIR=..
+
+include $(TOPDIR)/stmf0/Makefile.defs
+
+INC = \
+       ao.h \
+       ao_arch.h \
+       ao_arch_funcs.h \
+       ao_pins.h \
+       ao_product.h \
+       ao_tracker.h \
+       ao_task.h \
+       ao_cc1200.h \
+       ao_fec.h \
+       stm32f0.h \
+       Makefile
+
+
+ALTOS_SRC = \
+       ao_adc_stm.c \
+       ao_led_stmf0.c \
+       ao_interrupt.c \
+       ao_boot_chain.c \
+       ao_product.c \
+       ao_romconfig.c \
+       ao_cmd.c \
+       ao_config.c \
+       ao_task.c \
+       ao_stdio.c \
+       ao_panic.c \
+       ao_timer.c \
+       ao_mutex.c \
+       ao_freq.c \
+       ao_dma_stm.c \
+       ao_spi_stm.c \
+       ao_usb_stm.c \
+       ao_exti_stm.c \
+       ao_serial_stm.c \
+       ao_gps_ublox.c \
+       ao_gps_show.c \
+       ao_cc1200.c \
+       ao_aprs.c \
+       ao_tracker.c \
+       ao_telemetry.c \
+       ao_storage.c \
+       ao_m25.c \
+       ao_log.c \
+       ao_log_gps.c \
+       ao_distance.c \
+       ao_sqrt.c \
+       ao_data.c \
+       ao_convert_volt.c \
+       $(SAMPLE_PROFILE)
+
+PRODUCT=TeleGPS-v4.0
+PRODUCT_DEF=-DTELEGPS
+IDPRODUCT=0x0025
+
+CFLAGS = $(PRODUCT_DEF) $(STMF0_CFLAGS) $(PROFILE_DEF)
+
+PROGNAME=telegps-v4.0
+PROG=$(PROGNAME)-$(VERSION).elf
+HEX=$(PROGNAME)-$(VERSION).ihx
+
+SRC=$(ALTOS_SRC) ao_telegps.c
+OBJ=$(SRC:.c=.o)
+
+all: $(PROG) $(HEX)
+
+$(PROG): Makefile $(OBJ) altos.ld
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) -Wl,-Map=$(PROGNAME)-$(VERSION).map
+
+$(OBJ): $(INC)
+
+distclean:     clean
+
+clean:
+       rm -f *.o ao_serial_stm.h $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
+       rm -f ao_product.h
+
+install:
+
+uninstall:
diff --git a/src/telegps-v4.0/ao_pins.h b/src/telegps-v4.0/ao_pins.h
new file mode 100644 (file)
index 0000000..a5ea6ea
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * Copyright © 2024 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+#define LED_PORT_ENABLE STM_RCC_AHBENR_IOPBEN
+#define LED_PORT        (&stm_gpiob)
+#define LED_PIN_GREEN   5
+#define AO_LED_GREEN    (1 << LED_PIN_GREEN)
+#define AO_LED_PANIC   AO_LED_GREEN
+#define AO_LED_GPS_LOCK        AO_LED_GREEN
+
+#define LEDS_AVAILABLE  (AO_LED_GREEN)
+
+#define AO_STACK_SIZE          512
+
+#define IS_FLASH_LOADER                0
+#define HAS_BEEP              0
+
+#define AO_HSE                  16000000
+#define AO_RCC_CFGR_PLLMUL      STM_RCC_CFGR_PLLMUL_3
+#define AO_RCC_CFGR2_PLLDIV    STM_RCC_CFGR2_PREDIV_1
+#define AO_PLLMUL               3
+#define AO_PLLDIV               1
+
+/* HCLK = 48MHz */
+#define AO_AHB_PRESCALER        1
+#define AO_RCC_CFGR_HPRE_DIV    STM_RCC_CFGR_HPRE_DIV_1
+
+/* APB = 48MHz */
+#define AO_APB_PRESCALER        1
+#define AO_RCC_CFGR_PPRE_DIV    STM_RCC_CFGR_PPRE_DIV_1
+
+#define HAS_USB                         1
+#define AO_USB_DIRECTIO                 0
+#define AO_PA11_PA12_RMP                1
+#define HAS_USB_CONNECT                        1
+#define AO_USB_CONNECT_PORT            (&stm_gpiob)
+#define AO_USB_CONNECT_PIN             3
+
+#define IS_FLASH_LOADER 0
+
+/* ADC */
+
+#define HAS_ADC                        1
+#define AO_ADC_PIN0_PORT        (&stm_gpiob)
+#define AO_ADC_PIN0_PIN         1
+#define AO_ADC_PIN0_CH          9
+
+#define AO_ADC_RCC_AHBENR       ((1 << STM_RCC_AHBENR_IOPBEN))
+
+#define ao_telemetry_battery_convert(a)        ((a) << 3)
+
+#define AO_NUM_ADC              1
+
+#define AO_DATA_RING           4
+
+/*
+ * Voltage divider on ADC battery sampler
+ */
+#define AO_BATTERY_DIV_PLUS    56      /* 5.6k */
+#define AO_BATTERY_DIV_MINUS   100     /* 10k */
+
+/*
+ * ADC reference in decivolts
+ */
+#define AO_ADC_REFERENCE_DV    33
+
+struct ao_adc {
+        int16_t                 v_batt;
+};
+
+#define AO_ADC_DUMP(p) \
+        printf("tick: %5lu batt: %5d\n", \
+               (p)->tick, \
+               (p)->adc.v_batt)
+
+/* SPI */
+#define HAS_SPI_1               1
+#define HAS_SPI_2               0
+#define SPI_1_PA5_PA6_PA7       1
+#define SPI_1_PB3_PB4_PB5       0
+#define SPI_1_OSPEEDR           STM_OSPEEDR_HIGH
+
+/* Flash */
+
+#define M25_MAX_CHIPS           1
+#define AO_M25_SPI_CS_PORT      (&stm_gpiob)
+#define AO_M25_SPI_CS_MASK      (1 << 0)
+#define AO_M25_SPI_BUS          AO_SPI_1_PA5_PA6_PA7
+
+/* Serial */
+#define HAS_SERIAL_1           0
+#define SERIAL_1_PB6_PB7       1
+#define USE_SERIAL_1_STDIN     0
+
+#define HAS_SERIAL_2           1
+#define SERIAL_2_PA2_PA3       1
+#define USE_SERIAL_2_STDIN     0
+#define USE_SERIAL_2_FLOW       0
+#define USE_SERIAL_2_SW_FLOW    0
+
+#define ao_gps_getchar         ao_serial2_getchar
+#define ao_gps_putchar         ao_serial2_putchar
+#define ao_gps_set_speed       ao_serial2_set_speed
+
+#define HAS_EEPROM             1
+#define USE_INTERNAL_FLASH     0
+#define HAS_RADIO              1
+#define HAS_TELEMETRY          1
+#define HAS_RDF                        1
+#define HAS_APRS               1
+
+#define HAS_GPS                        1
+#define HAS_FLIGHT             0
+#define HAS_LOG                        1
+#define FLIGHT_LOG_APPEND      1
+#define HAS_TRACKER            1
+#define LOG_ADC                        0
+
+#define AO_CONFIG_DEFAULT_APRS_INTERVAL                0
+#define AO_CONFIG_DEFAULT_RADIO_POWER          0xc0
+#define AO_LOG_FORMAT                          AO_LOG_FORMAT_TELEGPS
+
+/*
+ * GPS
+ */
+
+#define AO_SERIAL_SPEED_UBLOX  AO_SERIAL_SPEED_9600
+#define AO_UBLOX_VERSION       10
+
+/*
+ * Radio (cc1200)
+ */
+
+/* gets pretty close to 434.550 */
+
+#define AO_RADIO_CAL_DEFAULT    5695733
+
+#define AO_FEC_DEBUG            0
+#define AO_CC1200_SPI_CS_PORT   (&stm_gpioa)
+#define AO_CC1200_SPI_CS_PIN    1
+#define AO_CC1200_SPI_BUS       AO_SPI_1_PA5_PA6_PA7
+#define AO_CC1200_SPI           stm_spi1
+
+#define AO_CC1200_INT_PORT              (&stm_gpioa)
+#define AO_CC1200_INT_PIN               4
+
+#define AO_CC1200_INT_GPIO      2
+#define AO_CC1200_INT_GPIO_IOCFG        CC1200_IOCFG2
+
+#define HAS_BOOT_RADIO          0
+
+#endif /* _AO_PINS_H_ */
diff --git a/src/telegps-v4.0/ao_telegps.c b/src/telegps-v4.0/ao_telegps.c
new file mode 100644 (file)
index 0000000..1ba67f6
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2013 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <ao.h>
+#include <ao_log.h>
+#include <ao_exti.h>
+#include <ao_tracker.h>
+
+int
+main(void)
+{
+       ao_clock_init();
+       ao_task_init();
+       ao_cmd_init();
+       ao_config_init();
+
+       ao_led_init();
+       ao_led_on(LEDS_AVAILABLE);
+
+       /* internal systems */
+       ao_timer_init();
+       ao_dma_init();
+       ao_exti_init();
+
+       /* SoC hardware */
+       ao_adc_init();
+       ao_serial_init();
+       ao_spi_init();
+       ao_usb_init();
+
+       /* External hardware */
+       ao_storage_init();
+       ao_radio_init();
+       ao_gps_init();
+
+       /* Services */
+       ao_log_init();
+       ao_telemetry_init();
+       ao_tracker_init();
+
+       ao_led_off(LEDS_AVAILABLE);
+
+       ao_start_scheduler();
+}
diff --git a/src/telegps-v4.0/flash-loader/.gitignore b/src/telegps-v4.0/flash-loader/.gitignore
new file mode 100644 (file)
index 0000000..7bbed04
--- /dev/null
@@ -0,0 +1,2 @@
+*.elf
+*.bin
diff --git a/src/telegps-v4.0/flash-loader/Makefile b/src/telegps-v4.0/flash-loader/Makefile
new file mode 100644 (file)
index 0000000..499d976
--- /dev/null
@@ -0,0 +1,8 @@
+#
+# AltOS flash loader build
+#
+#
+
+TOPDIR=../..
+HARDWARE=telegps-v4.0
+include $(TOPDIR)/stmf0/Makefile-flash.defs
diff --git a/src/telegps-v4.0/flash-loader/ao_pins.h b/src/telegps-v4.0/flash-loader/ao_pins.h
new file mode 100644 (file)
index 0000000..c7bf4e7
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2024 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+#include <ao_flash_stm_pins.h>
+
+/* Pin 5 on debug connector */
+
+#define AO_BOOT_PIN            1
+#define AO_BOOT_APPLICATION_GPIO       stm_gpiob
+#define AO_BOOT_APPLICATION_PIN                6
+#define AO_BOOT_APPLICATION_VALUE      1
+#define AO_BOOT_APPLICATION_MODE       AO_EXTI_MODE_PULL_UP
+
+#define HAS_USB                        1
+#define AO_USB_DIRECTIO                0
+#define AO_PA11_PA12_RMP       1
+
+#endif /* _AO_PINS_H_ */
index 552abea76bdf5bc53f2e91eab23ed0f823f950af..f8e2cf15c3ccc97ed476237085e758cdf40b0c4e 100644 (file)
@@ -114,7 +114,8 @@ FIRMWARE_TBT=$(FIRMWARE_TBT_3_0) $(FIRMWARE_TBT_4_0)
 FIRMWARE_TGPS_1_0=$(top_srcdir)/src/telegps-v1.0/telegps-v1.0-$(VERSION).ihx
 FIRMWARE_TGPS_2_0=$(top_srcdir)/src/telegps-v2.0/telegps-v2.0-$(VERSION).ihx
 FIRMWARE_TGPS_3_0=$(top_srcdir)/src/telegps-v3.0/telegps-v3.0-$(VERSION).ihx
-FIRMWARE_TGPS=$(FIRMWARE_TGPS_1_0) $(FIRMWARE_TGPS_2_0) $(FIRMWARE_TGPS_3_0)
+FIRMWARE_TGPS_4_0=$(top_srcdir)/src/telegps-v4.0/telegps-v4.0-$(VERSION).ihx
+FIRMWARE_TGPS=$(FIRMWARE_TGPS_1_0) $(FIRMWARE_TGPS_2_0) $(FIRMWARE_TGPS_3_0) $(FIRMWARE_TGPS_4_0)
 
 FIRMWARE=$(FIRMWARE_TGPS) $(FIRMWARE_TD) $(FIRMWARE_TBT)
 
index c7fb452c8628065be4b6b63614f550d0e6f4ba7d..4e686857fc2601cf871129e5e4d3655938c3d88c 100644 (file)
@@ -123,6 +123,7 @@ Section "TeleGPS, TeleDongle and TeleBT Firmware"
        File "../src/telegps-v1.0/telegps-v1.0-${VERSION}.ihx"
        File "../src/telegps-v2.0/telegps-v2.0-${VERSION}.ihx"
        File "../src/telegps-v3.0/telegps-v3.0-${VERSION}.ihx"
+       File "../src/telegps-v4.0/telegps-v4.0-${VERSION}.ihx"
        File "../src/teledongle-v3.0/teledongle-v3.0-${VERSION}.ihx"
        File "../src/telebt-v3.0/telebt-v3.0-${VERSION}.ihx"
        File "../src/telebt-v4.0/telebt-v4.0-${VERSION}.ihx"