Skip to main content
cleanser23
Associate III
March 3, 2015
Question

Hal_sd_readblocks not working correctly

  • March 3, 2015
  • 1 reply
  • 787 views
Posted on March 03, 2015 at 16:23

Hal_sd_readblocks not working correctly

    This topic has been closed for replies.

    1 reply

    cleanser23
    Associate III
    March 3, 2015
    Posted on March 03, 2015 at 18:14

    woops, no message:

    Ok so there was another thread where clive1 already helped me work through a number of issues (as well as other posters on other threads, thanks to all of you!) but I still have one strange issue that is different enough for me to want to post another thread so that you all might get a chance to see it.

    Essentially, When I use HAL_SD_writeblocks(xxx) it works just fine (fatfs calls this function, I do not do it directly).  It writes in blocks of 512, and (so far as I know) will write as many blocks as it needs (for my current tests im only doing 1024 bytes).

    The problem comes in when I call f_read which in turn calls HAL_SD_readblocks(xxx) which has 2 strange errors:

    1) It reads half the bytes I specify eg I say read 512 and it reads 256

    2) It will only read a maximum of 1 block (512 bytes)

    Does anyone have any idea what could be happening?

    I have pullups on the lines, 100 nF dc caps on each VCC.

    This is an stm32f4xxx processor using keil and the stm32cube f4 v. 1.4 generated code.