Ajout FishPeper

This commit is contained in:
Serge NOEL
2026-04-21 12:19:15 +02:00
parent 6744da3f88
commit 0c361a2440
2160 changed files with 589301 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
# AFRX target
AlienFlight CC2510 based receiver

104
OpenSky/board/afrx/config.h Normal file
View File

@@ -0,0 +1,104 @@
// pin layout ISP header
#define ISP_DATA P2_1
#define ISP_CLOCK P2_2
// note: change of adc ch require change in adc.c!
#define ADC_PORT P0
#define ADC0 6
#define ADC1 7
// acs712 in inverted mode on adc1?
// when powered by 5V we can use a trick
// to get a good resolution: use inverted power inputs
// 0A = 2.5V
// 30A = 0.0V
#define ADC1_USE_ACS712
// voltage divider on my board is 10 / 1 k, scale to 100 / 10
#define ADC0_DIVIDER_A 100
#define ADC0_DIVIDER_B 10
#define BIND_PORT P1
#define BIND_PIN 1
// LEDs
#define LED_GREEN_PORT P2
#define LED_GREEN_PIN 4
#define LED_RED_PORT P2
#define LED_RED_PIN 3
// DEBUG
#define DEBUG_UART USART0_P0
// SBUS
// enable SBUS output -> this will DISABLE ppm!
#define SBUS_ENABLED
#define SBUS_UART USART1_P0
// Note: default/futaba is INVERTED=1! (use this for a cc3d etc)
// inverted => idle = LOW
// non inverted => idle = high
// #define SBUS_INVERTED
// PPM (only used if sbus is disabled)
// invert SBUS output (normal is non inverted)
// #define PPM_INVERTED
// hub telemetry input (soft serial)
#define HUB_TELEMETRY_ON_SBUS_UART
// #define HUB_TELEMETRY_INVERTED
#ifndef HUB_TELEMETRY_ON_SBUS_UART
// if not shared with sbus, use any pin in softserial mode at 9600baud
#define HUB_TELEMETRY_PORT P0
#define HUB_TELEMETRY_PIN 5
#endif
// LNA control pin
#define RF_LNA_PORT P1
#define RF_LNA_PIN 6
#define RF_LNA_ON_LEVEL 1
// PA control pin
#define RF_PA_PORT P1
#define RF_PA_PIN 4
#define RF_PA_ON_LEVEL 1
// Antenna switch control pin
#define RF_ANTENNA_SWITCH_PORT P1
#define RF_ANTENNA_SWITCH_PIN 5
#define RF_ANTENNA_A_LEVEL 1
// enable High Gain?
#define RF_HIGH_GAIN_MODE_ENABLED
// Gain control pin
#define RF_HIGH_GAIN_MODE_PORT P1
#define RF_HIGH_GAIN_MODE_PIN 7
#define RF_HIGH_GAIN_MODE_ON_LEVEL 1
// enable Bypass?
// #define RF_BYPASS_MODE_ENABLED
// Bypass control pin
#define RF_BYPASS_MODE_PORT P1
#define RF_BYPASS_MODE_PIN 3
#define RF_BYPASS_MODE_ON_LEVEL 1
// bootloader config
#define BOOTLOADER_LED_GREEN_PORT LED_GREEN_PORT
#define BOOTLOADER_LED_GREEN_PIN LED_GREEN_PIN
#define BOOTLOADER_LED_RED_PORT LED_RED_PORT
#define BOOTLOADER_LED_RED_PIN LED_RED_PIN
// bootloader runs on UART1 P0
#define BOOTLOADER_UART_NUM 1
#define BOOTLOADER_UART_PORT 0
#define BOOTLOADER_UART_INVERTED 0
#define BOOTLOADER_UART_BAUDRATE 100000
#define BOOTLOADER_UART_USE_PARITY 0
#define BOOTLOADER_UART_USE_2STOPBITS 0
// use ISP interface clock pin as bootloader enable pin
// pull this low during startup to enter bootloader mode
#define BOOTLOADER_ENABLE_PORT P2
#define BOOTLOADER_ENABLE_PIN 2
#define DEFAULT_FSCAL_VALUE -69

View File

@@ -0,0 +1,8 @@
# configuration of this board
# cc2510f16 has 16k flash -> 0x4000
# cc2510f32 has 32k flash -> 0x8000
FLASH_SIZE=0x8000
# continue with normal cc251x build
ARCH_DIR = arch/cc251x
ARCH_MAKEFILE = $(ARCH_DIR)/cc251x.mk

View File

@@ -0,0 +1,2 @@
# d4r-ii target

View File

