<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>FatFs question</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33787/fatfs-question</link><description>I used nRF5_SDK_14.1.0_1dda907. 
 I used fatfs example. 
 Wirted data in the same file to sd card. 
 I discoverd that Max size of the file is 16KB. 
 Over the max size of file, when i write data to sd card, will be failure. 
 Can i change the max size</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 May 2018 01:52:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33787/fatfs-question" /><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/132161?ContentTypeID=1</link><pubDate>Wed, 16 May 2018 01:52:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf8e24ae-4ecf-4605-a851-4c1894e4e5ae</guid><dc:creator>Woody Hung</dc:creator><description>&lt;p&gt;&lt;span&gt;&lt;/span&gt;Excuse me,&lt;br /&gt;Previous error is not occurrence.&lt;/p&gt;
&lt;p&gt;But i discovery another error.&lt;/p&gt;
&lt;p&gt;Q1: New error is :&lt;br /&gt;line : 221 in diskio_blkdev.c.&lt;/p&gt;
&lt;p&gt;m_drives[drv].last_result is NRF_BLOCK_DEV_RESULT_IO_ERROR.&lt;/p&gt;
&lt;p&gt;I know that error occurr line : 106 in nrf_block_dev_sdc.c.&lt;/p&gt;
&lt;p&gt;How to debug it?&lt;/p&gt;
&lt;p&gt;And,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If an error code of 0x1 is returned from line 256 in&amp;nbsp;nrf_block_dev_sdc.c.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Q2 :&amp;nbsp;What is mean that&amp;nbsp; previous asynchronous operation in progress?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thx.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/132111?ContentTypeID=1</link><pubDate>Tue, 15 May 2018 15:29:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f760993-3845-48a2-a8f5-162744a504b6</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Hey woody Sorry for the long wait.&lt;/p&gt;
&lt;p&gt;An error code of 0x11 is NRF_ERROR_BUSY. It can be returned from line 250, 256, and 283 in nrf_block_dev_sdc.c.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;250:&amp;nbsp;(m_active_sdc_dev != p_sdc_dev) is true.&amp;nbsp;/* SDC instance is busy. */&lt;/p&gt;
&lt;p&gt;256:&amp;nbsp;app_sdc_busy_check() returns true.&amp;nbsp; /* Previous asynchronous operation in progress. */&lt;/p&gt;
&lt;p&gt;283:&amp;nbsp;app_sdc_block_read() returns&amp;nbsp;NRF_ERROR_BUSY, possible reasons are on line 1000 (m_cb.state.op != SDC_OP_IDLE), or line 1025(sdc_cmd()) of app_sdcard.c.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Håkon.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/131786?ContentTypeID=1</link><pubDate>Mon, 14 May 2018 06:08:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bd31e56-6eef-4721-b126-22de7639f0a0</guid><dc:creator>Woody Hung</dc:creator><description>&lt;p&gt;The line is 3423.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;if (disk_read(fs-&amp;gt;drv, fp-&amp;gt;buf, fp-&amp;gt;sect, 1) != RES_OK) res = FR_DISK_ERR;&lt;/p&gt;
&lt;p&gt;I discovered that :&lt;/p&gt;
&lt;p&gt;In the disk_read(BYTE drv, BYTE *buff, DWORD sector, UINT count) function.&lt;/p&gt;
&lt;p&gt;err_code = nrf_blk_dev_read_req(m_drives[drv].config.p_block_device, &amp;amp;req);&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;err_code&amp;nbsp;is 0x11.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;How to debug?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/131421?ContentTypeID=1</link><pubDate>Wed, 09 May 2018 01:12:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3225a129-0f53-4ed9-9399-43591442a67e</guid><dc:creator>Woody Hung</dc:creator><description>&lt;p&gt;The line is 3423.&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &lt;/span&gt;if (disk_read(fs-&amp;gt;drv, fp-&amp;gt;buf, fp-&amp;gt;sect, 1) != RES_OK) res = FR_DISK_ERR;&lt;/p&gt;
&lt;p&gt;I discovered that :&lt;/p&gt;
&lt;p&gt;In the disk_read(BYTE drv, BYTE *buff, DWORD sector, UINT count) function.&lt;/p&gt;
&lt;p&gt;err_code = nrf_blk_dev_read_req(m_drives[drv].config.p_block_device, &amp;amp;req);&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The &lt;span&gt;err_code&amp;nbsp;is 0x11.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;How to debug?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/131236?ContentTypeID=1</link><pubDate>Mon, 07 May 2018 14:43:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65a05b1e-5d12-4d70-9ba8-40ff9fe532c9</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Please forget the block count, it should be given by the SDCard library.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If f_open returns 0x01 this means: FR_DISK_ERR,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* (1) A hard error occurred in the low level disk I/O layer */&lt;/p&gt;
&lt;p&gt;There&amp;#39;s only two ways f_open can return FR_DISK_ERR and they are present in the lines 3407 to 3423 of ff.c in SDK15. I need you to debug&amp;nbsp;these lines and figure out which of these two lines that sets res = FR_DISK_ERR.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/131108?ContentTypeID=1</link><pubDate>Mon, 07 May 2018 00:22:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13122977-0bc0-42e1-8c89-9b55db7a228f</guid><dc:creator>Woody Hung</dc:creator><description>&lt;p&gt;How do i know the block size and block count ?&lt;/p&gt;
&lt;p&gt;thx.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/131028?ContentTypeID=1</link><pubDate>Fri, 04 May 2018 13:04:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c2e06e4-9e9c-46c3-af8d-bf1115a26f63</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;What is the block size and block count of the disk?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/130694?ContentTypeID=1</link><pubDate>Thu, 03 May 2018 01:16:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35fc32ea-9131-4dcc-910f-5d3805584a35</guid><dc:creator>Woody Hung</dc:creator><description>&lt;p&gt;Excuse me!!&lt;/p&gt;
&lt;p&gt;i posted no correct message&lt;/p&gt;
&lt;p&gt;New error message :&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/_F764D653_.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I discovery the return value is FR_DISK_ERR.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/2514._F764D653_.PNG" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/130625?ContentTypeID=1</link><pubDate>Wed, 02 May 2018 14:28:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac4e60ef-96e9-47af-b482-10ef6c463a94</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;We need information that describes the problem, in detail.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/130505?ContentTypeID=1</link><pubDate>Wed, 02 May 2018 10:43:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e524997a-744a-4e64-9e26-de0874071ced</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Error stil is in code not shown. I&amp;#39;m out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/130415?ContentTypeID=1</link><pubDate>Wed, 02 May 2018 00:40:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c20483ad-0d26-4889-bb28-c2b05f9212a3</guid><dc:creator>Woody Hung</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void write_data_to_sd_card_and_determine_file(	uint8_t *data_array,
																											uint16_t data_array_index)
{
	bool file_size_determine;

	file_size_determine = SD_card_for_file_size(data_array_index, file_name, testcount);

	SD_card_write_string_in_file(data_array, data_array_index, file_name);
	
	testcount++;
}


