SPI SD Logger updates (#2605)

* modify spi sd logger for arbitrary downlink devices
* Update sglogger_download to pprzlink v2
* Fix logger_sd_spi_direct enum settings
* Change commented printf to DEBUG_PRINT
* settings_xml_parse.py: print errors and warnings to stderr

Co-authored-by: Tom van Dijk <tomvand@users.noreply.github.com>
This commit is contained in:
Tom van Dijk
2020-12-10 09:41:41 +01:00
committed by GitHub
parent fbf19a8fa1
commit 172f8fe44b
4 changed files with 85 additions and 44 deletions
+20 -8
View File
@@ -5,27 +5,34 @@
<description>
Direct SPI SD Logger that saves pprzlog messages to SD Card.
This module logs data directly to an SD Card which is connected on a SPI port. For now, it is only possible to use a radio switch to start and stop logging.
Supported SD cards:
- SDv2 cards. Old SDv1 cards are not supported.
- Both SDSC and SDHC/SDXC are supported.
Some SD cards need to be zeroed out before use: https://askubuntu.com/a/511476
This module logs data directly to an SD Card which is connected on a SPI port.
Logging can be started/stopped by setting sdlogger_spi.do_log from the GCS
or by defining SDLOGGER_ON_ARM to TRUE.
The values to be logged are defined in the telemetry config file. An example is available in rotorcraft_with_logger.xml. The logmessage is defined as the default message in the process "Logger".
A LOGGER_LED can be enabled which indicates if the logger is writing or reading data.
Downloading of the data occurs over an UART datalink. There is no check to verify that all data is transfered, so it is recommended to use an FTDI cable to the UART port.
Do not use start/stop functionality of the module, the module is not intended to be used like this.
Downloading of the data occurs over the configured serial device using sw/logalizer/sdlogger_download. There is no check to verify that all data is transfered. For UART it is recommended to use an FTDI cable.
</description>
<configure name="SDLOGGER_DIRECT_SPI" value="SPI1|SPI2|SPI3|SPI4|SPI5|SPI6" description="Port to which the SD Card is connected."/>
<configure name="SDLOGGER_DIRECT_SPI_SLAVE" value="SPI_SLAVE1|SPI_SLAVE2|SPI_SLAVE3|SPI_SLAVE4|SPI_SLAVE5|SPI_SLAVE6" description="Port to which the SD Card is connected."/>
<configure name="SDLOGGER_DIRECT_CONTROL_SWITCH" value="RADIO_AUX2"/>
<define name="SDLOGGER_ON_ARM" value="TRUE" description="Start/stop SD logger with motor arming"/>
<configure name="SDLOGGER_DOWNLINK_DEVICE" value="DOWNLINK_DEVICE|uartX|usb_serial|..." description="Note: case sensitive!"/>
<configure name="LOGGER_LED" value="none"/>
</doc>
<settings>
<dl_settings NAME="sdlogger">
<dl_settings NAME="SD Logger">
<dl_setting module="loggers/sdlogger_spi_direct" var="sdlogger_spi.status" min="0" max="20" step="1" values="UnInit|Error|Init|Index|Ready|Log|FinalBlock|Stop|GetIndexUp|UpInd|GetIndDwn|Down"/>
<dl_setting module="loggers/sdlogger_spi_direct" var="sdcard1.status" min="0" max="40" step="1" values="UnInit|Error|Idle|Busy|Other"/>
<dl_setting module="loggers/sdlogger_spi_direct" var="sdcard1.error_status" min="0" max="15" step="1" values="None|NoResp|CardInfo|Timeout|NoRes4|NoRes8|CCInval|SBNoRes|WBNoRes|SPIErr|BlockErr|RBNoRes|RBTimeout|MWNoRes|MWErr"/>
<dl_setting module="loggers/sdlogger_spi_direct" var="sdlogger_spi.status" min="0" max="11" step="1" values="UnInit|Error|Init|Index|Ready|Log|FinalBlock|Stop|GetIndexUp|UpInd|GetIndDwn|Down"/>
<dl_setting module="loggers/sdlogger_spi_direct" var="sdcard1.status" min="0" max="31" step="1" values="UnInit|Error|Idle|Busy|BeforeDummyClock|SendingDummyClock|SendingCMD0|ReadingCMD0Resp|SendingCMD8|ReadingCMD8Resp|ReadingCMD8Param|SendingACMD41v2|ReadingACMD41v2Resp|SendingCMD58|ReadingCMD58Resp|ReadingCMD58Param|SendingCMD16|ReadingCMD16Resp|SendingCMD24|ReadingCMD24Resp|BeforeDataBlock|SendingDataBlock|SendingCMD17|ReadingCMD17Resp|WaitForToken|ReadingDataBlock|SendingCMD25|ReadingCMD25Resp|MWIdle|MWWriting|MWBusy|MWStopping"/>
<dl_setting module="loggers/sdlogger_spi_direct" var="sdcard1.error_status" min="0" max="15" step="1" values="None|InitNoResp|CardInfoNoResponse|CardInfoInvalid|ACMD41Timeout|ACMD41NoRes|ACMD58NoRes|CCSInval|SBNoRes|WBNoRes|SPIErr|BlockErr|RBNoRes|RBTimeout|MWNoRes|MWErr"/>
<dl_setting module="loggers/sdlogger_spi_direct" var="sdlogger_spi.command" min="1" max="42" step="1" />
<dl_setting module="loggers/sdlogger_spi_direct" var="sdlogger_spi.do_log" min="0" max="1" step="1" values="Off|On"/>
</dl_settings>
@@ -36,7 +43,7 @@ Do not use start/stop functionality of the module, the module is not intended to
<file name="sdlogger_spi_direct.h"/>
</header>
<init fun="sdlogger_spi_direct_init()"/>
<periodic fun="sdlogger_spi_direct_periodic()" freq="512" start="sdlogger_spi_direct_start()" stop="sdlogger_spi_direct_stop()" autorun="TRUE"/>
<periodic fun="sdlogger_spi_direct_periodic()" freq="512" start="sdlogger_spi_direct_start()" stop="sdlogger_spi_direct_stop()" autorun="LOCK"/>
<datalink message="SETTING" fun="sdlogger_spi_direct_command()"/>
<makefile target="ap">
@@ -55,6 +62,11 @@ Do not use start/stop functionality of the module, the module is not intended to
<define name="SDLOGGER_SPI_LINK_DEVICE" value="$(SDLOGGER_DIRECT_SPI_LOWER)" />
<define name="USE_$(SDLOGGER_DIRECT_SPI_SLAVE_UPPER)" value="1" />
<define name="SDLOGGER_SPI_LINK_SLAVE_NUMBER" value="$(SDLOGGER_DIRECT_SPI_SLAVE_UPPER)" />
<configure name="SDLOGGER_DOWNLINK_DEVICE" default="DOWNLINK_DEVICE" case="upper"/>
<define name="SDLOGGER_DOWNLINK_DEVICE" value="$(SDLOGGER_DOWNLINK_DEVICE)"/>
<define name="USE_$(SDLOGGER_DOWNLINK_DEVICE_UPPER)" cond="ifneq ($(SDLOGGER_DOWNLINK_DEVICE_UPPER),DOWNLINK_DEVICE)"/>
<file_arch name="usb_ser_hw.c" dir="." cond="ifeq ($(SDLOGGER_DOWNLINK_DEVICE_UPPER),USB_SERIAL)"/>
</makefile>
</module>