<?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: Hard Fault in keyboard interrupts in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-in-keyboard-interrupts/m-p/377367#M19947</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guilherme&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't help with KDS tool but I have used the KBI on several KE parts (parts with 8 and 32 bit register sets, whereby yours has the 8 bit register set).&lt;/P&gt;&lt;P&gt;This version is in fact very simple (almost the same as the IRQ module but with multiple input possibilities) - I showed my code here which may help you find a difference between the tool generated code and the code that I have successfully used.&lt;/P&gt;&lt;P&gt;See &lt;A _jive_internal="true" href="https://community.nxp.com/message/465138#465138" title="https://community.freescale.com/message/465138#465138"&gt;https://community.freescale.com/message/465138#465138&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. It may be that your code is just forgetting to enable the KBI clock in SIM_SCGC and then you would have a hard fault when you try to write to any of its registers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 27 Dec 2014 02:43:28 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2014-12-27T02:43:28Z</dc:date>
    <item>
      <title>Hard Fault in keyboard interrupts</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-in-keyboard-interrupts/m-p/377366#M19946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, Good day!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am developing with microcontroller MKE04Z8M4 and I am trying to use interrupts that are generated by the keypad. These interrupts are related to the pins: PTA0, PTA1, PTA2, PTA3, PTB0, PTB1, PTB2 and PTB3. To perform my test I am using PTB0 pin. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I have difficulties using the resources of the KDS tool (Kinetis Design Studio). It doesn't provide a "Bean" for the keyboard interrupts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using the feature "Init_KBI", found in "Components Library / Categories / CPU Internal Peripherals / Peripheral Initialization / Init_KBI ". After creating that component, I configure its property "Component Inspector - KABI0" as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Settings : &lt;/P&gt;&lt;P&gt;“Clock gate” : “Do not Initialize”&lt;/P&gt;&lt;P&gt;“Detection mode” : “edges only”&lt;/P&gt;&lt;P&gt;And in all Pin Sensitivity I leave as : “Falling edge or low level”&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pins/Signals&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I enable this option only for pin 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; “Input pin 4” : “PTB0”&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; “Input pin 4 signal” : “KBI0_Pin_PTB0”&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interrupts&lt;/P&gt;&lt;P&gt;“Interrupt request” : TRUE&lt;/P&gt;&lt;P&gt;“Interrupt priority” = 0&lt;/P&gt;&lt;P&gt;“ISR name” = “Int_ISR”&lt;/P&gt;&lt;P&gt;“KBI_Interrupt” = TRUE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initialization&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; “Call Init method” = TRUE;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After having set the component "Init_KBI", I use the feature "Generate Code Processor Expert" and get the following result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Components&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; KBI0:Init_KBI&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Init_ISR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Init&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PDD(directory)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;A module was created to initialize KDB0 like this:&lt;/P&gt;&lt;P&gt;void KBI0_Init(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* KBI0_SC: ??=0,??=0,??=0,??=0,KBF=0,KBACK=0,KBIE=0,KBMOD=0 */&lt;/P&gt;&lt;P&gt;&amp;nbsp; KBI0_SC = 0x00U;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* KBI0_ES: KBEDG=0 */&lt;/P&gt;&lt;P&gt;&amp;nbsp; KBI0_ES = KBI_ES_KBEDG(0x00);&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* KBI0_PE: KBIPE=0x10 */&lt;/P&gt;&lt;P&gt;&amp;nbsp; KBI0_PE = KBI_PE_KBIPE(0x10);&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* KBI0_SC: KBACK=1 */&lt;/P&gt;&lt;P&gt;&amp;nbsp; KBI0_SC |= KBI_SC_KBACK_MASK;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* KBI0_SC: KBIE=1 */&lt;/P&gt;&lt;P&gt;&amp;nbsp; KBI0_SC |= KBI_SC_KBIE_MASK;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And below this function, there is a commented code block referring to an ISR:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*&lt;/P&gt;&lt;P&gt;** ###################################################################&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;**&amp;nbsp; The interrupt service routine(s) must be implemented&lt;/P&gt;&lt;P&gt;**&amp;nbsp; by user in one of the following user modules.&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;**&amp;nbsp; If the "Generate ISR" option is enabled, Processor Expert generates&lt;/P&gt;&lt;P&gt;**&amp;nbsp; ISR templates in the CPU event module.&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;**&amp;nbsp; User modules:&lt;/P&gt;&lt;P&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; main.c&lt;/P&gt;&lt;P&gt;**&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Events.c&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;** ###################################################################&lt;/P&gt;&lt;P&gt;PE_ISR(Int_ISR)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;// NOTE: The routine should include actions to clear the appropriate&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interrupt flags.&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And, obeying the comment, I'm putting that function in module "Events.c". After these procedures I build the project, start the debugger, boot up and execute the code Step by Step. As I enter the function "KBI0_Init" a Hard fault error happens. It seems the &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;compiler doesn't recognize my ISR, although it appears at the interrupt vectors table. I couldn't find the solution to this problem. Has someone managed to use keyboard interrupts for this chip using the KDS tool?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Dec 2014 13:15:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-in-keyboard-interrupts/m-p/377366#M19946</guid>
      <dc:creator>guilhermeromero</dc:creator>
      <dc:date>2014-12-26T13:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Hard Fault in keyboard interrupts</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-in-keyboard-interrupts/m-p/377367#M19947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guilherme&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't help with KDS tool but I have used the KBI on several KE parts (parts with 8 and 32 bit register sets, whereby yours has the 8 bit register set).&lt;/P&gt;&lt;P&gt;This version is in fact very simple (almost the same as the IRQ module but with multiple input possibilities) - I showed my code here which may help you find a difference between the tool generated code and the code that I have successfully used.&lt;/P&gt;&lt;P&gt;See &lt;A _jive_internal="true" href="https://community.nxp.com/message/465138#465138" title="https://community.freescale.com/message/465138#465138"&gt;https://community.freescale.com/message/465138#465138&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. It may be that your code is just forgetting to enable the KBI clock in SIM_SCGC and then you would have a hard fault when you try to write to any of its registers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Dec 2014 02:43:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-Fault-in-keyboard-interrupts/m-p/377367#M19947</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-12-27T02:43:28Z</dc:date>
    </item>
  </channel>
</rss>

