Skip to main content
dbte
Associate
July 14, 2017
Question

STM32F4DIS-BB FatFs

  • July 14, 2017
  • 12 replies
  • 5098 views
Posted on July 14, 2017 at 20:24

The original post was too long to process during our migration. Please click on the attachment to read the original post.
    This topic has been closed for replies.

    12 replies

    Tesla DeLorean
    Guru
    July 14, 2017
    Posted on July 14, 2017 at 20:48

    TLDR; Not going to dig through broken code. Published multiple working examples using the STM32F4BB-DIS. Currently have it working with >=256GB cards.

    Key to throughput will be large, aligned blocks, as big as possible, 32KB would be good

    Here's a build from 2013, I could probably dig up other posts and newer code

    https://community.st.com/0D50X00009XkgXqSAJ

     
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    July 14, 2017
    Posted on July 14, 2017 at 20:59

    This thread is likely to have F407 specific code, FATFS and MSC example, scroll up/down a bit

    https://community.st.com/0D50X00009XkiCESAZ

    Reading/writing random blocks is likely to ****** up the file system, code specific to FatFs sector read/write resides in diskio.c layer

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    dbte
    dbteAuthor
    Associate
    July 14, 2017
    Posted on July 14, 2017 at 21:27

    Thank-you ! Much appreciated.

    Tesla DeLorean
    Guru
    July 14, 2017
    Posted on July 14, 2017 at 21:45

    Need to do a 2017 refresh, with the exFAT version of FsFat and the smart clocking code that recognizes the F401C, F407G, F411E, etc variety of DISCO boards that plug into the STM32F4DIS-BB

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    July 20, 2017
    Posted on July 20, 2017 at 22:02

    2017 Refresh

    https://drive.google.com/open?id=0B7OY5pub_GfINVZnNXFvTGxaWmM

     
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    dbte
    dbteAuthor
    Associate
    July 21, 2017
    Posted on July 21, 2017 at 20:19

    Clive thanks for the updates for 2017. I was just reading the readme.txt file and I am questioning the feasibility in adapting the code that you provided into a Linux environment as it appears to be Window based. In the past I have imported a number of ST demo programs written for an IAR environment and they worked flawlessly. Am I setting myself up for an act in futility by transposing this code into a Linux environment? I am using a later version of GCC (i.e. 5.4.0) and the summon arm tool chain. I am not sure if you can answer that for me? It would seem to me that I ought to be able to get this program to work in Linux environment as I got the uSD Card program to work, but then again I could be completely wrong. Also might you be able to answer for me as to what file format might I best use for saving video. As I understand it I will need to access the DMA into blocks and save them onto the uSD Card yet I am at a loss on what file format to save them in. I am a novice at best so any insight would be helpful. Thanks in advance for you assistance.

    Tesla DeLorean
    Guru
    July 21, 2017
    Posted on July 21, 2017 at 21:55

    It is basically using GNU tools under Window to make the files. Would imagine if you suitably path the tools it would just make under Linux, nothing inherently Windows in there, just my development platform of choice. Make sure to use the ARM cross compiler.

    Review in the context of whether it is just an MPEG2 or similar type stream of data, you'd want to block it to the media in 32KB (or smaller power of 2) blocks so as not to cause a bottle-neck.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    dbte
    dbteAuthor
    Associate
    August 22, 2017
    Posted on August 22, 2017 at 21:13

    Clive thanks in advance for your help. I am attempting to make use of the fsfatdemo_stm32f4dis_bb_2017_rev1 file that you supplied. It would appear that I am down to one error and that I need an update on the stm32f4xx_cryp.h or the stm32f4xx_cryp.c file as I am getting the following error and I am not sure what I need to do to correct it. Lots to learn at this end. I have no update on the stm32f4xx_cryp.c file (mine is 2012). I have enclosed a portion of the source code from 519. (see below).

    STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp.c: In function 'CRYP_SaveContext':

    STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp.c:519:21: error: 'CRYP_Context' has no member named 'CR_bits9to2'

    CRYP_ContextSave->CR_bits9to2 = CRYP->CR & (CRYP_CR_KEYSIZE |

    ^

    STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp.c: In function 'CRYP_RestoreContext':

    STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp.c:564:33: error: 'CRYP_Context' has no member named 'CR_bits9to2'

    CRYP->CR = CRYP_ContextRestore->CR_bits9to2;

    ^

    Makefile:57: recipe for target 'stm32f4xx_cryp.o' failed

    make[1]: *** [stm32f4xx_cryp.o] Error 1

    *** here is a portion of the source at 519 ***

    /* Save the current configuration (bits [9:2] in the CRYP_CR register) */

    CRYP_ContextSave->CR_bits9to2 = CRYP->CR & (CRYP_CR_KEYSIZE |

    CRYP_CR_DATATYPE |

    CRYP_CR_ALGOMODE |

    CRYP_CR_ALGODIR);

    /* and, if not in ECB mode, the initialization vectors. */

    CRYP_ContextSave->CRYP_IV0LR = CRYP->IV0LR;

    CRYP_ContextSave->CRYP_IV0RR = CRYP->IV0RR;

    CRYP_ContextSave->CRYP_IV1LR = CRYP->IV1LR;

    CRYP_ContextSave->CRYP_IV1RR = CRYP->IV1RR;

    /* save The key value */

    Tesla DeLorean
    Guru
    August 22, 2017
    Posted on August 22, 2017 at 21:35

    I used the DSP/SPL 1.8.0 release from 2016

    http://www.st.com/en/embedded-software/stsw-stm32065.html

     

    You should insure you are using a coherent set of source files, and that your include paths don't favour pulling in older/different versions of the library files.

    The STM32F407 does not include the CRYPT peripheral.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    September 1, 2017
    Posted on September 02, 2017 at 00:56

    Post disappeared, this is the 2013 source

    https://drive.google.com/open?id=0B7OY5pub_GfIU0VFWWs2dmxKOFE

     
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    dbte
    dbteAuthor
    Associate
    September 2, 2017
    Posted on September 02, 2017 at 03:57

    My bad. It turns out that I had the source - it is just that I was not aware of it initially - hence I deleted the post. Regardless I am glad that you got back to me as I can now double check it. Thank-you !

    dbte
    dbteAuthor
    Associate
    September 7, 2017
    Posted on September 07, 2017 at 21:20

    Using the latest link (i.e.

    /external-link.jspa?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D0B7OY5pub_GfIU0VFWWs2dmxKOFE

    ) I managed to get things to work all except for the 32 bit ASCII characters that are not properly displaying themselves at the terminal (i.e. gtkterm). All said when I flash the micro using the demo.bin file that you provided I get what is to be expected. (see A). Yet when I flash things using my makefile the terminal displays gibberish (see B) or what appears to be gibberish. As for the rest of the program it is doing what it was meant to do and does indeed write 2 separate files onto the micro sd card (2 G Bytes) - that of length.txt and dir.txt - with an appropriate count of 12 written into the file length.txt. Given that the terminal at my end is not displaying the ASCII characters correctly might you offer some suggestions on how to correct this? I have been speculating that perhaps it is a problem with start and stop bits or clock frequency settings yet to date I have not been able to correct this (not sure exactly where to look and what to change). Any suggestions??

    A)

    FatFs Testing Opening and outputting MESSAGE.TXT hello world!Total = 12 Writing Length to LENGTH.TXT Writing Directory to DIR.TXT ---- 12 /MESSAGE.TXT ---- 4 /LENGTH.TXT ---- 0 /DIR.TXT D--- 0 /TRASH-~1 Done

    Yet when I flash things with

    B)

    ����#�[�j#���#D# \#��������,��e�k�J���թ#`##�4�(���S�#P#������b�C�Ñ�#��

    ܽ�

    R�]�ջh#H#�h#c��######�(�-�,��bh#[�?�#######(�%�<��#�#�#��########�T�ÙQ$���#########$���#Ē���#�S�b#��� D# \#��������,��e�c�J���թ#h##�<�(���[� X#������j�K�Ù�#��Խ�Z�]�ջh#H#�h#k��######�(�-�$��jh#[�?�#######(�%�<��#�#�#��########�T�ÙQ$���#########$���#Ē�� �#�[�j#��� D# \#��������,��e�k�B���թ#`##�4�(���S�#P#������b�C�ˑ�#��

    ܽ�

    R�]�ջh#H#�h#c��######�(�-�$��jh#[�?�####### �%�<��#�#�#��########�T�ˑQ$���#########,���#Ē���#�[�j#���#D# \#��������,��e�k�J���թ#h##�<�(���[�

    Tesla DeLorean
    Guru
    September 7, 2017
    Posted on September 07, 2017 at 21:58

    Make sure HSE_VALUE is 8000000

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    dbte
    dbteAuthor
    Associate
    September 14, 2017
    Posted on September 14, 2017 at 22:27

    Clive that fixed it ! I really appreciate your help here and I wanted to thank you personally. Had you not assisted me it would have taken me forever and a day to get it to work. You definitely saved me a lot of time and it is clear to me that there was a lot of work involved and even though there is so much more for me to learn I now have something to work with. Thanks once again !

    :)

    dbte
    dbteAuthor
    Associate
    October 13, 2017
    Posted on October 13, 2017 at 22:08

    I was looking to make another post related to this one, but in the interest of continuity I decided to post it here. For some time now I have been working with STM32F4DIS_BB Software Examples 20130307 from ST. To that end I got a number of the programs to work and I am now struggling to update the STM32F4xx_Camera_Example with the use of the FatFs updates that you provided (i.e. fsfatdemo_401_disco_rev1 ). The camera example has a number of provisions that make use of a FatFs structure from Embest that never worked – and as such I would like to implement what you have provided and make that happen. At best I have a working program that streams video to the display. As a preliminary first step I had thought it would be a simple matter of updating the camera example files with the updates that you provided and reinstate the camera program to stream the video followed by the implementation of the code that you provided for FatFs. Failing that do you have some updated code for the camera example using the Fatfs update? My initial findings are that upon updating the files to the camera example I am getting errors in the vicinity of stm32f4xx_i2c.c and stm32f4xx_spi.c. To get to the root of this matter I have created a spreadsheet comparing the camera example working files with the updated files with the hopes of isolating it. Might you offer some some additional insight on where to look and what to look at insofar as resolving this matter? I am finding that it is more complicated than I had initially anticipated.

    Tesla DeLorean
    Guru
    October 14, 2017
    Posted on October 14, 2017 at 01:28

    Not using the camera or lcd attachments just the base board.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    dbte
    dbteAuthor
    Associate
    October 14, 2017
    Posted on October 14, 2017 at 21:07

    Clive thanks for getting back to me - after much consternation I pinpointed the source of my grief. Arrgh!