This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Error to initialize the sdcard (disk_initialize)

Hi,

I am trying to insert the fatfs code example into my custom project. I already added all the files e dependences and when I call the fatfs_example function from main it works fine and I can to write into SDCARD.

I did it only to test the import, but in my solution I need to call the function that write into sdcard from other function (not main) and when I call the fatfs_example function from other function I have an error.

I am debugging the code and I found that the problem is in the disk_initialize function. In this function, the library sets the m_drives[drv].busy to true, and this state not change to false.

After the m_drives[drv].busy to set to true, has the follow code:

ret_code_t err_code = nrf_blk_dev_init(m_drives[drv].config.p_block_device, block_dev_handler, (void *) (uint32_t) drv);

And so,

if (err_code == NRF_SUCCESS)
{
while (m_drives[drv].busy)
{
m_drives[drv].config.wait_func();
}

(...)

(The error_code value is returning NRF_SUCCESS)

My problem is when the fatfs_example function is called out of the main, the m_drives[drv].busy is always true and tha program does not leave the while above (m_drives[drv].config.wait_func();)

Can anyone help me in this question? Why is can be happening?

Parents Reply
  • Hi Alseth,

    Unfortunally I cant change the function call to main context because I need to write into sdcard when the the firmware receive a bluetooth message. 

    Summing up, I have some develop boards and when one board sends to another board, the board that received the bluetooth message must to save the message into sdcard.

    How I can change the priority these interrupts or how I how I can to do to discovery which interrpt is  preventing the firmware to write into sdcard?

Children
Related