@@ -0,0 +1,202 @@
#ifndef __PIN_CONFIG_H__
#define __PIN_CONFIG_H__
#include "main.h"
#define LED_GPIO GPIOA
#define LED_GPIO_CLK RCC_APB2Periph_GPIOA
#define LED_GPIO_CLK_RCC 2
#define LED_RED_PIN GPIO_Pin_11
#define LED_GREEN_PIN GPIO_Pin_12
// usually you want to have sbus inverted and hub telemetry inverted
// both will run at sbus baudrate. current betafligh versions allow
// shared frsky sbus and hub telemetry on the same uart port !
// enable SBUS output -> this will DISABLE ppm!
#define SBUS_ENABLED
// Note: default/futaba is INVERTED=1! (use this for a cc3d etc)
// inverted => idle = LOW
// non inverted => idle = high
#define SBUS_INVERTED
// PPM (only used if sbus is disabled)
// #define PPM_INVERTED
// hub telemetry input (soft serial if only HUB_TELEMETRY_INVERTED, sbus uart if HUB_TELEMETRY_ON_SBUS_UART)
#define HUB_TELEMETRY_ON_SBUS_UART
#define HUB_TELEMETRY_INVERTED
#ifdef SBUS_INVERTED
// DEBUG is on SERVO4 output:
#define DEBUG_USART USART3
#define DEBUG_USART_CLK RCC_APB1Periph_USART3
#define DEBUG_USART_CLK_RCC 1
#define DEBUG_USART_GPIO GPIOB
#define DEBUG_USART_GPIO_CLK RCC_APB2Periph_GPIOB
#define DEBUG_USART_GPIO_CLK_RCC 2
#define DEBUG_USART_TX_PIN GPIO_Pin_10
#define DEBUG_USART_IRQHANDLER USART3_IRQHandler
#define DEBUG_USART_IRQn USART3_IRQn
// SBUS is INVERTED on 4 pin header TX pin
#define SBUS_USART USART1
#define SBUS_USART_CLK RCC_APB2Periph_USART1
#define SBUS_USART_RCC 2
#define SBUS_USART_GPIO GPIOA
#define SBUS_USART_GPIO_CLK RCC_APB2Periph_GPIOA
#define SBUS_USART_GPIO_CLK_RCC 2
#define SBUS_USART_TX_PIN GPIO_Pin_9
#define SBUS_USART_IRQHANDLER USART1_IRQHandler
#define SBUS_USART_IRQn USART1_IRQn
#else
// DEBUG is INVERTED(!) on 4pin header TX pin
#define DEBUG_USART USART1
#define DEBUG_USART_CLK RCC_APB2Periph_USART1
#define DEBUG_USART_CLK_RCC 2
#define DEBUG_USART_GPIO GPIOA
#define DEBUG_USART_GPIO_CLK RCC_APB2Periph_GPIOA
#define DEBUG_USART_GPIO_CLK_RCC 2
#define DEBUG_USART_TX_PIN GPIO_Pin_9
#define DEBUG_USART_IRQHANDLER USART1_IRQHandler
#define DEBUG_USART_IRQn USART1_IRQn
// SBUS is non-inverted on SERVO4 output:
#define SBUS_USART USART3
#define SBUS_USART_CLK RCC_APB1Periph_USART3
#define SBUS_USART_RCC 1
#define SBUS_USART_GPIO GPIOB
#define SBUS_USART_GPIO_CLK RCC_APB2Periph_GPIOB
#define SBUS_USART_GPIO_CLK_RCC 2
#define SBUS_USART_TX_PIN GPIO_Pin_10
#define SBUS_USART_IRQHANDLER USART3_IRQHandler
#define SBUS_USART_IRQn USART3_IRQn
#endif
#define CC25XX_SPI_GPIO GPIOA
#define CC25XX_SPI_SCK_PIN GPIO_Pin_5
#define CC25XX_SPI_MOSI_PIN GPIO_Pin_7
#define CC25XX_SPI_MISO_PIN GPIO_Pin_6
#define CC25XX_SPI_CSN_PIN GPIO_Pin_4
#define CC25XX_SPI_GDO2_PIN GPIO_Pin_3
#define CC25XX_SPI SPI1
#define CC25XX_SPI_CLK RCC_APB2Periph_SPI1
#define CC25XX_SPI_CLK_RCC 2
#define CC25XX_SPI_GPIO_CLK RCC_APB2Periph_GPIOA
#define CC25XX_SPI_DMA_CLOCK RCC_AHBPeriph_DMA1
#define CC25XX_SPI_TX_DMA_CHANNEL DMA1_Channel3
#define CC25XX_SPI_TX_DMA_TC_FLAG DMA1_FLAG_TC3
#define CC25XX_SPI_RX_DMA_CHANNEL DMA1_Channel2
#define CC25XX_SPI_RX_DMA_TC_FLAG DMA1_FLAG_TC2
#define CC25XX_ANT_SW_CTX_GPIO GPIOC
#define CC25XX_ANT_SW_CTX_GPIO_CLK RCC_APB2Periph_GPIOC
#define CC25XX_ANT_SW_CTX_GPIO_CLK_RCC 2
#define CC25XX_ANT_SW_CTX_PIN GPIO_Pin_15
#define CC25XX_ANT_SW_CRX_GPIO GPIOC
#define CC25XX_ANT_SW_CRX_GPIO_CLK RCC_APB2Periph_GPIOC
#define CC25XX_ANT_SW_CRX_GPIO_CLK_RCC 2
#define CC25XX_ANT_SW_CRX_PIN GPIO_Pin_14
#define CC25XX_LNA_SW_CTX_GPIO GPIOA
#define CC25XX_LNA_SW_CTX_GPIO_CLK RCC_APB2Periph_GPIOA
#define CC25XX_LNA_SW_CTX_GPIO_CLK_RCC 2
#define CC25XX_LNA_SW_CTX_PIN GPIO_Pin_15
#define CC25XX_LNA_SW_CRX_GPIO GPIOB
#define CC25XX_LNA_SW_CRX_GPIO_CLK RCC_APB2Periph_GPIOB
#define CC25XX_LNA_SW_CRX_GPIO_CLK_RCC 2
#define CC25XX_LNA_SW_CRX_PIN GPIO_Pin_4
#define CC25XX_GDO2_GPIO GPIOA
#define CC25XX_GDO2_PIN GPIO_Pin_3
#define CC25XX_GDO2_GPIO_CLK RCC_APB2Periph_GPIOA
#define CC25XX_GDO2_GPIO_CLK_RCC 2
#define BIND_JUMPER_GPIO GPIOA
#define BIND_JUMPER_PIN GPIO_Pin_8
#define BIND_JUMPER_GPIO_CLK RCC_APB2Periph_GPIOA
#define BIND_JUMPER_GPIO_CLK_RCC 2
#define EEPROM_GPIO GPIOB
#define EEPROM_GPIO_CLK RCC_APB2Periph_GPIOB
#define EEPROM_GPIO_CLK_RCC 2
#define EEPROM_I2C I2C1
#define EEPROM_I2C_CLK RCC_APB1Periph_I2C1
#define EEPROM_I2C_CLK_RCC 1
#define EEPROM_I2C_SDA_PIN GPIO_Pin_7
#define EEPROM_I2C_SCL_PIN GPIO_Pin_6
#define EEPROM_WP_PIN GPIO_Pin_8
// A2=LO, A1=LO, A0=HI on pcb
#define EEPROM_I2C_ADDRESS 0xA2
#define ADC_GPIO GPIOA
#define ADC_GPIO_CLK RCC_APB2Periph_GPIOA
#define ADC_GPIO_CLK_RCC 2
#define ADC_CLK RCC_APB2Periph_ADC1
#define ADC_CLK_RCC 2
#define ADC_IN1_PIN GPIO_Pin_1
#define ADC_IN2_PIN GPIO_Pin_2
#define ADC_DMA_CHANNEL DMA1_Channel1
#define ADC_DMA_TC_FLAG DMA1_FLAG_TC1
#define ADC ADC1
// ppm output
#define PPM_GPIO GPIOB
#define PPM_GPIO_CLK RCC_APB2Periph_GPIOB
#define PPM_GPIO_CLK_RCC 2
#define PPM_PIN GPIO_Pin_0
#define PPM_TIMER TIM3
#define PPM_TIMER_CLK RCC_APB1Periph_TIM3
#define PPM_TIMER_CLK_RCC 1
#define PPM_TIMER_CH TIM_Channel_3
#define PPM_TIMER_IRQHANDLER TIM3_IRQHandler
#define PPM_TIMER_IRQn TIM3_IRQn
// soft spi for apa102 led
#define SOFT_SPI_GPIO GPIOB
#define SOFT_SPI_GPIO_CLK RCC_APB2Periph_GPIOB
#define SOFT_SPI_GPIO_CLK_RCC 2
#define SOFT_SPI_MOSI GPIO_Pin_1
#define SOFT_SPI_SCK GPIO_Pin_2
#ifndef HUB_TELEMETRY_ON_SBUS_UART
// hub telemetry input NOTE: this has to be a timer io
#define SOFT_SERIAL_PIN_HAS_INVERTER // there is an inverter on GPIOA.10!
#define SOFT_SERIAL_GPIO GPIOA
#define SOFT_SERIAL_CLK RCC_APB2Periph_GPIOA
#define SOFT_SERIAL_CLK_RCC 2
#define SOFT_SERIAL_PIN GPIO_Pin_10
#define SOFT_SERIAL_TIMER TIM1
#define SOFT_SERIAL_TIMER_CLK RCC_APB2Periph_TIM1
#define SOFT_SERIAL_TIMER_CLK_RCC 2
#define SOFT_SERIAL_TIMER_IT_IC TIM_IT_CC3
#define SOFT_SERIAL_TIMER_CH TIM_Channel_3
#define SOFT_SERIAL_TIMER_GET_CAPTURE() TIM_GetCapture3(SOFT_SERIAL_TIMER)
#define SOFT_SERIAL_TIMER_IT_UP TIM_IT_Update
#define SOFT_SERIAL_TIMER_IC_IRQHandler TIM1_CC_IRQHandler
#define SOFT_SERIAL_TIMER_UP_IRQHandler TIM1_UP_TIM16_IRQHandler
#define SOFT_SERIAL_TIMER_IC_IRQn TIM1_CC_IRQn
#define SOFT_SERIAL_TIMER_UP_IRQn TIM1_UP_IRQn
#endif // hub telemetry on softserial
// THIS CONFIGURES IRQ PRIORITIES - DO NOT MESS THIS UP!
// this is the most critical stuff:
#define NVIC_PRIO_PPM 1
// sbus is a tx interrupt, this can be delayed at no cost
#define NVIC_PRIO_SBUS 6
// this is very time critical, but as telemetry data is not that important
// we allow this to be interrupted (=corrupted) occasionally
#define NVIC_PRIO_SOFT_SERIAL 2
// debugging data is not critical
#define NVIC_PRIO_DEBUG_UART 7
// systick prio
#define NVIC_PRIO_SYSTICK 0
#define DEFAULT_FSCAL_VALUE -62
#endif // __PIN_CONFIG_H__

