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?