Skip to content

Development

Janek edited this page Dec 27, 2023 · 26 revisions

ST-Link pinout

ST-Link pinout

Selected build time options

Option Values Description
DFPLAYER NO/YES Enable DFPlayer Voice support (Since 1.11.0+)
FLYSKY_GIMBAL NO/YES Enable FlySky FS-HZCZ03-ADJ gimbal support (Since 1.11.0+)
PCBI6X_ELRSV3 NO/YES Enable ExpressLRS config tool
PCBI6X_INAV NO/YES Enable INAV Lite radar screen
PCBI6X_HELLO NO/YES Example "Hello World" radio tool to help interested programmers to create their own
PCBI6X_USB_VBUS NO/YES Enables detection of USB connection and removes main screen popup USB Connect option for USB_VBUS mod
PCBI6X_BACKLIGHT_MOD NO/YES Adds support for for backlight mod. Always enabled. (Since 1.11.0+)
PCBI6X_USB_MSD NO/YES Enables USB Mass Storage mode. Currently forced to YES in CmakeList.txt
AFHDS2A_LQI_CH 1-17 Injects RSSI at channel, default: 17
CRSF_UNINVERTED NO/YES Disable inversion of S.Port(CRSF), useful if you want to use ExpressLRS RX as TX option.(Since 1.11.0+)
PPM_UNIT US/PERCENT_PREC0/PERCENT_PREC1 Channel value unit
DEBUG NO/YES Enable DEBUG serial output
GVARS NO/YES Enable Global Variables
HELI NO/YES Enable Heli menu

Compile

docker run --rm -it -e "BOARD_NAME=i6x" -e "CMAKE_FLAGS=PCB=I6X HELI=NO GVARS=YES LUA_COMPILER=NO MULTIMODULE=NO PCBI6X_ELRSV3=NO DEBUG=NO" -v ${PWD}:/opentx ajjjjjjjj/opentx-docker-i6x

Images to use:

ajjjjjjjj/opentx-docker-i6x - to compile using recent GCC version with LTO, this is current default.

vitass/opentx-fw-build - to compile older versions (1.8.0 and older) using GCC 4.7.

Flash

ST-Link: sudo st-flash write <file_to_flash>.bin 0x08000000

USB DFU Mode: dfu-util -a0 -s 0x08000000:leave -d 0483:df11 -D <file_to_flash>.bin

Debug serial port

Located at PA9 TX,PA10 RX pins.

# sudo cat /dev/ttyUSB0 115200

STM32F072 Used peripherals and pin mapping

-------------------------------------
DMA
-------------------------------------

Channel 1: ADC              // ADC
Channel 2: TX1, TX3         // - not used - AUX Serial TX (USART1)
Channel 3: RX1, RX3         // AUX Serial RX (USART1)
Channel 4: TX1, TX2         // Telemetry DMA (TX2) (USART2), can be reused for A7105 SPI1 TX
Channel 5: RX1, RX2         // - not used - CRSF RX, A7105 SPI1 RX?
Channel 6: RX2, RX3, RX4    // AUX4 Serial RX (USART4)
Channel 7: TX2, TX3, TX4    // - not used -

-------------------------------------
Exposed PADS
-------------------------------------

PA9     USART1_TX (AUX Serial TX)
PA10    USART1_RX (AUX Serial RX)

PB8     TIM16_CH1, I2C1_SCL
PB9     TIM17_CH1, I2C1_SDA

TX2 (PD5) USART2_TX (Telemetry)
PA15    USART2_RX, USB VBUS detection

PC9     TIM3_CH4 (Backlight PWM)
PC12    no useful AF
PC13    no AF, EXTMODULE Power switch
PC14    no AF, DFPLAYER BUSY
PC15    no AF. 

PD0     SPI2_NSS, I2S2_WS, CAN_RX       // slave select
PD1     SPI2_SCK, I2S2_CK, CAN_TX       // clock
PD3     SPI2_MISO, I2S2_MCK, USART2_CTS // out
PD4     SPI2_MOSI, I2S2_SD, USART2_RTS  // in
PD11    no useful AF

TXD4    USART3/4_TX (AUX3 Serial TX - DFPlayer)
RXD4    USART3/4_RX (AUX4 Serial RX - FS-HZCZ03-ADJ Gimbal)

-------------------------------------
Timers
-------------------------------------

TIM1    Buzzer PWM
TIM2    -
TIM3    BACKLIGHT_TIMER PWM
TIM6    STM32F0 delays
TIM7    TIMER_2MHz
TIM14   INTERRUPT_xMS
TIM15   PPM (External module) + Trainer
TIM16   Internal RF
TIM17   MIXER_SCHEDULER

-------------------------------------
NVIC priorities
-------------------------------------

Cortex-M0 have only 2-bits NVIC priorities: 0-3 instead of 0-15: 
priority 6 becomes 2 (most probably OK),
priority 7 becomes 3 (OK), 
priority 8 becomes 0 (absolutely bad, because it becomes highest priority).