<?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 [KW36] ConfigTools v8 - Error creating peripherals.c in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW36-ConfigTools-v8-Error-creating-peripherals-c/m-p/1177125#M58710</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using a FRDM-KW36 NXP Board. I am trying to configure some basic things like PIT, CAN, etc.&lt;/P&gt;&lt;P&gt;My IDE is IAR but I use MCUXpresso ConfigTools Version 8.0 to set the pinout, the clock settings and peripherals information. I think that the CAN code create by default with this tool have some errors:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;peripherals.c - ConfigTools&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* Message buffer 0 configuration structure */
const flexcan_rx_mb_config_t CAN0_rx_mb_config_0 = {
  .id = 0x132UL,
  .format = kFLEXCAN_FrameFormatStandard,
  .type = kFLEXCAN_FrameTypeData
};

static void CAN0_init(void) {
  FLEXCAN_Init(CAN0_PERIPHERAL, &amp;amp;CAN0_config, CAN0_CLOCK_SOURCE);

  /* Message buffer 0 initialization */
  FLEXCAN_SetRxMbConfig(CAN0_PERIPHERAL, 0, &amp;amp;CAN0_rx_mb_config_0, true);
  /* Message buffer 1 initialization */
  FLEXCAN_SetTxMbConfig(CAN0_PERIPHERAL, 1, true);
  /* Enable FlexCAN interrupts of message buffers */
  FLEXCAN_EnableMbInterrupts(CAN0_PERIPHERAL, 1UL);
  /* Enable interrupt CAN0_IRQn request in the NVIC. */
  EnableIRQ(CAN0_FLEXCAN_IRQN);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In&amp;nbsp;&lt;EM&gt;&lt;SPAN&gt;CAN0_rx_mb_config_0&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt;the id is set to 0x132UL but the correct format should be&amp;nbsp;&lt;EM&gt;FLEXCAN_ID_STD(0x123).&lt;/EM&gt; If I don't change it only detects the 0x000 messages.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the &lt;EM&gt;EnableIRQ&lt;/EM&gt; it set the variable&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;CAN0_FLEXCAN_IRQN&lt;/EM&gt; which is an alias of&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN&gt;CAN0_IRQn.&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt; However, the&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN&gt;FLEXCAN_EnableMbInterrupts()&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt;interacts with&lt;EM&gt;CAN0_MB_IRQn.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Finally, in peripherals.h is defined:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* CAN0 interrupt vector ID (number). */
#define CAN0_FLEXCAN_IRQN CAN0_IRQn
/* CAN0 interrupt handler identifier. */
#define CAN0_FLEXCAN_IRQHANDLER CAN0_IRQHandler&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;But&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;CAN0_IRQHandler&lt;/EM&gt; is not the correct handle for this interrupt. It must be&amp;nbsp;&lt;EM&gt;CAN0_MB_IRQHandler.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Anyone else have the same problems?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Tue, 03 Nov 2020 08:45:28 GMT</pubDate>
    <dc:creator>acarles</dc:creator>
    <dc:date>2020-11-03T08:45:28Z</dc:date>
    <item>
      <title>[KW36] ConfigTools v8 - Error creating peripherals.c</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW36-ConfigTools-v8-Error-creating-peripherals-c/m-p/1177125#M58710</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using a FRDM-KW36 NXP Board. I am trying to configure some basic things like PIT, CAN, etc.&lt;/P&gt;&lt;P&gt;My IDE is IAR but I use MCUXpresso ConfigTools Version 8.0 to set the pinout, the clock settings and peripherals information. I think that the CAN code create by default with this tool have some errors:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;peripherals.c - ConfigTools&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* Message buffer 0 configuration structure */
const flexcan_rx_mb_config_t CAN0_rx_mb_config_0 = {
  .id = 0x132UL,
  .format = kFLEXCAN_FrameFormatStandard,
  .type = kFLEXCAN_FrameTypeData
};

static void CAN0_init(void) {
  FLEXCAN_Init(CAN0_PERIPHERAL, &amp;amp;CAN0_config, CAN0_CLOCK_SOURCE);

  /* Message buffer 0 initialization */
  FLEXCAN_SetRxMbConfig(CAN0_PERIPHERAL, 0, &amp;amp;CAN0_rx_mb_config_0, true);
  /* Message buffer 1 initialization */
  FLEXCAN_SetTxMbConfig(CAN0_PERIPHERAL, 1, true);
  /* Enable FlexCAN interrupts of message buffers */
  FLEXCAN_EnableMbInterrupts(CAN0_PERIPHERAL, 1UL);
  /* Enable interrupt CAN0_IRQn request in the NVIC. */
  EnableIRQ(CAN0_FLEXCAN_IRQN);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In&amp;nbsp;&lt;EM&gt;&lt;SPAN&gt;CAN0_rx_mb_config_0&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt;the id is set to 0x132UL but the correct format should be&amp;nbsp;&lt;EM&gt;FLEXCAN_ID_STD(0x123).&lt;/EM&gt; If I don't change it only detects the 0x000 messages.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the &lt;EM&gt;EnableIRQ&lt;/EM&gt; it set the variable&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;CAN0_FLEXCAN_IRQN&lt;/EM&gt; which is an alias of&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN&gt;CAN0_IRQn.&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt; However, the&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN&gt;FLEXCAN_EnableMbInterrupts()&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt;interacts with&lt;EM&gt;CAN0_MB_IRQn.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Finally, in peripherals.h is defined:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* CAN0 interrupt vector ID (number). */
#define CAN0_FLEXCAN_IRQN CAN0_IRQn
/* CAN0 interrupt handler identifier. */
#define CAN0_FLEXCAN_IRQHANDLER CAN0_IRQHandler&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;But&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;CAN0_IRQHandler&lt;/EM&gt; is not the correct handle for this interrupt. It must be&amp;nbsp;&lt;EM&gt;CAN0_MB_IRQHandler.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Anyone else have the same problems?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Nov 2020 08:45:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KW36-ConfigTools-v8-Error-creating-peripherals-c/m-p/1177125#M58710</guid>
      <dc:creator>acarles</dc:creator>
      <dc:date>2020-11-03T08:45:28Z</dc:date>
    </item>
  </channel>
</rss>