View File

@@ -0,0 +1,4 @@
# continue with normal stm32f1 build
ARCH_DIR = arch/stm32f1
ARCH_MAKEFILE = $(ARCH_DIR)/stm32f1.mk

View File

@@ -0,0 +1,26 @@
# Raspberry target
This is a target to build OpenSky and run using a raspberry pi, with an CC2500 chip connected directly to the spi bus. Using the raspberry target is an easy way for experimenting with the code.
OpenSky requires good timing to be able to do frequency hoping correctly, but an ideling raspberry pi seems to do just fine.
Here is how i connected up my module:
<pre>
Raspberry Pi V2 CC2500
16 GPIO23 GDO2
17 VCC VCC
19 MOSI SI
21 MISO SO
23 SCLK SCLK
25 GND GND
03 GPIO02 LNA (Optional, if your chip have LNA)
05 GPIO03 PA (Optional, if your chip have PA)
37 GPIO26 BIND (pull up to enter bind mode)
08 TXD SBUS (output using hardware uart)
40 GPIO21 PPM (software bit banged, low quality)
</pre>

View File

@@ -0,0 +1 @@
#define DEFAULT_FSCAL_VALUE 0

View File

@@ -0,0 +1,101 @@
# object files
DRIVER_SRCS =
HAL_SRCS := hal_adc.c \
hal_cc25xx.c \
hal_io.c \
hal_sbus.c \
hal_soft_serial.c \
hal_spi.c \
hal_storage.c \
hal_timeout.c \
hal_uart.c \
hal_wdt.c \
hal_ppm.c \
hal_debug.c
ARCH_DIR = arch/rasp
ARCH_SRCS := $(addprefix $(ARCH_DIR)/, $(HAL_SRCS))
ARCH_HEADERS := $(ARCH_SRCS:.c=.h)
BOARD_SRCS := $(ARCH_SRCS) \
$(GENERIC_SRCS)
# fetch this dir during include
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
#name of executable
RESULT ?= opensky_$(notdir $(TARGET_LC))
#faster build
MAKEFLAGS+="-j1 "
#opt
CFLAGS += -O1 -g
# Tool path, only override if not set
TOOLROOT ?= /usr/bin
# Tools (note: for cross compiling we use gcc as linker!)
CC = gcc
LD = gcc
AR = ar
AS = gcc
OBJ = objcopy
# Search path for standard files
vpath %.c $(SRC_DIR)
vpath %.c $(ARCH_DIR)
# Search path for perpheral library
vpath %.c $(CORE)
vpath %.c $(PERIPH)/src
vpath %.c $(DEVICE)
# Processor specific
PTYPE = RASP
# Compilation Flags
FULLASSERT = -DUSE_FULL_ASSERT
INCLUDE_DIRS := $(INCLUDE_DIRS) \
$(SELF_DIR) \
$(SRC_DIR) \
$(DEVICE) \
$(CORE) \
$(PERIPH)/inc \
$(ARCH_DIR)
CFLAGS += $(addprefix -I,$(INCLUDE_DIRS)) \
-D$(PTYPE) \
-DUSE_STDPERIPH_DRIVER \
$(FULLASSERT) \
-DBUILD_TARGET=$(TARGET_LC)
TARGET_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $(BOARD_SRCS))))
TARGET_DEPS = $(addsuffix .d,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $(BOARD_SRCS))))
# Build executable
board: $(OBJECT_DIR)/$(RESULT)
$(OBJECT_DIR)/$(RESULT): $(TARGET_OBJS)
$(V1) exit
$(V1) echo Linking: $(TARGET)
$(V1) $(LD) -o $@ $^ $(LDFLAGS)
# compile and generate dependency info
$(OBJECT_DIR)/$(TARGET)/%.o: %.c
$(V1) mkdir -p $(dir $@)
$(V1) echo "%% $(notdir $<)" "$(STDOUT)" && \
$(CC) -c -o $@ $(CFLAGS) $<
$(OBJECT_DIR)/$(TARGET)/%.o: %.s
$(V1) mkdir -p $(dir $@)
$(V1) echo "%% $(notdir $<)" "$(STDOUT)"
$(V1) $(CC) -c $(CFLAGS) $(DEPFLAGS) $< -o $@
clean:
$(V1) echo Cleaning: $(TARGET)
$(V1) rm -f $(OBJECT_DIR)/$(TARGET)/*.o $(OBJECT_DIR)/$(TARGET)/*.d
.PHONY: board clean flash debug

View File

@@ -0,0 +1,4 @@
# tinyFISH target
this code runs on my custom tinyFISH all-in-one flight controller
more coming soon...

View File

@@ -0,0 +1,76 @@
// pin layout ISP header
#define ISP_DATA P2_1
#define ISP_CLOCK P2_2
// NOT USED
#define PPM_OUT_PIN 4
// NOT USED
#define ADC_PORT P0
#define ADC0 5
#define ADC1 6
// #define ADC1_USE_ACS712
// voltage divider on my board is 10 / 5.6 k, scale to 100 / 56 to avoid floating point calc
#define ADC0_DIVIDER_A 100
#define ADC0_DIVIDER_B 56
#define BIND_PORT P0
#define BIND_PIN 3
#define BIND2_PORT P2
#define BIND2_PIN 2
// LEDS
#define LED_GREEN_PORT P0
#define LED_GREEN_PIN 4
#define LED_RED_PORT P0
#define LED_RED_PIN 1
// DEBUG
#define DEBUG_UART USART1_P0
// SBUS
// enable SBUS output -> this will DISABLE ppm!
#define SBUS_ENABLED
#define SBUS_UART USART0_P1
// Note: default/futaba is INVERTED=1! (use this for a cc3d etc)
// inverted => idle = LOW
// non inverted => idle = high
// #define SBUS_INVERTED
// PPM (only used if sbus is disabled)
// invert SBUS output (normal is non inverted)
// #define PPM_INVERTED
// hub telemetry input (soft serial)
#define HUB_TELEMETRY_ON_SBUS_UART
// #define HUB_TELEMETRY_INVERTED
#ifndef HUB_TELEMETRY_ON_SBUS_UART
// if not shared with sbus, use any pin in softserial mode at 9600baud
#define HUB_TELEMETRY_PORT P1
#define HUB_TELEMETRY_PIN 3
#endif
// bootloader config
#define BOOTLOADER_LED_GREEN_PORT LED_GREEN_PORT
#define BOOTLOADER_LED_GREEN_PIN LED_GREEN_PIN
#define BOOTLOADER_LED_RED_PORT LED_RED_PORT
#define BOOTLOADER_LED_RED_PIN LED_RED_PIN
// bootloader runs on UART0 P1
#define BOOTLOADER_UART_NUM 0
#define BOOTLOADER_UART_PORT 1
#define BOOTLOADER_UART_INVERTED 0
#define BOOTLOADER_UART_BAUDRATE 100000
#define BOOTLOADER_UART_USE_PARITY 1
#define BOOTLOADER_UART_USE_2STOPBITS 1
// use ISP interface clock pin as bootloader enable pin
// pull this low during startup to enter bootloader mode
#define BOOTLOADER_ENABLE_PORT P2
#define BOOTLOADER_ENABLE_PIN 1
#define DEFAULT_FSCAL_VALUE -69

View File

@@ -0,0 +1,9 @@
# configuration of this board
# cc2510f16 has 16k flash -> 0x4000
# cc2510f32 has 32k flash -> 0x8000
FLASH_SIZE=0x8000
# continue with normal cc251x build
ARCH_DIR = arch/cc251x
ARCH_MAKEFILE =$(ARCH_DIR)/cc251x.mk

View File

@@ -0,0 +1,3 @@
# vd5m target
this runs on a vd5m board

View File

@@ -0,0 +1,77 @@
// pin layout ISP header
#define ISP_DATA P2_1
#define ISP_CLOCK P2_2
// pin layout servo connection
#define SERVO_1 7 // P0_7 = BIND, pull down on startup to enter bind mode
#define SERVO_2 6 // P0_6 = ADC1 = voltage sensor (max 3.3V on I/O ! -> voltage divider necessary!)
#define SERVO_3 5 // P0_5 = ADC0 = current sensor (max 3.3V on I/O !)
#define SERVO_4 4 // P0_4 = PPM or SBUS OUT
#define SERVO_5 3 // P0_3 = debug UART
#define PPM_OUT_PIN SERVO_4
// note: change of adc ch require change in adc.c!
#define ADC_PORT P0
// make sure not to use SERVO_3
#define ADC0 SERVO_2
#define ADC1 SERVO_2
// voltage divider on my board is 10 / 3.3 k, scale to 100 / 33 to avoid floating point calc
#define ADC0_DIVIDER_A 100
#define ADC0_DIVIDER_B 33
#define BIND_PORT P0
#define BIND_PIN SERVO_1
// leds
#define LED_GREEN_PORT P2
#define LED_GREEN_PIN 4
#define LED_RED_PORT P2
#define LED_RED_PIN 3
// DEBUG
#define DEBUG_UART USART0_P0
// SBUS
// enable SBUS output -> this will DISABLE ppm!
#define SBUS_ENABLED
#define SBUS_UART USART1_P0
// Note: default/futaba is INVERTED=1! (use this for a cc3d etc)
// inverted => idle = LOW
// non inverted => idle = high
// #define SBUS_INVERTED
// PPM (only used if sbus is disabled)
// invert SBUS output (normal is non inverted)
// #define PPM_INVERTED
// hub telemetry input (soft serial)
#define HUB_TELEMETRY_ON_SBUS_UART
// #define HUB_TELEMETRY_INVERTED
#ifndef HUB_TELEMETRY_ON_SBUS_UART
// if not shared with sbus, use any pin in softserial mode at 9600baud
#define HUB_TELEMETRY_PORT P0
#define HUB_TELEMETRY_PIN 7
#endif
// bootloader config
#define BOOTLOADER_LED_GREEN_PORT LED_GREEN_PORT
#define BOOTLOADER_LED_GREEN_PIN LED_GREEN_PIN
#define BOOTLOADER_LED_RED_PORT LED_RED_PORT
#define BOOTLOADER_LED_RED_PIN LED_RED_PIN
// bootloader runs on UART1 P0
#define BOOTLOADER_UART_NUM 1
#define BOOTLOADER_UART_PORT 0
#define BOOTLOADER_UART_INVERTED 0
#define BOOTLOADER_UART_BAUDRATE 100000
#define BOOTLOADER_UART_USE_PARITY 1
#define BOOTLOADER_UART_USE_2STOPBITS 1
// use ISP interface clock pin as bootloader enable pin
// pull this low during startup to enter bootloader mode
#define BOOTLOADER_ENABLE_PORT P2
#define BOOTLOADER_ENABLE_PIN 2
#define DEFAULT_FSCAL_VALUE -20

View File

@@ -0,0 +1,9 @@
# configuration of this board
# cc2510f16 has 16k flash -> 0x4000
# cc2510f32 has 32k flash -> 0x8000
FLASH_SIZE=0x4000
# continue with normal cc251x build
ARCH_DIR = arch/cc251x
ARCH_MAKEFILE = $(ARCH_DIR)/cc251x.mk

View File

@@ -0,0 +1,3 @@
# uSKY target
this runs on my tiny 0.4g diy receiver - see http://fishpepper.de/projects/usky

View File

@@ -0,0 +1,90 @@
// pin layout ISP header
#define ISP_DATA P2_1
#define ISP_CLOCK P2_2
#define PPM_OUT_PIN 4
// note: change of adc ch require change in adc.c!
#define ADC_PORT P0
#define ADC0 6
#define ADC1 6
// acs712 in inverted mode on adc1?
// #define ADC1_USE_ACS712
// voltage divider on my board is 10 / 5.6 k, scale to 100 / 56 to avoid floating point calc
#define ADC0_DIVIDER_A 100
#define ADC0_DIVIDER_B 56
// DBG DATA
#define BIND_PORT P2
#define BIND_PIN 1
// leds
#define LED_GREEN_PORT P1
#define LED_GREEN_PIN 1
#define LED_RED_PORT P2
#define LED_RED_PIN 3
// DEBUG
#define DEBUG_UART USART0_P0
// SBUS
// enable SBUS output -> this will DISABLE ppm!
#define SBUS_ENABLED
#define SBUS_UART USART1_P0
// Note: default/futaba is INVERTED=1! (use this for a cc3d etc)
// inverted => idle = LOW
// non inverted => idle = high
// #define SBUS_INVERTED
// PPM (only used if sbus is disabled)
// invert SBUS output (normal is non inverted)
// #define PPM_INVERTED
// hub telemetry input (soft serial)
#define HUB_TELEMETRY_ON_SBUS_UART
// #define HUB_TELEMETRY_INVERTED
#ifndef HUB_TELEMETRY_ON_SBUS_UART
// if not shared with sbus, use any pin in softserial mode at 9600baud
#define HUB_TELEMETRY_PORT P0
#define HUB_TELEMETRY_PIN 7
#endif
// LNA control pin
// #define RF_LNA_PORT P0
// #define RF_LNA_PIN 0
// #define RF_LNA_ON_LEVEL 1
// PA control pin
// #define RF_PA_PORT P0
// #define RF_PA_PIN 1
// #define RF_PA_ON_LEVEL 1
// enable high gain?
// #define RF_HIGH_GAIN_MODE_ENABLED
// gain control pin
// #define RF_HIGH_GAIN_MODE_PORT P1
// #define RF_HIGH_GAIN_MODE_PIN 0
// #define RF_HIGH_GAIN_MODE_ON_LEVEL 1
// bootloader config
#define BOOTLOADER_LED_GREEN_PORT LED_GREEN_PORT
#define BOOTLOADER_LED_GREEN_PIN LED_GREEN_PIN
#define BOOTLOADER_LED_RED_PORT LED_RED_PORT
#define BOOTLOADER_LED_RED_PIN LED_RED_PIN
// bootloader runs on UART1 P0
#define BOOTLOADER_UART_NUM 1
#define BOOTLOADER_UART_PORT 0
#define BOOTLOADER_UART_INVERTED 0
#define BOOTLOADER_UART_BAUDRATE 100000
#define BOOTLOADER_UART_USE_PARITY 0
#define BOOTLOADER_UART_USE_2STOPBITS 1
// use ISP interface clock pin as bootloader enable pin
// pull this low during startup to enter bootloader mode
#define BOOTLOADER_ENABLE_PORT P2
#define BOOTLOADER_ENABLE_PIN 2
#define DEFAULT_FSCAL_VALUE -69

View File

@@ -0,0 +1,9 @@
# configuration of this board
# cc2510f16 has 16k flash -> 0x4000
# cc2510f32 has 32k flash -> 0x8000
FLASH_SIZE=0x8000
# continue with normal cc251x build
ARCH_DIR = arch/cc251x
ARCH_MAKEFILE = $(ARCH_DIR)/cc251x.mk

View File

@@ -0,0 +1,3 @@
# vd5m target
this runs on a vd5m board

View File

@@ -0,0 +1,88 @@
// pin layout ISP header
#define ISP_DATA P2_1
#define ISP_CLOCK P2_2
// pin layout servo connection
#define SERVO_1 7 // P0_7 = BIND, pull down on startup to enter bind mode
#define SERVO_2 6 // P0_6 = ADC1 = voltage sensor (max 3.3V on I/O ! -> voltage divider necessary!)
#define SERVO_3 5 // P0_5 = ADC0 = current sensor (max 3.3V on I/O !)
#define SERVO_4 4 // P0_4 = PPM or SBUS OUT
#define SERVO_5 3 // P0_3 = debug UART
#define PPM_OUT_PIN SERVO_4
#define BIND_PORT P0
#define BIND_PIN SERVO_1
// leds
#define LED_GREEN_PORT P2
#define LED_GREEN_PIN 4
#define LED_RED_PORT P2
#define LED_RED_PIN 3
// DEBUG
#define DEBUG_UART USART0_P0
// SBUS
// enable SBUS output -> this will DISABLE ppm!
#define SBUS_ENABLED
#define SBUS_UART USART1_P0
// Note: default/futaba is INVERTED=1! (use this for a cc3d etc)
// inverted => idle = LOW
// non inverted => idle = high
#define SBUS_INVERTED
// PPM (only used if sbus is disabled)
// invert SBUS output (normal is non inverted)
// #define PPM_INVERTED
// hub telemetry input (soft serial)
#define HUB_TELEMETRY_ON_SBUS_UART
#define HUB_TELEMETRY_INVERTED
#ifndef HUB_TELEMETRY_ON_SBUS_UART
// if not shared with sbus, use any pin in softserial mode at 9600baud
#define HUB_TELEMETRY_PORT P0
#define HUB_TELEMETRY_PIN 7
#endif
// note: change of adc ch require change in adc.c!
#define ADC_PORT P0
#ifdef HUB_TELEMETRY_ON_SBUS_UART
// free up SERVO_3 for hub telemetry input!
#define ADC0 SERVO_2
#define ADC1 SERVO_2
#else
#define ADC0 SERVO_2
#define ADC1 SERVO_3
#endif
// acs712 in inverted mode on adc1?
// when powered by 5V we can use a trick
// to get a good resolution: use inverted power inputs
// 0A = 2.5V
// 30A = 0.0V
#define ADC1_USE_ACS712
// voltage divider on my board is 10 / 3.3 k, scale to 100 / 33 to avoid floating point calc
#define ADC0_DIVIDER_A 100
#define ADC0_DIVIDER_B 33
// bootloader config
#define BOOTLOADER_LED_GREEN_PORT LED_GREEN_PORT
#define BOOTLOADER_LED_GREEN_PIN LED_GREEN_PIN
#define BOOTLOADER_LED_RED_PORT LED_RED_PORT
#define BOOTLOADER_LED_RED_PIN LED_RED_PIN
// bootloader runs on UART1 P0
#define BOOTLOADER_UART_NUM 1
#define BOOTLOADER_UART_PORT 0
#define BOOTLOADER_UART_INVERTED 1
#define BOOTLOADER_UART_BAUDRATE 100000
#define BOOTLOADER_UART_USE_PARITY 1
#define BOOTLOADER_UART_USE_2STOPBITS 1
// use ISP interface clock pin as bootloader enable pin
// pull this low during startup to enter bootloader mode
#define BOOTLOADER_ENABLE_PORT P2
#define BOOTLOADER_ENABLE_PIN 2
#define DEFAULT_FSCAL_VALUE -20

View File

@@ -0,0 +1,9 @@
# configuration of this board
# cc2510f16 has 16k flash -> 0x4000
# cc2510f32 has 32k flash -> 0x8000
FLASH_SIZE=0x4000
# continue with normal cc251x build
ARCH_DIR = arch/cc251x
ARCH_MAKEFILE = $(ARCH_DIR)/cc251x.mk

View File

@@ -0,0 +1,64 @@
# xsr-sb target
##LEDs
The XSR has a green and a red LED.
##SBUS
SBUS output is on USART1, TX pin is PA9, RX is PA10 but unused. SBUS is inverted leaving the board.
##CC2500 Radio
CC2500 is connected to SPI2, SCK is PB13, MISO is PB14 and MOSI is PB15.
The CS pin is PA8, and the GDO2 pin is PA11
The XSR uses the Skyworks SE2431 range extender
See: http://www.skyworksinc.com/uploads/documents/SE2431L_202410J.pdf
Looks to be a similar design to this: http://www.ti.com/tool/CC2530-SE2431L
Which means the RX pin selection is not needed (it is RX if TX is off)
Either ANT can be used for both RX and TX.
High is logic 1, Low is logic 0
ANT (PB5) selection is 0 (left) or 1 (right)
CTX (PA15) is 0 then RX LNA mode active, or 1 then tx mode
CPS (PB3) is 0 then bypass mode is active, 1 is bypass off.
CSD (PB4) with 1 to enable chip (0 = sleep)
GDO2 is on PA11
##BIND
Bind pin is attached to PC13, and pushing button pulls to ground.
##EEPROM
EEPROM is connected to PA0 (SCL) and PA1 (SDA)
Note that this is **NOT** an I2C port on the F1 so must use SOFT I2C
Write enable pin is connected to PXX *TODO*
##Analogue
NOTE no analogue input for XSR, and no servo pins.
##CPPM Output
CPPM output is on PB12
##Telemetry (Smart Port)
Smart port telemetry input is RX USART3 - RX on PB11, TX on PB10, this is a polling protocol, so TX is used too.
The plan is to not enable the smart port protocol but use the older hub telemetry (D8) protocol, so that the unit can share a UART on the FC with SBUS!
PB11 for RX and PB10 for TX both inverted once leaving board.
Output Enable (OE) for TX is PA2, this will need to be pulled high to prevent transmissions on the sport line.
TX (PB10) can then be used for debugging output (requires soldering to board before inverter).

168
OpenSky/board/xsr/config.h Normal file
View File

@@ -0,0 +1,168 @@
#ifndef __PIN_CONFIG_H__
#define __PIN_CONFIG_H__
#include "main.h"
/* TODO find correct pins for LEDs */
#define LED_GPIO GPIOA
#define LED_GPIO_CLK RCC_APB2Periph_GPIOA
#define LED_GPIO_CLK_RCC 2
#define LED_RED_PIN GPIO_Pin_11
#define LED_GREEN_PIN GPIO_Pin_12
// enable SBUS output -> this will DISABLE ppm!
#define SBUS_ENABLED
// Note: default/futaba is INVERTED=1! (use this for a cc3d etc)
// inverted => idle = LOW
// non inverted => idle = high
#define SBUS_INVERTED
// PPM (only used if sbus is disabled)
// invert SBUS output (normal is non inverted)
// #define PPM_INVERTED
// hub telemetry input (soft serial)
// #define HUB_TELEMETRY_ON_SBUS_UART
// #define HUB_TELEMETRY_INVERTED
// #define PPM_INVERTED
#define SBUS_USART USART1
#define SBUS_USART_CLK RCC_APB2Periph_USART1
#define SBUS_USART_RCC 2
#define SBUS_USART_GPIO GPIOA
#define SBUS_USART_GPIO_CLK RCC_APB2Periph_GPIOA
#define SBUS_USART_GPIO_CLK_RCC 2
#define SBUS_USART_TX_PIN GPIO_Pin_9
#define SBUS_USART_IRQHANDLER USART1_IRQHandler
#define SBUS_USART_IRQn USART1_IRQn
#define CC25XX_SPI_GPIO GPIOB
#define CC25XX_SPI_SCK_PIN GPIO_Pin_13
#define CC25XX_SPI_MOSI_PIN GPIO_Pin_15
#define CC25XX_SPI_MISO_PIN GPIO_Pin_14
/*
NOTE: CS pin is on GPIOA, PA8
NOTE: GDO2 pin is on GPIOA, PA11
*/
#define CC25XX_SPI_CSN_PIN GPIO_Pin_8
#define CC25XX_SPI_GDO2_PIN GPIO_Pin_11
#define CC25XX_SPI SPI2
#define CC25XX_SPI_CLK RCC_APB2Periph_SPI2
#define CC25XX_SPI_CLK_RCC 2
/* TODO ?? chose correct DMA for SPI2 */
#define CC25XX_SPI_GPIO_CLK RCC_APB2Periph_GPIOB
#define CC25XX_SPI_DMA_CLOCK RCC_AHBPeriph_DMA1
#define CC25XX_SPI_TX_DMA_CHANNEL DMA1_Channel3
#define CC25XX_SPI_TX_DMA_TC_FLAG DMA1_FLAG_TC3
#define CC25XX_SPI_RX_DMA_CHANNEL DMA1_Channel2
#define CC25XX_SPI_RX_DMA_TC_FLAG DMA1_FLAG_TC2
/*
XSR uses the Skyworks SE2431 range extender
See: http:// www.skyworksinc.com/uploads/documents/SE2431L_202410J.pdf
Looks to be a similar design to this: http:// www.ti.com/tool/CC2530-SE2431L
Which means the RX pin selection is not needed (it is RX if TX is off)
Either ANT can be used for both RX and TX.
High is logic 1, Low is logic 0
ANT (PB5) selection is 0 (left) or 1 (right)
CTX (PA15) is 0 then RX LNA mode active, or 1 then tx mode
CPS (PB3) is 0 then bypass mode is active, 1 is bypass off.
CSD (PB4) with 1 to enable chip (0 = sleep)
*/
/* TODO revisit base on the above */
#define CC25XX_ANT_SW_CTX_GPIO GPIOC
#define CC25XX_ANT_SW_CTX_GPIO_CLK RCC_APB2Periph_GPIOC
#define CC25XX_ANT_SW_CTX_GPIO_CLK_RCC 2
#define CC25XX_ANT_SW_CTX_PIN GPIO_Pin_15
#define CC25XX_ANT_SW_CRX_GPIO GPIOC
#define CC25XX_ANT_SW_CRX_GPIO_CLK RCC_APB2Periph_GPIOC
#define CC25XX_ANT_SW_CRX_GPIO_CLK_RCC 2
#define CC25XX_ANT_SW_CRX_PIN GPIO_Pin_14
#define CC25XX_LNA_SW_CTX_GPIO GPIOA
#define CC25XX_LNA_SW_CTX_GPIO_CLK RCC_APB2Periph_GPIOA
#define CC25XX_LNA_SW_CTX_GPIO_CLK_RCC 2
#define CC25XX_LNA_SW_CTX_PIN GPIO_Pin_15
#define CC25XX_LNA_SW_CRX_GPIO GPIOB
#define CC25XX_LNA_SW_CRX_GPIO_CLK RCC_APB2Periph_GPIOB
#define CC25XX_LNA_SW_CRX_GPIO_CLK_RCC 2
#define CC25XX_LNA_SW_CRX_PIN GPIO_Pin_4
/* GDO2 is on PA11 */
#define CC25XX_GDO2_GPIO GPIOA
#define CC25XX_GDO2_PIN GPIO_Pin_11
#define CC25XX_GDO2_GPIO_CLK RCC_APB2Periph_GPIOA
#define CC25XX_GDO2_GPIO_CLK_RCC 2
/* bind pin is attached to PC13, and pushing button pulls to ground. */
#define BIND_JUMPER_GPIO GPIOC
#define BIND_JUMPER_PIN GPIO_Pin_13
#define BIND_JUMPER_GPIO_CLK RCC_APB2Periph_GPIOC
#define BIND_JUMPER_GPIO_CLK_RCC 2
/*
EEPROM is connected to PA0 (SCL) and PA1 (SDA)
Note that this is **NOT** an I2C port on the F1 so must use SOFT I2C
*/
#define EEPROM_GPIO GPIOA
#define EEPROM_GPIO_CLK RCC_APB2Periph_GPIOA
#define EEPROM_GPIO_CLK_RCC 2
#define EEPROM_I2C_SDA_PIN GPIO_Pin_1
#define EEPROM_I2C_SCL_PIN GPIO_Pin_0
/* TODO: ??? */
#define EEPROM_WP_PIN GPIO_Pin_8
// A2=LO, A1=LO, A0=HI on pcb
#define EEPROM_I2C_ADDRESS 0xA2
/* NOTE no analogue input for XSR, and no servo pins */
// cppm output is on PB12
#define PPM_GPIO GPIOB
#define PPM_GPIO_CLK RCC_APB2Periph_GPIOB
#define PPM_GPIO_CLK_RCC 2
#define PPM_PIN GPIO_Pin_12
/* TODO: ??? chose timer for pin */
#define PPM_TIMER TIM3
#define PPM_TIMER_CLK RCC_APB1Periph_TIM3
#define PPM_TIMER_CLK_RCC 1
#define PPM_TIMER_CH TIM_Channel_3
#define PPM_TIMER_IRQHANDLER TIM3_IRQHandler
#define PPM_TIMER_IRQn TIM3_IRQn
/*
hub telemetry input is RX USART3 (SPORT)
PB11 for RX and PB10 for TX both inverted once leaving board.
Output Enable (OE) is PA2
*/
// THIS CONFIGURES IRQ PRIORITIES - DO NOT MESS THIS UP!
// this is the most critical stuff:
#define NVIC_PRIO_PPM 1
// sbus is a tx interrupt, this can be delayed at no cost
#define NVIC_PRIO_SBUS 6
// this is very time critical, but as telemetry data is not that important
// we allow this to be interrupted (=corrupted) occasionally
#define NVIC_PRIO_SOFT_SERIAL 2
// debugging data is not critical
#define NVIC_PRIO_DEBUG_UART 7
// systick prio
#define NVIC_PRIO_SYSTICK 0
#define DEFAULT_FSCAL_VALUE -62
#endif // __PIN_CONFIG_H__

View File

@@ -0,0 +1,4 @@
# continue with normal stm32f1 build
ARCH_DIR = arch/stm32f1
ARCH_MAKEFILE = $(ARCH_DIR)/stm32f1.mk