Skip to content

Development

Janek edited this page Dec 6, 2024 · 66 revisions

ST-Link pinout

ST-Link is not required, you can flash using DFU mode without any additional hardware.

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_ELRS NO/YES Enable ExpressLRS/CRSF configuration tool (LUA alternative)
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
USB_SERIAL NO/YES Enables USB Serial modes - Telemetry mirror or debug in DEBUG build.
USB_MSD NO/YES Enables USB Mass Storage mode.
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+)
CRSF_EXTENDED_TYPES NO/YES Enable CRSF configuration parameters STRING and FLOAT types support.
FAKE_RSSI NO/YES Converts TRSS to RSSI data for receivers not sending RSSI.
EXTPWR_INVERT NO/YES Invert ext module power pin PC13 to allow use of P-MOSFET. (since 1.12.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 PCBI6X_INAV=NO PCBI6X_ELRS=YES 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

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

APM32 USB DFU Mode: dfu-util -a0 -s 0x08000000:leave -d 314b:0106 -D <file_to_flash>.bin

Debug port

Use USB Serial mode for debug log or AUX Serial port TX located at PA9 PCB pad. Serial port runs @115200 bauds, 8N1.

STM32F072 Used peripherals and pin mapping

GPIO

Pin AF Used as
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 CRSF/Telemetry TX
PA15 USART2_RX CRSF/Telemetry RX
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
PF9 TIM15_CH1 PPM IN
PF10 TIM15_CH2 PPM OUT
TXD4 USART3/4_TX AUX3 Serial TX - DFPlayer
RXD4 USART3/4_RX AUX4 Serial RX - FS-HZCZ03-ADJ Gimbal

DMA

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

Timers

Timer Description
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 (2 bits) Cortex-M3/4 (4 bits)
0 0
1 1
2 2-6
3 7+
Clone this wiki locally