1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-17 13:25:20 +03:00

[Taranis X9E] Fixes (frequencies on M4, pots calibration, soft power

delay after startup)
This commit is contained in:
bsongis 2015-03-03 18:34:35 +01:00
parent fffa39a286
commit 4c0515ab91
9 changed files with 56 additions and 37 deletions

View file

@ -69,7 +69,9 @@ Idle task stack size(word).
/*!<
System frequency (Hz).
*/
#if defined(PCBTARANIS)
#if defined(PCBTARANIS) && defined(REV9E)
#define CFG_CPU_FREQ (168000000)
#elif defined(PCBTARANIS) && defined(REV9E)
#define CFG_CPU_FREQ (120000000)
#else
#define CFG_CPU_FREQ (36000000) // TODO check if really correct for sky9x?

View file

@ -838,7 +838,6 @@ ifeq ($(PCB), TARANIS)
LDSCRIPT = targets/taranis/stm32_flash_bl.ld
TRGT = arm-none-eabi-
OPT = s
CPPDEFS += -DHSE_VALUE=12000000
BITMAPS += $(patsubst %.png,%.lbm,$(wildcard bitmaps/Taranis/*.png)) bitmaps/Taranis/mainmenu.lbm
SDCARD = YES
THR_TRACE = YES
@ -852,9 +851,11 @@ ifeq ($(PCB), TARANIS)
CPPDEFS += -DPCBTARANIS -DCPUARM -DCPUSTM32 -DVIRTUALINPUTS -DLUAINPUTS -DXCURVES -DEEPROM_VARIANT=0 -DAUDIO -DPXX
INCDIRS += targets/taranis CoOS CoOS/kernel CoOS/portable
ifeq ($(PCBREV), REV9E)
CPPDEFS += -DHSE_VALUE=16800000
CPPDEFS += -DSTM32F40_41xxx
EXTRAINCDIRS += targets/taranis/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/CMSIS/Device/ST/STM32F4xx/Include targets/taranis/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/CMSIS/Include targets/taranis/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc
else
CPPDEFS += -DHSE_VALUE=12000000
EXTRAINCDIRS += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Include targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/include
endif
EXTRAINCDIRS += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc

View file

@ -66,6 +66,12 @@ const pm_uchar sticks[] PROGMEM = {
#define CASE_SPLASH_PARAM(x)
#endif
#if defined(BATTGRAPH)
#define CASE_BATTGRAPH(x) x,
#else
#define CASE_BATTGRAPH(x)
#endif
enum menuGeneralSetupItems {
CASE_RTCLOCK(ITEM_SETUP_DATE)
CASE_RTCLOCK(ITEM_SETUP_TIME)

View file

@ -76,7 +76,9 @@ enum menuGeneralHwItems {
#define HW_SETTINGS_COLUMN 15*FW
#if defined(REVPLUS)
#if defined(REV9E)
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, 0, 0, 0, 0
#elif defined(REVPLUS)
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, 0, 0
#else
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, 0, 0
@ -118,7 +120,7 @@ void menuGeneralHardware(uint8_t event)
case ITEM_SETUP_HW_RS2:
#endif
{
int idx = (k<=ITEM_SETUP_HW_STICK4 ? k-ITEM_SETUP_HW_STICK1 : k-ITEM_SETUP_HW_LS+7);
int idx = (k<=ITEM_SETUP_HW_STICK4 ? k-ITEM_SETUP_HW_STICK1 : k-ITEM_SETUP_HW_LS+MIXSRC_SLIDER1-MIXSRC_Rud);
lcd_putsiAtt(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0);
if (ZEXIST(g_eeGeneral.anaNames[idx]) || attr)
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, event, attr);

View file

@ -93,6 +93,11 @@ const uint8_t BootCode[] = {
__attribute__ ((section(".bootrodata"), used))
void _bootStart()
{
// turn soft power ON now
RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; // Enable portD clock
GPIOD->BSRRL = 1;
GPIOD->MODER = (GPIOD->MODER & 0xFFFFFFFC) | 1;
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN; // Enable portC clock
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOEEN; // Enable portE clock

View file

@ -56,20 +56,6 @@
#define CASE_PCBSKY9X(x)
#endif
#if defined(PCBTARANIS)
#define IS_PCBTARANIS() true
#define IF_PCBTARANIS(x) (x)
#define CASE_PCBTARANIS(x) x,
#define IF_9X(x) (0)
#define CASE_9X(x)
#else
#define IS_PCBTARANIS() false
#define IF_PCBTARANIS(x) (0)
#define CASE_PCBTARANIS(x)
#define IF_9X(x) (x)
#define CASE_9X(x) x,
#endif
#if defined(CPUARM)
#define CASE_CPUARM(x) x,
#define IF_CPUARM(x) x
@ -90,12 +76,6 @@
#define CASE_LUA(x)
#endif
#if defined(BATTGRAPH) || defined(PCBTARANIS)
#define CASE_BATTGRAPH(x) x,
#else
#define CASE_BATTGRAPH(x)
#endif
#if defined(CPUARM) || defined(CPUM2560)
#define CASE_PERSISTENT_TIMERS(x) x,
#else
@ -381,7 +361,11 @@ enum PotType {
POT_TYPE_MAX=POT_TYPE_NO_DETENT
};
#if defined(PCBTARANIS) && defined(REVPLUS)
#if defined(PCBTARANIS) && defined(REV9E)
#define IS_POT_AVAILABLE(x) (((x)!=POT3 && (x)!=POT4) || (g_eeGeneral.potsType & (0x03 << (2*((x)-POT1))))!=POT_TYPE_NONE)
#define IS_POT_MULTIPOS(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS)
#define IS_POT_WITHOUT_DETENT(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_NO_DETENT)
#elif defined(PCBTARANIS) && defined(REVPLUS)
#define IS_POT_AVAILABLE(x) ((x)!=POT3 || (g_eeGeneral.potsType & (0x03 << (2*((x)-POT1))))!=POT_TYPE_NONE)
#define IS_POT_MULTIPOS(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS)
#define IS_POT_WITHOUT_DETENT(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_NO_DETENT)
@ -471,7 +455,7 @@ enum PotType {
#define LOAD_MODEL_BITMAP()
#endif
#if defined(PCBTARANIS)
#if defined(XCURVES)
void loadCurves();
#define LOAD_MODEL_CURVES() loadCurves()
#else

View file

@ -43,7 +43,11 @@
#include <time.h>
#include <ctype.h>
#define LCD_ZOOM 2
#if LCD_W > 212
#define LCD_ZOOM 1
#else
#define LCD_ZOOM 2
#endif
#define W2 LCD_W*LCD_ZOOM
#define H2 LCD_H*LCD_ZOOM
@ -331,9 +335,9 @@ long Open9xSim::onTimeout(FXObject*, FXSelector, void*)
}
#if defined(PCBTARANIS)
#define BL_COLOR FXRGB(47,123,227)
#define BL_COLOR FXRGB(47, 123, 227)
#else
#define BL_COLOR FXRGB(150,200,152)
#define BL_COLOR FXRGB(150, 200, 152)
#endif
void Open9xSim::setPixel(int x, int y, FXColor color)
@ -349,9 +353,9 @@ void Open9xSim::refreshDisplay()
{
if (lcd_refresh) {
lcd_refresh = false;
FXColor offColor = IS_BACKLIGHT_ON() ? BL_COLOR : FXRGB(200,200,200);
#if !defined(PCBTARANIS)
FXColor onColor = FXRGB(0,0,0);
FXColor offColor = IS_BACKLIGHT_ON() ? BL_COLOR : FXRGB(200, 200, 200);
#if LCD_W == 128
FXColor onColor = FXRGB(0, 0, 0);
#endif
for (int x=0; x<LCD_W; x++) {
for (int y=0; y<LCD_H; y++) {

View file

@ -163,6 +163,7 @@ void adcRead()
DMA2->LIFCR = DMA_LIFCR_CTCIF0 | DMA_LIFCR_CHTIF0 |DMA_LIFCR_CTEIF0 | DMA_LIFCR_CDMEIF0 | DMA_LIFCR_CFEIF0 ; // Write ones to clear bits
DMA2_Stream0->CR |= DMA_SxCR_EN ; // Enable DMA
ADC1->CR2 |= (uint32_t)ADC_CR2_SWSTART ;
#if defined(REV9E)
DMA2_Stream1->CR &= ~DMA_SxCR_EN ; // Disable DMA
ADC3->SR &= ~(uint32_t) ( ADC_SR_EOC | ADC_SR_STRT | ADC_SR_OVR ) ;
@ -170,12 +171,23 @@ void adcRead()
DMA2_Stream1->CR |= DMA_SxCR_EN ; // Enable DMA
ADC3->CR2 |= (uint32_t)ADC_CR2_SWSTART ;
#endif // #if defined(REV9E)
#if defined(REV9E)
for (unsigned int i=0; i<10000; i++) {
if ((DMA2->LISR & DMA_LISR_TCIF0) && (DMA2->LISR & DMA_LISR_TCIF1)) {
break;
}
}
DMA2_Stream0->CR &= ~DMA_SxCR_EN ; // Disable DMA
DMA2_Stream1->CR &= ~DMA_SxCR_EN ; // Disable DMA
#else
for (unsigned int i=0; i<10000; i++) {
if (DMA2->LISR & DMA_LISR_TCIF0) {
break;
}
}
DMA2_Stream0->CR &= ~DMA_SxCR_EN ; // Disable DMA
#endif
#if !defined(REV3)
// adc direction correct

View file

@ -94,14 +94,17 @@ extern "C" {
#define BOOTLOADER_SIZE 0x8000
#define FIRMWARE_ADDRESS 0x08000000
#define PERI1_FREQUENCY 30000000
#define PERI2_FREQUENCY 60000000
#if defined(REV9E)
#define PERI1_FREQUENCY 42000000
#define PERI2_FREQUENCY 84000000
#else
#define PERI1_FREQUENCY 30000000
#define PERI2_FREQUENCY 60000000
#endif
#define TIMER_MULT_APB1 2
#define TIMER_MULT_APB2 2
// #define JACK_PPM_OUT()
// #define JACK_PPM_IN()
#define PIN_MODE_MASK 0x0003
#define PIN_INPUT 0x0000
#define PIN_OUTPUT 0x0001