STM32F469i Disco SD Card FAT 4Bit mode

An area to discuss ARM specific problems and examples

Moderator: Benj

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

Now I have a STM32F469i discovery board. This board has a SD card connector for 4bit mode.
I hope this this faster than the spi mode.
Would it be possible to integrate this mode into flowcode7?


STM32F469I_disco_SD_card_hardware.PNG
(48.93 KiB) Downloaded 12068 times
STM32F469I_disco_SD_card_software.PNG
(26.85 KiB) Downloaded 12068 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by Benj »

Hello,

Currently we support the SD cards on the disco boards but only using the SPI interface.

We can certainly explore the API mode as it should be faster but probably a lot more resource intensive. There are likely to be existing libraries we can tap into so maybe not too big a job.

I'll add it to the list to investigate.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben
Thank You for the info.I'll change my own hardware on a 4bit SD card connection. So I can use first the SPi and maybe later the "API" mode. I think later I have just to change the software. And I believe with flowcode 7 it will be easy as always.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

I tried to connect the sd-card to a "software" Fat

But I can not control the chipselect on C11 from the menu of FC7.

Is it possible to use
C8-C12 and D2 by software?

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by LeighM »

In Component->Properties->Connections click on "$PORTD.2" and you can change it

trey3499
Posts: 5
Joined: Sun Aug 17, 2014 9:51 am
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by trey3499 »

Hi.
There is a working example?

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

How is it now 2 months later?
It would be nice to use the SD card on the STM32F469 in 4Bit mode. Also a longer filename than 8digit would be nice.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by Benj »

Hello Stefan,

Have you managed to get the FAT component working at all in it's current state?
It would be nice to use the SD card on the STM32F469 in 4Bit mode. Also a longer filename than 8digit would be nice.
Yes I agree these would be nice to have, unfortunately I am rather busy at the moment, they are on the list but currently low priority.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

Yes the Fat is comfortable to use and I'm working with it on PIC-Board and the STM32F469 Disco Demoboard.
I use a RTCC to generate the filename. The file was generatet 2017_06_21 at 14:29 and 29 sec.
But the filename looks poore like 21142929.wav
It's bether if the filename is longer like 2017_06_21_14_29_29.wav (19 digit)
And the speed is fast enough for the 2channel Project. But now I'm working on 8Channel version.
So I just hope the 4Bit mode is 4time faster..... :)
At the moment I can work with it and hope to upgrade the FAT soon.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

I saw in Flowcode7 Fat Propertis "set time and date"

Can I set the creating time from the File with this propertis?

At the moment I dont support it and if I put the Card after recording, in the computer fill in the the time from the computer.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by Benj »

Hello Stefan,

Yes this function should allow you to change the timestamp when creating a file, maybe also for modifying a file, without calling the function then we default to the compilation time and date.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

Thank you for the help. It's looks much bether with the create_time and the shortname with 8.3 digit
Do you know if I can use the Authors propertie in a way?

And on the end of a recording, I have to write in the first sector some infos. But flowcode is not showing me which is the first sector.....
FAT_time.PNG
(7.84 KiB) Downloaded 10955 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by Benj »

Hello,

The author might be stored as part of the extended filename, though I can't find specific reference to where and how this would be done. I do know that at the moment we don't support it. :D

Some info on FAT, file entries and extended file names.
https://en.wikipedia.org/wiki/Design_of ... file_names

As for writing some info in the first sector, this could be problematic, the first sector is usually the boot sector and contains some critical information about the disk. Writing to this sector could potentially make the disk corrupt or unstable. What about instead saving the data into a second file?

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

I mean not the first sector of FAT, I mean the first sector from the file.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by Benj »

I mean not the first sector of FAT, I mean the first sector from the file.
Aha Ok that should be possible.

When you are done writing to the file open the file again and this will load the local 512 byte buffer with the first sector of the file.

ReadByteFromBuffer will allow you to read a byte from the local buffer.

WriteByteToBuffer will allow you to override a byte in the local buffer.

WriteFileSector will write the local buffer back to the card overwriting the first sector of the file.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by Benj »

I've created a file with Author properties and looked at the record in Winhex to see the format.

Unfortunately it doesn't look particularly simple and may only work correctly with Windows operating systems so for now until I can find a better explanation of how it's done we will not be adding this functionality to the component.

Extended file names would be nice and it may be along similar lines?

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

I tried this "file open again" and write to the first sector again.
it's working and it's a big help
So I can write some infos there.Thank you Ben

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

I already know the FAT by Flowcode is reliable and easy to use.
But I'm not satisfied with the speed. Is there something new to the 4 bit mode?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by Benj »

Currently working on (amongst other things) a new SD card E-block which has both the SPI and API modes available.

Once I have this it should be simple enough to add a API mode to the component (hopefully). Most if not all of the examples I have seen are for SPI mode so I'm hoping the ST ARM library will help here. Edit - I've had a look through this and it looks fairly horrific.

The API mode should be approx a factor of 4x faster but this is just a guess based on the number of parallel data pins.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben
I know it is not easy. But my application sampled data and created wavefile. I can sample instead 4khz with 16khz with the same processorspeed. Also, I can not increase the SPI clock arbitrarily so these 4bit are already a big help.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

How is the SD card E-block which has both the SPI and API modes available?

I like to create my own hardware with a Pic. Can I have some info from the new Eblock? Can I use the same controler?

It is also not clear to me whether I can use any pin for the API mode or the PIC must have a specific port.

And whether this SD/SDIO/eMMc is something useful.

http://www.microchip.com/wwwproducts/en ... 1025DAA176
50 MHz SD/SDIO/eMMC bus interface

maybe you know more ....

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by Benj »

Hello,

The EB board is coming on but will take a while to hit the shelves. Should be an easy board for you to replicate yourself, basically just a means of connecting the pins of the SD card to the micro.

Image
It is also not clear to me whether I can use any pin for the API mode or the PIC must have a specific port.
Any pin should be fine.
And whether this SD/SDIO/eMMc is something useful.
It looks like the device you pointed to has a built in bus to talk to the SD card. This will likely be a bit faster then bit banging out the signals but we will not likely support this in Flowcode as it's very chip specific and against the development policies where it should simply just work on pretty much any device. You should be able to use say the Microchip Harmony libraries as is in Flowcode which should allow you to access the functionality.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by stefan.erni »

Hi Ben

This is a good news and thank you for the infos.
I'm already drawing the hardware.
What has the new EB board for a number?
And is there a component for FC7 for the new EB board already?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by Benj »

Hi Stefan,
What has the new EB board for a number?
I'm not at liberty to say much on this at the moment, all will be revealed shortly.
And is there a component for FC7 for the new EB board already?
No currently only the FAT component is available which uses the SPI communications mode. We will likely add the API mode to the FAT component in the future but this is currently fairly low priority.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32F469i Disco SD Card FAT 4Bit mode

Post by Benj »

Leigh has just informed me that the 4-bit API mode requires a license fee paid to the SD association.

So it look even less likely that we will be doing anything to support this.

Some info on this here but not enough to know the full score.
https://electronics.stackexchange.com/q ... de-license

Post Reply