We need a feature of writing log files on an external SD card.
The build-in flash is probably too small, so we should use an external spi SD or SDIO module and write log files using fatfs FAT driver. I guess the logs should be TunerStudio compatible from the start.
You would need to download the full official 'chibios 2.6.1' distro and add the needed files for 'fatfs' support - that would be some files from 'etc/fatfs...zip' and some files from os/variaous/fatfs_bindings
Then you would need to look at the existing fatfs examples and first step would be to create a new file called 'log.txt' and write 'hello world' string into this file :)
Please note that there are TWO physical modes of SD card operation: SDIO which is newer and older SPI based MMC mode which is running on SPI. I believe SPI MMC is simpler and better for us - let's begin by using SPI based.
We already have some SPI code. As a hint - start by running the slowest SPI possible (100-200-500Kb), it is the most reliable one if you are using noisy jumper wires.
Last edit: Andrey B 2013-12-24
We already have initSpiModules() method which already turns SPI on
define EFI_SPI2_SCK_PORT GPIOB
define EFI_SPI2_SCK_PIN 13
define EFI_SPI2_MISO_PORT GPIOB
define EFI_SPI2_MISO_PIN 14
define EFI_SPI2_MOSI_PORT GPIOB
define EFI_SPI2_MOSI_PIN 15
We already have the Chip Select pin defined
define SPI_SD_MODULE_PORT GPIOD
define SPI_SD_MODULE_PIN 11
outputPinRegister("spi CS5", SPI_CS_SD_MODULE, SPI_SD_MODULE_PORT, SPI_SD_MODULE_PIN);
I have also added some 'mmc_card.c' skeleton
http://forum.chibios.org/phpbb/viewtopic.php?f=16&t=1677