<?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>S12 / MagniV MicrocontrollersのトピックRe: LIN Integration in BLDC Sensorless Code</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1728073#M19465</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/166309"&gt;@blukacs&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I'm sorry for the delay.&lt;/P&gt;
&lt;P&gt;Hard to say why the debugger crashers with that error, seems like this is not a runtime error after all.&lt;/P&gt;
&lt;P&gt;Maybe you can start over with this application note:&lt;/P&gt;
&lt;P&gt;Integrating the LIN driver with BLDC sensorless motor controller&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/docs/en/application-note/AN5201.pdf" target="_blank" rel="noopener"&gt;https://www.nxp.com/docs/en/application-note/AN5201.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;AN5201SW attached&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Fri, 22 Sep 2023 13:48:12 GMT</pubDate>
    <dc:creator>danielmartynek</dc:creator>
    <dc:date>2023-09-22T13:48:12Z</dc:date>
    <item>
      <title>LIN Integration in BLDC Sensorless Code</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1718871#M19428</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to implement LIN functionality in the S12 BLDC Sensorless Motor control code. Upon start-up the motor should spin at 1000RPM. When integrating the LIN portion of the code the motor can no longer be controlled. From my testing the problem appears to be the Timer initialization through LIN in lin_lld_timesrv.c, specifically with channel 2:&lt;/P&gt;&lt;LI-SPOILER&gt;#if (_MCU_ == _S12_)&lt;BR /&gt;void lin_lld_timer_S12_init&lt;BR /&gt;(&lt;BR /&gt;void&lt;BR /&gt;)&lt;BR /&gt;{&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;#if (defined(_MC9S12ZVML128_H) || defined(_MC9S12ZVL32_H)||defined(_MC9S12ZVHY64_H)||defined(_MC9S12ZVH128_H))&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;/*Configure the timer*/&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;// TIM0TSCR2 = 0x08; /*Timer prescaler = 32 (6.25MHZ/32 ~ 5.12[us]) */&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;TIM0TIOS_IOS2 = 1; /*Enable Channel 2 as Output Compare */&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;TIM0TIE_C2I = 1; /*Enable Channel 2 interrupt */&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;TIM0TC2 = (MCU_BUS_FREQ/1000000)*TIME_BASE_PERIOD;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;TIM0TSCR1_TSFRZ = 1; /*Disable the timer when the MCU is in freeze mode */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;TIM0TSCR1_TEN = 1; /*Enable the Timer */&lt;/SPAN&gt;&lt;/DIV&gt;#endif&lt;BR /&gt;...&lt;BR /&gt;}&lt;/LI-SPOILER&gt;&lt;P&gt;If Channel 2 is enabled as an output compare with interrupts the motor functionality is lost. Commenting out either line of the code resolves the issue so my best guess is that an interrupt is flagged which never exits, hanging the program. I would like to debug further in codewarrior and check the registers and see if any interrupts are active. However, the debugger seems to not be able to handle the LIN module, as incorporating it causes a CRC issue when attempting to initiate a debug session so I'm at a bit of an impasse.&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;INF: Calculated CRC-16 does not match block. (File = $6DE7, Device = $A66B)&lt;BR /&gt;ERR: Error verifying flash of device&lt;BR /&gt;ERR: Error occured during Flash programming.&lt;/LI-SPOILER&gt;&lt;P&gt;For reference, I have generated the LIN configuration(ldf and npf) portion following the reference from 'AN5122-Using NXP’s LIN Driver with the MagniV Family' and taken the LIN source code from the example code from "&lt;A href="https://community.nxp.com/t5/S12-MagniV-Microcontrollers/example-code-from-quot-Develop-LIN-based-Actuator-Applications/ta-p/1107544" target="_self"&gt;Develop LIN-based Actuator Applications with Mixed-signal MCUs&lt;/A&gt;" webinar&lt;/P&gt;&lt;P&gt;If anyone has questions or suggestions please reach out. Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 13:53:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1718871#M19428</guid>
      <dc:creator>blukacs</dc:creator>
      <dc:date>2023-09-07T13:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: LIN Integration in BLDC Sensorless Code</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1719562#M19430</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/166309"&gt;@blukacs&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;The BLDC demo uses Tim_Ch0 and&amp;nbsp;Tim_Ch3, while the LIN driver&amp;nbsp;Tim_Ch0 by default.&lt;/P&gt;
&lt;P&gt;I understand you moved the LIN scheduler to Tim_Ch2, there should be no problem.&lt;/P&gt;
&lt;P&gt;Can you test the Tim_Ch2&amp;nbsp;configuration stand-alone in a new project, or just the LIN driver with the Tim_Ch2 without the BLDC demo SW?&lt;/P&gt;
&lt;P&gt;If I would guess based on the description, the execution runs away.&lt;/P&gt;
&lt;P&gt;Can you implement something like this interrupt catcher to see if there is a machine exception, SPARE, TRAP, SWI, Spurious interrupt, etc instead of the Tim_Ch2?&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12Z-Interrupt-catcher-for-unexpected-interrupts/ta-p/1117675" target="_blank"&gt;https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12Z-Interrupt-catcher-for-unexpected-interrupts/ta-p/1117675&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 12:16:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1719562#M19430</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2023-09-08T12:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: LIN Integration in BLDC Sensorless Code</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1724947#M19457</link>
      <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;Thanks for the feedback and apologies for the late response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would take credit but the LIN scheduler came configured on Timer channel 2. It's the same story for the timer channels of the BLDC demo code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested a simple program that is only using the LIN driver (no BLDC control) to to read an up_down signal and report the status. In this case the program executes without issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can try implementing the interrupt catcher code provided, though won't I still need the debugger to test? I haven't been able to use the debugger with the LIN drivers, thought I haven't tested it on a standalone LIN application yet.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 20:10:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1724947#M19457</guid>
      <dc:creator>blukacs</dc:creator>
      <dc:date>2023-09-18T20:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: LIN Integration in BLDC Sensorless Code</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1728073#M19465</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/166309"&gt;@blukacs&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I'm sorry for the delay.&lt;/P&gt;
&lt;P&gt;Hard to say why the debugger crashers with that error, seems like this is not a runtime error after all.&lt;/P&gt;
&lt;P&gt;Maybe you can start over with this application note:&lt;/P&gt;
&lt;P&gt;Integrating the LIN driver with BLDC sensorless motor controller&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/docs/en/application-note/AN5201.pdf" target="_blank" rel="noopener"&gt;https://www.nxp.com/docs/en/application-note/AN5201.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;AN5201SW attached&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 13:48:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1728073#M19465</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2023-09-22T13:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: LIN Integration in BLDC Sensorless Code</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1730513#M19470</link>
      <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;This example worked for me. Now to figure out the differences between my implementation. Thanks very much.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 12:22:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LIN-Integration-in-BLDC-Sensorless-Code/m-p/1730513#M19470</guid>
      <dc:creator>blukacs</dc:creator>
      <dc:date>2023-09-27T12:22:26Z</dc:date>
    </item>
  </channel>
</rss>

