<?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>Kinetis MicrocontrollersのトピックRe: Crash on configuring the ADC pin</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Crash-on-configuring-the-ADC-pin/m-p/696335#M42842</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gaurav&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PTA0 defaults to SWD_CLK so when you configure it to an analog function the debugger will no longer be able to communicate.&lt;BR /&gt;Are you thus sure that it is a crash of loss of contact with the debugger?&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Sep 2017 19:16:48 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2017-09-07T19:16:48Z</dc:date>
    <item>
      <title>Crash on configuring the ADC pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Crash-on-configuring-the-ADC-pin/m-p/696334#M42841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using this device&amp;nbsp;MKL03Z32VFG4. Everything else that I want to use on the MCU works&amp;nbsp;but as soon as I add the following line to the pin-mux setting, the system always crashes at this line.&lt;/P&gt;&lt;P&gt;==========&lt;/P&gt;&lt;P&gt;PORT_SetPinMux(PORTA, PIN0_IDX, kPORT_PinDisabledOrAnalog); /* PORTA0 (pin 14) is configured as ADC0_SE15 */&lt;/P&gt;&lt;P&gt;=================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me. I need to use this pin as the analog pin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function where this line is added is given below. (all the settings are done using the pins tool)&lt;/P&gt;&lt;P&gt;===========&lt;/P&gt;&lt;P&gt;void BOARD_InitPins(void) {&lt;BR /&gt; CLOCK_EnableClock(kCLOCK_PortA); /* Port A Clock Gate Control: Clock enabled */&lt;BR /&gt; CLOCK_EnableClock(kCLOCK_PortB); /* Port B Clock Gate Control: Clock enabled */&lt;/P&gt;&lt;P&gt;#if defined(BATT_MEASUREMENT_IMPLEMENTED) &amp;amp;&amp;amp; BATT_MEASUREMENT_IMPLEMENTED == 1&lt;BR /&gt; PORT_SetPinMux(PORTA, PIN0_IDX, kPORT_PinDisabledOrAnalog); /* PORTA0 (pin 14) is configured as ADC0_SE15 */&lt;BR /&gt;#endif &lt;BR /&gt; PORT_SetPinMux(PORTA, PIN3_IDX, kPORT_PinDisabledOrAnalog); /* PORTA3 (pin 3) is configured as EXTAL0 */&lt;BR /&gt; PORT_SetPinMux(PORTA, PIN4_IDX, kPORT_MuxAsGpio); /* PORTA4 (pin 4) is configured as PTA4 */&lt;BR /&gt; PORT_SetPinMux(PORTA, PIN5_IDX, kPORT_MuxAsGpio); /* PORTA5 (pin 5) is configured as PTA5 */&lt;BR /&gt; PORT_SetPinMux(PORTA, PIN6_IDX, kPORT_MuxAsGpio); /* PORTA6 (pin 6) is configured as PTA6 */&lt;BR /&gt; PORT_SetPinMux(PORTA, PIN7_IDX, kPORT_MuxAsGpio); /* PORTA7 (pin 7) is configured as PTA7 */&lt;/P&gt;&lt;P&gt;PORT_SetPinMux(PORTB, PIN0_IDX, kPORT_MuxAsGpio); /* PORTB0 (pin 8) is configured as LLWU_P4 */&lt;BR /&gt; PORT_SetPinMux(PORTB, PIN1_IDX, kPORT_MuxAlt2); /* PORTB1 (pin 13) is configured as LPUART0_TX */&lt;BR /&gt; PORTB-&amp;gt;PCR[1] = ((PORTB-&amp;gt;PCR[1] &amp;amp;&lt;BR /&gt; (~(PORT_PCR_PE_MASK | PORT_PCR_ISF_MASK))) /* Mask bits to zero which are setting */&lt;BR /&gt; | PORT_PCR_PE(PCR_PE_ENABLED) /* Pull Enable: Internal pullup or pulldown resistor is enabled on the corresponding pin, if the pin is configured as a digital input. */&lt;BR /&gt; );&lt;BR /&gt; PORT_SetPinMux(PORTB, PIN2_IDX, kPORT_MuxAlt2); /* PORTB2 (pin 14) is configured as LPUART0_RX */&lt;BR /&gt; PORT_SetPinMux(PORTB, PIN3_IDX, kPORT_MuxAlt2); /* PORTB3 (pin 11) is configured as I2C0_SCL */&lt;BR /&gt; PORT_SetPinMux(PORTB, PIN4_IDX, kPORT_MuxAlt2); /* PORTB4 (pin 12) is configured as I2C0_SDA */&lt;BR /&gt; PORT_SetPinMux(PORTB, PIN5_IDX, kPORT_MuxAsGpio); /* PORTB5 (pin 13) is configured as PTB5 */&lt;BR /&gt; SIM-&amp;gt;SOPT5 = ((SIM-&amp;gt;SOPT5 &amp;amp;&lt;BR /&gt; (~(SIM_SOPT5_LPUART0RXSRC_MASK))) /* Mask bits to zero which are setting */&lt;BR /&gt; | SIM_SOPT5_LPUART0RXSRC(SOPT5_LPUART0RXSRC_LPUART_RX) /* LPUART0 Receive Data Source Select: LPUART_RX pin */&lt;BR /&gt; );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;===========&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Gaurav.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 15:53:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Crash-on-configuring-the-ADC-pin/m-p/696334#M42841</guid>
      <dc:creator>gauravbanyal</dc:creator>
      <dc:date>2017-09-07T15:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Crash on configuring the ADC pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Crash-on-configuring-the-ADC-pin/m-p/696335#M42842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gaurav&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PTA0 defaults to SWD_CLK so when you configure it to an analog function the debugger will no longer be able to communicate.&lt;BR /&gt;Are you thus sure that it is a crash of loss of contact with the debugger?&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 19:16:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Crash-on-configuring-the-ADC-pin/m-p/696335#M42842</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2017-09-07T19:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Crash on configuring the ADC pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Crash-on-configuring-the-ADC-pin/m-p/696336#M42843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The crash happens even when the debugger is not attached. I keep seeing prints on UART debug terminal, that are coded before the pin mux setting function call over and over again when running without the debugger.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other reason why it crashes?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Gaurav.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 21:44:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Crash-on-configuring-the-ADC-pin/m-p/696336#M42843</guid>
      <dc:creator>gauravbanyal</dc:creator>
      <dc:date>2017-09-07T21:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Crash on configuring the ADC pin</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Crash-on-configuring-the-ADC-pin/m-p/696337#M42844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gaurav&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the uTasker project to test this ADC input on the FRDM-KL03Z and didn't have any problems. With debugger connected it disconnects as soon as the port is reconfigured for its analog utilisation, which is as expected, but otherwise (with or without debugger) all works identically and normally.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached you can find the binary that you can load to the FRDM-KL03Z.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output (115200 Baud on the VCOM OpenSDA port) shows the board starting and printing out the ADC value every second:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;Hello, world... KINETIS&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;OS Heap use = 0x014d from 0x0400&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x0379&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x0383&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x037c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x02d6&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x02de&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x02ec&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x02d8&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x0373&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x0326&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x040b&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x02cf&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x02a5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;ADC triggered: 0x0366&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code that is used to perform the pin configuration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;_CONFIG_PERIPHERAL(A, 0, PA_0_ADC0_SE15); // ensure that the ADC pin is configured (warning: this changes the default SWD_CLK configuration, losing any debug support!)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which equates simply to:&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;SIM_SCGC5 |= SIM_SCGC5_PORTA;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier,monospace;"&gt;PORTA_PCR0 = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so you can compare with the code that is executed by the routines you use, but I don't expect any difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect that the real problem is not with this line of code but the fact that the debugger can't be used after setting it is causing confusion as to the actual problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In case this doesn't help and you need a fast solution you can request professional help at &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fsupport.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/support.html&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;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis%2FFRDM-KL03Z.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis/FRDM-KL03Z.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Sep 2017 22:43:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Crash-on-configuring-the-ADC-pin/m-p/696337#M42844</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2017-09-10T22:43:47Z</dc:date>
    </item>
  </channel>
</rss>

