From 7f5c8326a5f2c6f32826efe82a5b88da49f5a8a9 Mon Sep 17 00:00:00 2001 From: Pierre-A Date: Mon, 26 Jan 2015 10:10:36 +0100 Subject: [PATCH 1/9] HoTT check serial data improvement --- src/main/telemetry/hott.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/src/main/telemetry/hott.c b/src/main/telemetry/hott.c index 356c1f2b6..a4cfaa65f 100644 --- a/src/main/telemetry/hott.c +++ b/src/main/telemetry/hott.c @@ -110,8 +110,6 @@ static telemetryConfig_t *telemetryConfig; static HOTT_GPS_MSG_t hottGPSMessage; static HOTT_EAM_MSG_t hottEAMMessage; -static bool useSoftserialRxFailureWorkaround = false; - static void initialiseEAMMessage(HOTT_EAM_MSG_t *msg, size_t size) { memset(msg, 0, size); @@ -286,16 +284,6 @@ void configureHoTTTelemetryPort(void) // FIXME only need to do this if the port is shared previousPortMode = hottPort->mode; previousBaudRate = hottPort->baudRate; -#ifdef USE_SOFTSERIAL1 - if (hottPort->identifier == SERIAL_PORT_SOFTSERIAL1) { - useSoftserialRxFailureWorkaround = true; - } -#endif -#ifdef USE_SOFTSERIAL2 - if (hottPort->identifier == SERIAL_PORT_SOFTSERIAL2) { - useSoftserialRxFailureWorkaround = true; - } -#endif } } @@ -378,18 +366,6 @@ static void hottCheckSerialData(uint32_t currentMicros) uint8_t bytesWaiting = serialTotalBytesWaiting(hottPort); - if (useSoftserialRxFailureWorkaround) { - // FIXME The 0x80 is being read as 0x00 - softserial timing/syncronisation problem somewhere. - if (!bytesWaiting) { - return; - } - - uint8_t incomingByte = serialRead(hottPort); - processBinaryModeRequest(incomingByte); - - return; - } - if (bytesWaiting <= 1) { return; } @@ -416,7 +392,7 @@ static void hottCheckSerialData(uint32_t currentMicros) uint8_t requestId = serialRead(hottPort); uint8_t address = serialRead(hottPort); - if (requestId == HOTT_BINARY_MODE_REQUEST_ID) { + if ((requestId == 0) || (requestId == HOTT_BINARY_MODE_REQUEST_ID) || (address == HOTT_TELEMETRY_NO_SENSOR_ID)) { processBinaryModeRequest(address); } } From 57fcde05a3205a942c2c6b1d3f75e6ac8838eca8 Mon Sep 17 00:00:00 2001 From: Nicholas Sherlock Date: Wed, 25 Feb 2015 00:52:25 +1300 Subject: [PATCH 2/9] Blackbox dataflash: Experimental CC3D support --- Makefile | 2 ++ src/main/main.c | 2 +- src/main/target/CC3D/target.h | 8 +++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f3f29edd4..2b47c9967 100644 --- a/Makefile +++ b/Makefile @@ -429,6 +429,8 @@ CC3D_SRC = \ drivers/system_stm32f10x.c \ drivers/timer.c \ drivers/timer_stm32f10x.c \ + drivers/flash_m25p16.c \ + io/flashfs.c \ $(HIGHEND_SRC) \ $(COMMON_SRC) \ $(VCP_SRC) diff --git a/src/main/main.c b/src/main/main.c index 7e530b3f3..6e703d0f3 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -370,7 +370,7 @@ void init(void) m25p16_init(); } #endif -#ifdef SPRACINGF3 +#if defined(SPRACINGF3) || defined(CC3D) m25p16_init(); #endif flashfsInit(); diff --git a/src/main/target/CC3D/target.h b/src/main/target/CC3D/target.h index ed0a7fca8..652bd74f4 100644 --- a/src/main/target/CC3D/target.h +++ b/src/main/target/CC3D/target.h @@ -35,6 +35,13 @@ #define MPU6000_CS_PIN GPIO_Pin_4 #define MPU6000_SPI_INSTANCE SPI1 +#define M25P16_CS_GPIO GPIOB +#define M25P16_CS_PIN GPIO_Pin_12 +#define M25P16_SPI_INSTANCE SPI2 + +#define USE_FLASHFS +#define USE_FLASH_M25P16 + #define USABLE_TIMER_CHANNEL_COUNT 12 #define GYRO @@ -97,7 +104,6 @@ #define RSSI_ADC_GPIO_PIN GPIO_Pin_1 #define RSSI_ADC_CHANNEL ADC_Channel_1 - #define GPS #define LED_STRIP #define LED_STRIP_TIMER TIM3 From a60cdf157aeb3fc8dead3340c91800eabccae80f Mon Sep 17 00:00:00 2001 From: Nicholas Sherlock Date: Sat, 28 Feb 2015 00:56:28 +1300 Subject: [PATCH 3/9] Fix initialisation of SPI2 --- src/main/drivers/bus_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/drivers/bus_spi.c b/src/main/drivers/bus_spi.c index e381fc64e..f2b0cb244 100644 --- a/src/main/drivers/bus_spi.c +++ b/src/main/drivers/bus_spi.c @@ -237,7 +237,7 @@ bool spiInit(SPI_TypeDef *instance) } #endif #ifdef USE_SPI_DEVICE_2 - if (instance == SPI1) { + if (instance == SPI2) { initSpi2(); return true; } From b2e46ea5f4436a0130da00d831dc742d20a31335 Mon Sep 17 00:00:00 2001 From: Nicholas Sherlock Date: Sat, 28 Feb 2015 01:05:28 +1300 Subject: [PATCH 4/9] Update blackbox doc to mention support for CC3d --- docs/Blackbox.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Blackbox.md b/docs/Blackbox.md index e7f4b4f1d..00a57db2c 100644 --- a/docs/Blackbox.md +++ b/docs/Blackbox.md @@ -121,9 +121,9 @@ tubing instead. ![OpenLog installed](Wiring/blackbox-installation-1.jpg "OpenLog installed with double-sided tape, SDCard slot pointing outward") ### Onboard dataflash storage -The full version of the Naze32 has an onboard "m25p16" 2 megayte dataflash storage chip which can be used to store -flight logs instead of using an OpenLog. This is the small chip at the base of the Naze32's direction arrow. -This chip is not present on the "Acro" version of the Naze32. +The full version of the Naze32 and the CC3D have an onboard "m25p16" 2 megayte dataflash storage chip which can be used +to store flight logs instead of using an OpenLog. This is a small chip with 8 fat legs, which can be found at the base +of the Naze32's direction arrow. This chip is not present on the "Acro" version of the Naze32. ## Enabling the Blackbox (CLI) In the [Cleanflight Configurator][] , enter the CLI tab. Enable the Blackbox feature by typing in `feature BLACKBOX` and From 0ac1e8bd110598c48c31c86663a668133514964d Mon Sep 17 00:00:00 2001 From: Nicholas Sherlock Date: Sat, 28 Feb 2015 11:55:36 +1300 Subject: [PATCH 5/9] Use 4.8 series GCC compiler for Travis build tests Since 4.9 is known to create broken CC3D and Sparky builds --- .travis.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 26ade6fb8..749f18a4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,16 @@ env: # We use cpp for unit tests, and c for the main project. language: cpp compiler: clang -before_install: sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded && sudo apt-get update -install: sudo apt-get install build-essential gcc-arm-none-eabi git + +before_install: + - sudo apt-get update + # The PPA doesn't have a package for Trusty for 4.8, so manually download the Saucy build + - wget "http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/pool/main/g/gcc-arm-none-eabi/gcc-arm-none-eabi_4-8-2014q2-0saucy9_amd64.deb" + +install: + - sudo apt-get install build-essential git + - sudo dpkg -i gcc-arm-none-eabi_4-8-2014q2-0saucy9_amd64.deb + before_script: arm-none-eabi-gcc --version script: ./.travis.sh From 095b21b027ed96719c65e95e6c4af0768c88eb59 Mon Sep 17 00:00:00 2001 From: Joel Fuster Date: Sat, 28 Feb 2015 19:26:59 -0500 Subject: [PATCH 6/9] Disable debug vars by default --- src/main/flight/autotune.c | 6 ++++++ src/main/rx/sbus.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/flight/autotune.c b/src/main/flight/autotune.c index bfc0f53b2..6276f95d2 100644 --- a/src/main/flight/autotune.c +++ b/src/main/flight/autotune.c @@ -270,7 +270,9 @@ float autotune(angle_index_t angleIndex, const rollAndPitchInclination_t *inclin firstPeakAngle = currentAngle; targetAngleAtPeak = targetAngle; +#ifdef DEBUG_AUTOTUNE debug[3] = DEGREES_TO_DECIDEGREES(firstPeakAngle); +#endif } else if (firstPeakAngle > 0) { switch (cycle) { @@ -320,7 +322,9 @@ float autotune(angle_index_t angleIndex, const rollAndPitchInclination_t *inclin if (currentAngle < secondPeakAngle) { secondPeakAngle = currentAngle; +#ifdef DEBUG_AUTOTUNE debug[3] = DEGREES_TO_DECIDEGREES(secondPeakAngle); +#endif } float oscillationAmplitude = firstPeakAngle - secondPeakAngle; @@ -395,9 +399,11 @@ float autotune(angle_index_t angleIndex, const rollAndPitchInclination_t *inclin } } +#ifdef DEBUG_AUTOTUNE if (angleIndex == AI_ROLL) { debug[0] += 100; } +#endif updateTargetAngle(); diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 85dd83ebf..826bea0d2 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -50,7 +50,7 @@ #define SBUS_TIME_NEEDED_PER_FRAME 3000 #ifndef CJMCU -#define DEBUG_SBUS_PACKETS +//#define DEBUG_SBUS_PACKETS #endif #ifdef DEBUG_SBUS_PACKETS From 12851f78d09dc63a4a0ef0dd5f8cfa88de44fb91 Mon Sep 17 00:00:00 2001 From: Nicholas Sherlock Date: Sun, 1 Mar 2015 14:05:20 +1300 Subject: [PATCH 7/9] Download binary version of GCC 4.8 instead of Ubuntu package --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 749f18a4f..41bab7da4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,12 +20,12 @@ compiler: clang before_install: - sudo apt-get update - # The PPA doesn't have a package for Trusty for 4.8, so manually download the Saucy build - - wget "http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/pool/main/g/gcc-arm-none-eabi/gcc-arm-none-eabi_4-8-2014q2-0saucy9_amd64.deb" + - wget "https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q3-update/+download/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2" install: - - sudo apt-get install build-essential git - - sudo dpkg -i gcc-arm-none-eabi_4-8-2014q2-0saucy9_amd64.deb + - sudo apt-get install build-essential git libc6-i386 + - tar -xf gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 + - export PATH=$PATH:$PWD/gcc-arm-none-eabi-4_8-2014q3/bin before_script: arm-none-eabi-gcc --version script: ./.travis.sh From bc5f48a7e9e306a039c08daf8914948b949a826a Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Mon, 2 Mar 2015 11:31:34 +0000 Subject: [PATCH 8/9] Ensure that travis uses 4.x of GCC. Ideally we want to use 4.8.x but the binary repository does not contain 4.8 any more, only 4.9.x. The CC3D build will continue to fail until th code size issue is addressed. --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 26ade6fb8..16e930a7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,10 @@ env: # We use cpp for unit tests, and c for the main project. language: cpp compiler: clang -before_install: sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded && sudo apt-get update -install: sudo apt-get install build-essential gcc-arm-none-eabi git +before_install: + - sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded + - sudo apt-get update +install: sudo apt-get install build-essential gcc-arm-none-eabi=4.* git before_script: arm-none-eabi-gcc --version script: ./.travis.sh From 266fe45b7ea14b1739cd9d101ecadf1c854729e2 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Mon, 2 Mar 2015 11:50:15 +0000 Subject: [PATCH 9/9] Temporarily disable autotune on the CC3D OPBL binary. --- .travis.yml | 2 +- Makefile | 1 + src/main/target/CC3D/target.h | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 16e930a7e..e6dadb5e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ env: - RUNTESTS=True - TARGET=CC3D - - TARGET=CC3D OPBL=yes + - TARGET=CC3D OPBL=yes - TARGET=CHEBUZZF3 - TARGET=CJMCU - TARGET=EUSTM32F103RC diff --git a/Makefile b/Makefile index bb8cdfbd5..03b74853e 100644 --- a/Makefile +++ b/Makefile @@ -374,6 +374,7 @@ endif ifeq ($(OPBL),yes) ifneq ($(filter $(TARGET),$(OPBL_VALID_TARGETS)),) +TARGET_FLAGS := -DOPBL $(TARGET_FLAGS) LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f103_128k_opbl.ld .DEFAULT_GOAL := binary else diff --git a/src/main/target/CC3D/target.h b/src/main/target/CC3D/target.h index 652bd74f4..b7a6c8224 100644 --- a/src/main/target/CC3D/target.h +++ b/src/main/target/CC3D/target.h @@ -114,6 +114,10 @@ #define AUTOTUNE #define USE_SERVOS +#if defined(OPBL) +#undef AUTOTUNE // disabled for OPBL build due to code size. +#endif + #define SPEKTRUM_BIND // USART3, PB11 (Flexport) #define BIND_PORT GPIOB