<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Re: How to use FATFs in multiple functions of a program? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372804#M19429</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Erich&lt;/P&gt;&lt;P&gt;Thanks for the quick reply. I looked at the links and checked the code and updated my code according to your suggestions but still it didn't worked. If I write all the code in main it works fine but my application requires it to work on interrupt based. Attached is the modified code generated in CW10.6. I am using custom made board. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Amit Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Aug 2014 06:17:32 GMT</pubDate>
    <dc:creator>Amit_Kumar1</dc:creator>
    <dc:date>2014-08-22T06:17:32Z</dc:date>
    <item>
      <title>How to use FATFs in multiple functions of a program?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372802#M19427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am using K60 with cw10.6. I have created a project with multiple files .i.e for each functions there is a separate file. I wanted to implement FATFs in main.c and Events.c but it didn't work (I tried this many times earlier this year) but it didn't worked so I made a separate file for this.&lt;/P&gt;&lt;P&gt;I tried using the functions present in this file from main as well as events.c but my program hanged. on init function. kindly look into this where I am doing wrong.&lt;/P&gt;&lt;P&gt;If I tried to use extern FATFs fs; or extern FIL fp1; in events.c i got errors so i made these files to overcome this issues. I am using FAT SD card library of Erich Styger. using SPI.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Amit Kumar&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337606"&gt;SD_Card.h.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337606"&gt;SD_Card.c.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2014 12:42:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372802#M19427</guid>
      <dc:creator>Amit_Kumar1</dc:creator>
      <dc:date>2014-08-21T12:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use FATFs in multiple functions of a program?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372803#M19428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;If you are using the TWR-K60, I recommend that you verify proper operation with one of the demo examples:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/TWR-K60F120M/TWR-K60F120M_FatFS" title="https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/TWR-K60F120M/TWR-K60F120M_FatFS"&gt;mcuoneclipse/Examples/TWR-K60F120M/TWR-K60F120M_FatFS at master · ErichStyger/mcuoneclipse · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;it looks like you are using it bare metal (without RTOS), so have a look here too:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/TRW-K60N512/TWR-K60N512_FatFS_BM" title="https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/TRW-K60N512/TWR-K60N512_FatFS_BM"&gt;mcuoneclipse/Examples/TRW-K60N512/TWR-K60N512_FatFS_BM at master · ErichStyger/mcuoneclipse · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apart of that, I do not see the proper includes in your example code (e.g. include to WAIT1.h and FAT1.h is missing), and FAT1_Init() is not used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other thing to keep in mind: mount the file system only once (just in case this might be your problem).&lt;/P&gt;&lt;P&gt;Additionally, if you are using the FAT module,you need to feed the timeout timer so the SPI operation can timeout. See the implementation of this in the Events.c of both above examples.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2014 14:33:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372803#M19428</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2014-08-21T14:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to use FATFs in multiple functions of a program?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372804#M19429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Erich&lt;/P&gt;&lt;P&gt;Thanks for the quick reply. I looked at the links and checked the code and updated my code according to your suggestions but still it didn't worked. If I write all the code in main it works fine but my application requires it to work on interrupt based. Attached is the modified code generated in CW10.6. I am using custom made board. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Amit Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 06:17:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372804#M19429</guid>
      <dc:creator>Amit_Kumar1</dc:creator>
      <dc:date>2014-08-22T06:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to use FATFs in multiple functions of a program?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372805#M19430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a very, very bad idea to read/write files in an interrupt service routine. This is not how you should do things, and it cannot work that way.&lt;/P&gt;&lt;P&gt;If you are in an interrupt context, then interrupts are disabled (or at least most of them). But you need interrupts (e.g. timer for timeout, interrupts for SPI) active while writing/reading files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need to trigger file I/O from an interrupt, then simply set a flag from that interrupt.&lt;/P&gt;&lt;P&gt;And do the writing/reading from your main application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps to understand the issue you are facing,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 08:33:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372805#M19430</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2014-08-22T08:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to use FATFs in multiple functions of a program?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372806#M19431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the feedback. what if in the above program I generate a flag in an ISR as u suggested and in main functions call the SD card functions ? will it work in that case ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Amit Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 08:38:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372806#M19431</guid>
      <dc:creator>Amit_Kumar1</dc:creator>
      <dc:date>2014-08-22T08:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to use FATFs in multiple functions of a program?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372807#M19432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amit,&lt;/P&gt;&lt;P&gt;yes, this is how things are supposed to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 08:45:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372807#M19432</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2014-08-22T08:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to use FATFs in multiple functions of a program?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372808#M19433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Erich for your precious time I will make it work that way and will update you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Amit Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 08:48:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-FATFs-in-multiple-functions-of-a-program/m-p/372808#M19433</guid>
      <dc:creator>Amit_Kumar1</dc:creator>
      <dc:date>2014-08-22T08:48:23Z</dc:date>
    </item>
  </channel>
</rss>

