From d1ba276c6e54564f82920f65bf4c19df85c9ea56 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 19 Apr 2017 23:08:06 -0700 Subject: [PATCH] altos/telemini-v3.0: Update to production hardware Removed LEDs. Added USB. Flipped lots of pins around. This appears to make telemini work. Signed-off-by: Keith Packard --- src/telemini-v3.0/Makefile | 101 ++++++++++++++++++++++ src/telemini-v3.0/ao_pins.h | 38 +++----- src/telemini-v3.0/ao_telemini.c | 5 +- src/telemini-v3.0/ao_telemini_calibrate.c | 80 ----------------- 4 files changed, 114 insertions(+), 110 deletions(-) create mode 100644 src/telemini-v3.0/Makefile delete mode 100644 src/telemini-v3.0/ao_telemini_calibrate.c diff --git a/src/telemini-v3.0/Makefile b/src/telemini-v3.0/Makefile new file mode 100644 index 00000000..70c256f4 --- /dev/null +++ b/src/telemini-v3.0/Makefile @@ -0,0 +1,101 @@ +# +# AltOS build +# +# + +include ../stmf0/Makefile.defs + +INC = \ + ao.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_pins.h \ + ao_product.h \ + ao_cc1200.h \ + ao_cc1200_CC1200.h \ + stm32f0.h + +# +# Common AltOS sources +# + +ALTOS_SRC = \ + ao_interrupt.c \ + ao_boot_chain.c \ + ao_romconfig.c \ + ao_product.c \ + ao_mutex.c \ + ao_panic.c \ + ao_stdio.c \ + ao_storage.c \ + ao_report.c \ + ao_ignite.c \ + ao_flight.c \ + ao_kalman.c \ + ao_sample.c \ + ao_data.c \ + ao_convert_pa.c \ + ao_convert_volt.c \ + ao_task.c \ + ao_log.c \ + ao_log_mini.c \ + ao_cmd.c \ + ao_config.c \ + ao_freq.c \ + ao_dma_stm.c \ + ao_timer.c \ + ao_exti_stm.c \ + ao_spi_stm.c \ + ao_adc_stm.c \ + ao_usb_stm.c \ + ao_m25.c \ + ao_ms5607.c \ + ao_cc1200.c \ + ao_telemetry.c \ + ao_packet_slave.c \ + ao_beep_stm.c \ + ao_packet.c + +PRODUCT=TeleMini-v3.0 +PRODUCT_DEF=-DTELEMINI_V_3_0 +IDPRODUCT=0x0027 + +CFLAGS = $(PRODUCT_DEF) $(STMF0_CFLAGS) -g -Os + +PROGNAME=telemini-v3.0 +PROG=$(PROGNAME)-$(VERSION).elf +HEX=$(PROGNAME)-$(VERSION).ihx + +CAL_ELF=$(PROGNAME)-cal-$(VERSION).elf +CAL_HEX=$(PROGNAME)-cal-$(VERSION).ihx + +SRC=$(ALTOS_SRC) ao_telemini.c +OBJ=$(SRC:.c=.o) + +all: $(PROG) $(HEX) + +LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Wl,-Taltos.ld + +$(PROG): Makefile $(OBJ) altos-raw.ld + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) + +$(CAL_ELF): Makefile $(OBJ_CAL) altos-raw.ld + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(CAL_ELF) $(OBJ_CAL) $(LIBS) + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +$(OBJ) $(OBJ_CAL): $(INC) + +load: $(PROG) + lpc-load $(PROG) + +distclean: clean + +clean: + rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx + rm -f ao_product.h + +install: + +uninstall: diff --git a/src/telemini-v3.0/ao_pins.h b/src/telemini-v3.0/ao_pins.h index 7249ece7..351d28d8 100644 --- a/src/telemini-v3.0/ao_pins.h +++ b/src/telemini-v3.0/ao_pins.h @@ -18,12 +18,9 @@ #define HAS_BEEP 1 #define HAS_SERIAL_1 0 #define HAS_BATTERY_REPORT 1 -#define HAS_BOOT_LOADER 0 #define AO_STACK_SIZE 448 -#define RELOCATE_INTERRUPT 0 - #define IS_FLASH_LOADER 0 /* 48MHz clock based on 16MHz reference */ @@ -42,9 +39,10 @@ #define AO_APB_PRESCALER 1 #define AO_RCC_CFGR_PPRE_DIV STM_RCC_CFGR_PPRE_DIV_1 -#define HAS_USB 0 +#define HAS_USB 1 #define AO_USB_DIRECTIO 0 -#define AO_PA11_PA12_RMP 0 +#define AO_PA11_PA12_RMP 1 +#define AO_USB_FORCE_IDLE 1 #define PACKET_HAS_SLAVE 1 @@ -66,29 +64,13 @@ #define USE_INTERNAL_FLASH 0 #define HAS_IGNITE 1 #define HAS_IGNITE_REPORT 1 +#define AO_SMALL_ALTITUDE_TABLE 1 /* Beeper is on Tim1 CH3 */ -#define BEEPER_CHANNEL 3 -#define BEEPER_TIMER 1 +#define BEEPER_CHANNEL 4 +#define BEEPER_TIMER 2 #define BEEPER_PORT (&stm_gpioa) -#define BEEPER_PIN 10 - -/* LED */ -#define LED_PORT_ENABLE STM_RCC_AHBENR_IOPAEN -#define LED_PORT (&stm_gpioa) -#define LED_PIN_GREEN 15 -#define AO_LED_GREEN (1 << 15) -#define AO_LED_PANIC AO_LED_GREEN -#define AO_LED_LOW AO_LED_GREEN -#define AO_LED_MID AO_LED_GREEN - -#define LEDS_AVAILABLE AO_LED_GREEN - -/* Serial. Hooked to the spare pin (PA9/19) and the beeper (PA10/20) */ - -#define SERIAL_1_PA9_PA10 1 -#define USE_SERIAL_1_STDIN HAS_SERIAL_1 -#define DELAY_SERIAL_1_STDIN 0 +#define BEEPER_PIN 3 /* SPI */ @@ -101,16 +83,16 @@ #define M25_MAX_CHIPS 1 #define AO_M25_SPI_CS_PORT (&stm_gpioa) -#define AO_M25_SPI_CS_MASK (1 << 3) +#define AO_M25_SPI_CS_MASK (1 << 4) #define AO_M25_SPI_BUS AO_SPI_1_PA5_PA6_PA7 /* MS5607 */ #define HAS_MS5607 1 #define HAS_MS5611 0 -#define AO_MS5607_PRIVATE_PINS 0 +#define AO_MS5607_PRIVATE_PINS 1 #define AO_MS5607_CS_PORT (&stm_gpioa) -#define AO_MS5607_CS_PIN 4 +#define AO_MS5607_CS_PIN 15 #define AO_MS5607_CS_MASK (1 << AO_MS5607_CS_PIN) #define AO_MS5607_MISO_PORT (&stm_gpiob) #define AO_MS5607_MISO_PIN 4 diff --git a/src/telemini-v3.0/ao_telemini.c b/src/telemini-v3.0/ao_telemini.c index c2c13236..82c1acd4 100644 --- a/src/telemini-v3.0/ao_telemini.c +++ b/src/telemini-v3.0/ao_telemini.c @@ -23,8 +23,6 @@ main(void) { ao_clock_init(); ao_task_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); ao_timer_init(); ao_dma_init(); @@ -38,6 +36,9 @@ main(void) #endif #if HAS_SERIAL_1 ao_serial_init(); +#endif +#if HAS_USB + ao_usb_init(); #endif ao_cmd_init(); diff --git a/src/telemini-v3.0/ao_telemini_calibrate.c b/src/telemini-v3.0/ao_telemini_calibrate.c deleted file mode 100644 index 461810f0..00000000 --- a/src/telemini-v3.0/ao_telemini_calibrate.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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; version 2 of the License. - * - * 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 -#include - -static void -ao_cal(void) -{ - ao_config_get(); -#if HAS_BEEP - ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(500)); -#else - ao_led_for(AO_LED_MID, AO_MS_TO_TICKS(500)); -#endif - for (;;) { - ao_led_on(AO_LED_GREEN); - ao_radio_test_on(); - ao_delay(AO_SEC_TO_TICKS(30)); - ao_led_off(AO_LED_GREEN); - ao_radio_test_off(); - ao_delay(AO_SEC_TO_TICKS(5)); - } -} - -static struct ao_task ao_cal_task; - -void -main(void) -{ - ao_clock_init(); - ao_task_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); - ao_timer_init(); - - ao_dma_init(); - ao_spi_init(); - ao_exti_init(); - -// ao_adc_init(); -#if HAS_BEEP - ao_beep_init(); -#endif -#if HAS_SERIAL_1 - ao_serial_init(); -#endif -// ao_cmd_init(); -// ao_ms5607_init(); - - ao_storage_init(); -// ao_flight_init(); -// ao_log_init(); -// ao_report_init(); -// ao_telemetry_init(); - - ao_radio_init(); -// ao_packet_slave_init(TRUE); -// ao_igniter_init(); - - ao_config_init(); - - ao_add_task(&ao_cal_task, ao_cal, "radio_cal"); - - ao_start_scheduler(); -} -- 2.30.2