void SD_card_write_string_in_file(uint8_t* string, size_t string_size, uint8_t* file_name_array)
{
	  static FIL file;

    uint32_t bytes_written;
    FRESULT ff_result;
	
		NRF_LOG_INFO(&amp;quot;Writing to file %s ...&amp;quot;, file_name_array);
		ff_result = f_open(&amp;amp;file, file_name_array, FA_READ | FA_WRITE | FA_OPEN_APPEND);
		if (ff_result != FR_OK)
		{
			    NRF_LOG_INFO(&amp;quot;ff_result: %d .&amp;quot;,ff_result);
				NRF_LOG_INFO(&amp;quot;Unable to open or create file: %s .&amp;quot;, file_name_array);
				return;
		}

		ff_result = f_write(&amp;amp;file, string, string_size, (UINT *) &amp;amp;bytes_written);
		if (ff_result != FR_OK)
		{
				NRF_LOG_INFO(&amp;quot;Write failed\r\n.&amp;quot;);
		} 
		else
		{
				NRF_LOG_INFO(&amp;quot;%d bytes written.&amp;quot;, bytes_written);
		}
		 (void) f_close(&amp;amp;file);
}

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Error message :&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/3326.error.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I added line is 25.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/130345?ContentTypeID=1</link><pubDate>Mon, 30 Apr 2018 18:55:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b88a3747-dd71-4f91-8c45-7da3ed40a804</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Without looking at SD_card_write_string_in_file(), my guess is: Stack overflow.&lt;/p&gt;
&lt;p&gt;Why didn&amp;#39;t you post the function that actually fails?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/130215?ContentTypeID=1</link><pubDate>Mon, 30 Apr 2018 00:59:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90d6991c-59a6-4ac7-bf22-004e88ed39c6</guid><dc:creator>Woody Hung</dc:creator><description>&lt;p&gt;I used the code init the fill system.&lt;pre class="ui-code" data-mode="text"&gt;void fatfs_init(void)
{
    static FATFS fs;
    static DIR dir;
    static FILINFO fno;
    static FIL file;

    FRESULT ff_result;
    DSTATUS disk_state = STA_NOINIT;
		
		uint8_t string_start_init[] = &amp;quot;\r\nSD card init\r\n&amp;quot;;
		uint8_t file_name1[] = &amp;quot;Ant00000.TXT&amp;quot;;
		size_t	string_size;

    // Initialize FATFS disk I/O interface by providing the block device.
    static diskio_blkdev_t drives[] =
    {
            DISKIO_BLOCKDEV_CONFIG(NRF_BLOCKDEV_BASE_ADDR(m_block_dev_sdc, block_dev), NULL)
    };

    diskio_blockdev_register(drives, ARRAY_SIZE(drives));

    NRF_LOG_INFO(&amp;quot;Initializing disk 0 (SDC)...&amp;quot;);
    for (uint32_t retries = 3; retries &amp;amp;&amp;amp; disk_state; --retries)
    {
        disk_state = disk_initialize(0);
    }
    if (disk_state)
    {
        NRF_LOG_INFO(&amp;quot;Disk initialization failed.&amp;quot;);
        return;
    }

    uint32_t blocks_per_mb = (1024uL * 1024uL) / m_block_dev_sdc.block_dev.p_ops-&amp;gt;geometry(&amp;amp;m_block_dev_sdc.block_dev)-&amp;gt;blk_size;
    uint32_t capacity = m_block_dev_sdc.block_dev.p_ops-&amp;gt;geometry(&amp;amp;m_block_dev_sdc.block_dev)-&amp;gt;blk_count / blocks_per_mb;
    NRF_LOG_INFO(&amp;quot;Capacity: %d MB&amp;quot;, capacity);

    NRF_LOG_INFO(&amp;quot;Mounting volume...&amp;quot;);
    ff_result = f_mount(&amp;amp;fs, &amp;quot;&amp;quot;, 1);
    if (ff_result)
    {
        NRF_LOG_INFO(&amp;quot;Mount failed.&amp;quot;);
        return;
    }

	NRF_LOG_RAW_INFO(&amp;quot;&amp;quot;);

	string_size = sizeof(string_start_init) - 1;
	SD_card_write_string_in_file(string_start_init, string_size,  file_name1);
    return;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/129979?ContentTypeID=1</link><pubDate>Thu, 26 Apr 2018 13:29:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05a16d83-87ce-4f9b-9d1c-db26d9d150df</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;I need to know how you have initialized the file system, do you have any code, tracelogs, or logs that you can share?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/129859?ContentTypeID=1</link><pubDate>Thu, 26 Apr 2018 05:12:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19566c4e-904c-46d1-a576-6c73e8041b3a</guid><dc:creator>Woody Hung</dc:creator><description>&lt;p&gt;I used 8GB sd card.&lt;/p&gt;
&lt;p&gt;If there are two file in the sd card.&lt;/p&gt;
&lt;p&gt;The one is 16KB.&lt;/p&gt;
&lt;p&gt;Another is 14 KB.&lt;/p&gt;
&lt;p&gt;If i write data to 14KB file, will be successful.&lt;/p&gt;
&lt;p&gt;If i write data to 16KB file, will be failure.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/129773?ContentTypeID=1</link><pubDate>Wed, 25 Apr 2018 12:53:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e49415c-1478-48b8-95b1-b594dd27a22c</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Unusual, as the common cluster size of multi-GB-sized SD(HC) cards is 32KB. Did you try different cards?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FatFs question</title><link>https://devzone.nordicsemi.com/thread/129762?ContentTypeID=1</link><pubDate>Wed, 25 Apr 2018 12:35:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd7c338e-d5c7-4620-b64b-7a1583cc63eb</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Hey Woody,&lt;/p&gt;
[quote user=""]Over the max size of file, when i write data to sd card, will be failure.[/quote]
&lt;p&gt;I need the trace info.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Håkon.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>