OSURoboticsClub / aerial_control

Aerial vehicle firmware
MIT License
2 stars 4 forks source link

Implement SDIO driver #18

Closed yoos closed 9 years ago

yoos commented 9 years ago

For SD card reader using the SDIO interface.

yoos commented 9 years ago

Reference thread on ChibiOS forums: http://forum.chibios.org/phpbb/viewtopic.php?f=4&t=81

yoos commented 9 years ago

I reckon this will work like the RateLimitedStream of our communicator, though it will be initialized with possibly different output file targets. Might want to keep an instance of this a unique one so we have sole access to the filesystem.

yoos commented 9 years ago

Currently stumped on a mystery bug where if the SDIO signal slew rate is slowed down by some peripheral enabled in the aerial firmware.

STM32_SDIO_DIV_HS must be set to at least 2 in sdc_lld.h. Starting the SDIO interface after SPI seems to help. Enabling all of our subsystems in the SDC testhal demo does not seem to affect the slew rate. Maybe it's outside of our code?

yoos commented 9 years ago

Signal slew rate bug was due to manually setting pad modes.. https://github.com/OSURoboticsClub/aerial_control/commit/f412819d2b05416923f11ba3ef8fd42660b5892f

STM32_SDIO_DIV_HS has been set back to 0.

Unfortunately, sdcStart() still has to be called after spiStart().

yoos commented 9 years ago

Corrupt data caused by syncing too often. Otherwise (with a 10KB buffer.. is this too large?) works great!

yoos commented 9 years ago

SPI1 does not work because the default ChibiOS config puts SPI1 TX and SDIO on the same DMA channel. Will stay with SPI3 for now, but we should set up our own board config files instead of importing the example ones.