<?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>MPC5xxx中的主题 Re: CAN length problem MPC5604</title>
    <link>https://community.nxp.com/t5/MPC5xxx/CAN-length-problem-MPC5604/m-p/727015#M9820</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;the problem is, that when you read the length of the message, you lock message buffer and this remains lock. Please check the the figure below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/33654i747CB66411186F58/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also recommend you to read chapter Mailbox lock mechanism.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have any other questions, please feel free to write me back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Nov 2017 13:07:17 GMT</pubDate>
    <dc:creator>martin_kovar</dc:creator>
    <dc:date>2017-11-22T13:07:17Z</dc:date>
    <item>
      <title>CAN length problem MPC5604</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-length-problem-MPC5604/m-p/727014#M9819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, my name is Xavier.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem with CAN interruption with MPC5604.&lt;/P&gt;&lt;P&gt;In the first message, i have the interruption, then I read the length of the message , but when i recieve the next message the interruption don´t occur again, only occur when change to another buffer or without reading the length of the message.&lt;/P&gt;&lt;P&gt;I read it with this command:&lt;/P&gt;&lt;P&gt;dummy = CAN_0.BUF[buffer_lectura].CS.B.LENGTH;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code:&lt;/P&gt;&lt;P&gt;#include "MPC5604P.h"&lt;BR /&gt;#include "IntcInterrupts.h"&lt;BR /&gt;#include "INIT.h"&lt;BR /&gt;#include "Definicions.h"&lt;BR /&gt;#include "Variables_globals.h"&lt;BR /&gt;#define LLIBRERIA&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//++++++++++++++++++++++++++++INTERRUPCIONS++++++++++++++++++++++++++++++++++++++++++++++++++&lt;BR /&gt;/*----------------- Rutina de servei a la interrupcio del CAN0 BUFFER 8-11 ------------------&lt;BR /&gt;/* Interrupcio del PC per a carregar totes les taules en memoria&lt;BR /&gt;-------------------------------------------------------------------------------------------*/&lt;BR /&gt;static void CAN0_ISR_TAULES (void) { &lt;BR /&gt; &lt;BR /&gt; if (nova_taula == 0) {&lt;BR /&gt; nova_taula = 1;&lt;BR /&gt; if (CAN_0.IFRL.B.BUF08I == 1) { // TAULA PUNTS I AILLAMENTS&lt;BR /&gt; dummy = CAN_0.TIMER.R; &lt;BR /&gt; buffer_lectura = 8;&lt;BR /&gt; &lt;BR /&gt; CAN_0.IFRL.B.BUF08I = 1;&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; if (CAN_0.IFRL.B.BUF09I == 1) { // TAULA CONTINUITAT&lt;BR /&gt; dummy = CAN_0.TIMER.R; &lt;BR /&gt; buffer_lectura = 9;&lt;BR /&gt; &lt;BR /&gt; CAN_0.IFRL.B.BUF09I = 1; &lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; if (CAN_0.IFRL.B.BUF10I == 1) { // TAULA CIRCUITS&lt;BR /&gt; dummy = CAN_0.TIMER.R; &lt;BR /&gt; buffer_lectura = 10;&lt;BR /&gt; &lt;BR /&gt; CAN_0.IFRL.B.BUF10I = 1; &lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; if (CAN_0.IFRL.B.BUF11I == 1) { // TAULA DETECCIONS&lt;BR /&gt; dummy = CAN_0.TIMER.R; &lt;BR /&gt; buffer_lectura = 11;&lt;BR /&gt; &lt;BR /&gt; CAN_0.IFRL.B.BUF11I = 1;&lt;BR /&gt; }&lt;BR /&gt; nova_taula = 0;&lt;BR /&gt; }&lt;BR /&gt; else { &lt;BR /&gt; //Send_Head(CAN_0.BUF[buffer_lectura].DATA.B[0], Mis_Error, codi_test, 0, 1); // ENVIAR ERROR&lt;BR /&gt; CAN_0.IFRL.R |= 0x00000F00;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*----------------- Rutina de servei a la interrupcio del CAN0 BUFFER 0-3 -------------------&lt;BR /&gt; * Interrupcio del PC per realitzar una nova comanda. General o particular. Amb o sense LOG's&lt;BR /&gt;--------------------------------------------------------------------------------------------*/&lt;BR /&gt;static void CAN0_ISR_COMANDES (void) { // Interrupcions CAN Buffer 0. Podem detectar que arrivi una operacio, abans d'acabar l'anterior&lt;BR /&gt; &lt;BR /&gt; if (nova_operacio == 0) {&lt;BR /&gt; if (CAN_0.IFRL.B.BUF00I == 1) { // Comanda General + LOG&lt;BR /&gt; nova_operacio = 1;&lt;BR /&gt; buffer_lectura = 0;&lt;BR /&gt; LOGS++;&lt;BR /&gt; codi_test = CAN_0.BUF[buffer_lectura].DATA.B[1];&lt;BR /&gt; //dummy = CAN_0.BUF[buffer_lectura].CS.B.LENGTH; // Read the size of CAN message&lt;BR /&gt; &lt;BR /&gt; CAN_0.IFRL.B.BUF00I = 1;&lt;BR /&gt; }&lt;BR /&gt; if (CAN_0.IFRL.B.BUF01I == 1) { // Comanda General&lt;BR /&gt; nova_operacio = 1;&lt;BR /&gt; buffer_lectura = 1;&lt;BR /&gt; codi_test = CAN_0.BUF[buffer_lectura].DATA.B[1];&lt;BR /&gt; //dummy = CAN_0.BUF[buffer_lectura].CS.B.LENGTH; // Read the size of CAN message&lt;BR /&gt; &lt;BR /&gt; CAN_0.IFRL.B.BUF01I = 1;&lt;BR /&gt; }&lt;BR /&gt; if (CAN_0.IFRL.B.BUF02I == 1) { // Comanda Propia + LOG&lt;BR /&gt; nova_operacio = 1;&lt;BR /&gt; buffer_lectura = 2;&lt;BR /&gt; LOGS++;&lt;BR /&gt; codi_test = CAN_0.BUF[buffer_lectura].DATA.B[1];&lt;BR /&gt; //dummy = CAN_0.BUF[buffer_lectura].CS.B.LENGTH; // Read the size of CAN message&lt;BR /&gt; &lt;BR /&gt; CAN_0.IFRL.B.BUF02I = 1;&lt;BR /&gt; }&lt;BR /&gt; if (CAN_0.IFRL.B.BUF03I == 1) { // Comanda Propia&lt;BR /&gt; nova_operacio = 1;&lt;BR /&gt; buffer_lectura = 3;&lt;BR /&gt; codi_test = CAN_0.BUF[buffer_lectura].DATA.B[1];&lt;BR /&gt; //dummy = CAN_0.BUF[buffer_lectura].CS.B.LENGTH; // Read the size of CAN message&lt;BR /&gt; &lt;BR /&gt; CAN_0.IFRL.B.BUF03I = 1;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; else { &lt;BR /&gt; //Error = 1;&lt;BR /&gt; //Send_Head(CAN_0.BUF[buffer_lectura].DATA.B[0], Mis_Error, 0x01, codi_test, 2); // ENVIAR ERROR&lt;BR /&gt; CAN_0.IFRL.R |= 0x0000000F;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//++++++++++++++++++++++++++++ PRINCIPAL +++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;/P&gt;&lt;P&gt;int main(void) &lt;BR /&gt;{&lt;BR /&gt; int i = 0;&lt;BR /&gt; &lt;BR /&gt; /* INICIALITZACIONS */&lt;BR /&gt; InitCMU_0(); // 8 MHz OSC requires non-default CMU_0 init&lt;BR /&gt; InitModesAndClks(); // Initialize mode entries&lt;BR /&gt; DisableWatchdog(); // Disable watchdog&lt;BR /&gt; initPeriClkGen();&lt;BR /&gt; InitGPIO(); // Initialize GPIO Pins&lt;BR /&gt; &lt;BR /&gt; INTC_InstallINTCInterruptHandler(CAN0_ISR_TAULES,70,14); // INIT FlexCAN Interrupt MB 8-11&lt;BR /&gt; INTC_InstallINTCInterruptHandler(CAN0_ISR_COMANDES,68,13); // INIT FlexCAN Interrupt MB 0-3&lt;BR /&gt; &lt;BR /&gt; EnableIrq(); // General Enable for ISR&lt;BR /&gt; Clr_LedErr();&lt;BR /&gt; Set_LedAlim();&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; // LLEGIR DEL POTENCIOMETRE EL ID&lt;BR /&gt; ID = 49; // ID = Carta&lt;BR /&gt; ID_Buffers = ID&amp;lt;&amp;lt;4; // ID_Buffers = Carta + 0000&lt;BR /&gt; &lt;BR /&gt; // CONFIGURAR CAN UN COP TENIM EL ID&lt;BR /&gt; InitCAN_0();&lt;BR /&gt; InitCAN_1();&lt;BR /&gt; &lt;BR /&gt; /* TEST */&lt;BR /&gt; while (1) &lt;BR /&gt; {&lt;BR /&gt; if (nova_operacio) // Nova operacio. Cada interrupcio del BUF04 de CAN&lt;BR /&gt; {&lt;BR /&gt; nova_operacio = 0;&lt;BR /&gt; //dummy = CAN_0.BUF[buffer_lectura].CS.B.LENGTH; // Read the size of CAN message&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2017 11:13:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-length-problem-MPC5604/m-p/727014#M9819</guid>
      <dc:creator>xuuurraa</dc:creator>
      <dc:date>2017-11-21T11:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: CAN length problem MPC5604</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-length-problem-MPC5604/m-p/727015#M9820</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;the problem is, that when you read the length of the message, you lock message buffer and this remains lock. Please check the the figure below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/33654i747CB66411186F58/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also recommend you to read chapter Mailbox lock mechanism.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have any other questions, please feel free to write me back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Nov 2017 13:07:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-length-problem-MPC5604/m-p/727015#M9820</guid>
      <dc:creator>martin_kovar</dc:creator>
      <dc:date>2017-11-22T13:07:17Z</dc:date>
    </item>
  </channel>
</rss>

