[lucky1 – Mon Dec 17, 2018 3:07 pm] –
I know about the FatFS implementation from CubeMX but is there also a port of the SDFat library ?
If you’re wanting to drive an onboard SDIO device, probably not.
If it’s for a SPI type SD reader, have you tried the official version -> https://github.com/greiman/SdFat
I have also tried the SDFat/SPI/SDIO/stm32_dma implementation which is in the STM32GENERIC Core but that is also not working.
I have a larger teensy 3.6 project which relies on SDFat which I want to port to Nucleo F7 or H7 and I don´t want to use STM32GENERIC for it because
it is not officially supported by STM
[lucky1 – Mon Dec 17, 2018 4:02 pm] –
Yes, I have tried but the problem is that it relies on the SPI library and the implementation which is in the STM32 Core is not compatible.
Not compatible how? Do you get any errors reported? If so, please post them.
[fpiSTM – Mon Dec 17, 2018 7:28 pm] –
I’ve never tried SDFat and don’t know ifsomeone tried.
I’ll try it tomorrow if I get time.
https://github.com/greiman/SdFat and the SdioSTM32.cpp from the STM32Generic core SDFat library.
Only had to initialize the SDIO GPIOS. I also used the SDIO and stm32_dma library from STM32Generic.
However SPI SD Card would also be interesting for me but I haven´t looked into that.
[BennehBoy – Tue Dec 18, 2018 4:03 pm] –
I might be tempted to do the same, the variable handling when printing (could be compile options clib/printf etc) to fatfs seems lacking compared to sdfat… Care to share your code?
Nope it’s not the newlib options.
invalid conversion from 'int' to 'const char*' [-fpermissive]
Maybe you get the SPI version to work. I have no idea how to initialize it.
Any reason why you can’t share SPI1?
It looks like there’s a method to switch to alternate spi instances now…. (or I missed it previously)
setPort
void SdSpiAltDriver::setPort(uint8_t portNumber) {
m_spi = &m_SPI1;
#if BOARD_NR_SPI >= 2
if (portNumber == 2) {
m_spi = &m_SPI2;
}
#endif // BOARD_NR_SPI >= 2
#if BOARD_NR_SPI >= 3
if (portNumber == 3) {
m_spi = &m_SPI3;
}
#endif // BOARD_NR_SPI >= 2
no matching function for call to ‘SdFat::SdFat(int)’
[BennehBoy – Tue Dec 18, 2018 7:34 pm] –
sdfat & SPI SD works fine btw. And no errors when trying to print integers.
I just tried SDFat with SPI on my Disco STM32F407 without success.
How did you connect the SD slot ?
[BennehBoy – Thu Jan 17, 2019 11:39 am] –
I used an external SD slot, it’s not possible to use the onboard SD reader via SPI.
I use a external slot too, but which pins did you connect it to ?
MOSI PB5 //HWSPI Instance 1
MISO PB4 //HWSPI Instance 1
CLK PB3 //HWSPI Instance 1
CS PE13 // any GPIO – you do not have to use the SS pin couple with the SPI instance, since this is s/w controlled anyway
[BennehBoy – Thu Jan 17, 2019 1:10 pm] –
I set mine up this way:MOSI PB5 //HWSPI Instance 1
MISO PB4 //HWSPI Instance 1
CLK PB3 //HWSPI Instance 1
CS PE13 // any GPIO – you do not have to use the SS pin couple with the SPI instance, since this is s/w controlled anyway
Does not work. My testcode looks like this. Any idea ?
SdFat SD;
SD.begin();
File myFile = SD.open("test.txt", FILE_WRITE);
if(myFile.isOpen()) {
myFile.println("testing 1, 2, 3.");
myFile.close();
}
Thanks for your help
explicit SdFat(SPIClass* spiPort);

