Inter-MCU communication over SPI
To enable this, please set the "SEPARATE_FBW" configure option to TRUE in your airframe file for both AP and FBW targets
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
1 <module name="intermcu_spi">
2 <configure name="SEPARATE_FBW" value="FALSE|TRUE" />
3 <configure name="INTER_MCU_SPI" value="SPI1" />
4 <configure name="INTER_MCU_SLAVE" value="SLAVE0" />
Module configuration options
Configure Options
- name:
SEPARATE_FBW
value: FALSE|TRUE
Description: Enable separation between AP and FBW on separated MCU
- name:
INTER_MCU_SPI
value: SPI1
Description: SPI used for inter mcu communication
- name:
INTER_MCU_SLAVE
value: SLAVE0
Description: Slave name
Files
Source Files
Raw intermcu_spi.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="intermcu_spi" dir="intermcu">
<doc>
<description>
Inter-MCU communication over SPI
To enable this, please set the "SEPARATE_FBW" configure option to TRUE
in your airframe file for both AP and FBW targets
</description>
<configure name="SEPARATE_FBW" value="FALSE|TRUE" description="Enable separation between AP and FBW on separated MCU"/>
<configure name="INTER_MCU_SPI" value="SPI1" description="SPI used for inter mcu communication"/>
<configure name="INTER_MCU_SLAVE" value="SLAVE0" description="Slave name"/>
</doc>
<makefile target="ap|fbw" firmware="fixedwing">
<raw>
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
$(error Using intermcu via SPI, so dual mcu with separate fbw. Please set option "SEPARATE_FBW" to TRUE.
endif
</raw>
<configure name="INTER_MCU_SPI" default="SPI1"/>
<configure name="INTER_MCU_SLAVE" default="SLAVE0"/>
<define name="MCU_SPI_LINK"/>
<define name="USE_SPI"/>
<file name="link_mcu_spi.c" dir="."/>
<file name="spi.c" dir="mcu_periph"/>
<file name="spi_arch.c" dir="$(SRC_ARCH)/mcu_periph"/>
</makefile>
<makefile target="ap" firmware="fixedwing">
<define name="USE_$(INTER_MCU_SPI)"/>
<define name="USE_SPI_$(INTER_MCU_SLAVE)"/>
<define name="SPI_MASTER"/>
<file name="fbw_downlink.c" dir="firmwares/fixedwing"/>
</makefile>
<makefile target="fbw" firmware="fixedwing">
<define name="USE_$(INTER_MCU_SPI)_SLAVE"/>
<define name="SPI_SLAVE"/>
</makefile>
</module>