<?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>LPC MicrocontrollersのトピックRe: CAN ACK (and etc) problem</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/CAN-ACK-and-etc-problem/m-p/522786#M5422</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by arw on Fri Aug 23 10:01:17 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;In my experience with this type of behavior, there is normally a mismatch in baud rate between the two nodes.&amp;nbsp; Check carefully that the baud rate and bit timings match on both nodes.&amp;nbsp; With the clock frequency you have defined above, I'm not sure if you can hit a typical bus baud rate like 250kHz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have a bus analyzer, it might also give you more information by auto-baud adaptating to the transmitter's baud rate.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:56:47 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:56:47Z</dc:date>
    <item>
      <title>CAN ACK (and etc) problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/CAN-ACK-and-etc-problem/m-p/522785#M5421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by m2babaey on Tue Aug 20 01:36:23 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to make CAN1 of LPC1768 work using CMSIS drivers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I transmitted a message to another CAN device, the message was &lt;/SPAN&gt;&lt;STRONG&gt;not &lt;/STRONG&gt;&lt;SPAN&gt;transferred successfully (the receiver was getting wrong data) so I decided to check loopback mode first&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now when self test mode(STM) in CAN1MOD is 1 and self reception request (SSR) is 1 message is transmitted and receive interrupt occurs, everything ok&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But if SSR=1 and STM=0 no receive interrupt happens, although if I read receive registers, they have the correct data but it seems transmit error counter limit is reached not no acknowledge is received. Also no interrupt occurs&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In another test, when the other can device sends messages to me, receive error counter limit appears and no interrupt is generated&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Why receive interrupt doesn't occur when STM=0?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. How can I understand what is the data that is transmitted so find out what the problem is?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. How can one figure out what kind of error has occurred in receiving so the receive error count limit has reached?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Any other hints that can help me the fix my CAN receive and transmit?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the related part of my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#define Fcpu 23040000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //11.0592 xtal, M=100, N=6, CPU_D=4&amp;nbsp; =&amp;gt; 2*xtal*M/N/CPU_D/4 = MIPS

void CAN_IRQHandler(void)
{
unsigned char myvar[60];
CAN_ReceiveMsg(LPC_CAN1,&amp;amp;RXMsg);

SendString0("CAN Int\r\n");
sprintf(myvar,"RID is %x&amp;nbsp; and ICR is %x and RDA is %x and RFS is %x\r\n",LPC_CAN1-&amp;gt;RID,LPC_CAN1-&amp;gt;ICR,LPC_CAN1-&amp;gt;RDA,LPC_CAN1-&amp;gt;RFS);
SendString0(myvar);
LPC_CAN1-&amp;gt;CMR = CAN_CMR_AT | CAN_CMR_RRB | CAN_CMR_CDO;
}

void SendCANMsg()
{
TXMsg.id = 46;
TXMsg.dataA[0] = 5;
TXMsg.dataA[1] = 6;
TXMsg.dataA[2] = 7;
TXMsg.dataA[3] = 8;

TXMsg.len = 4;
TXMsg.format = STD_ID_FORMAT;
TXMsg.type&amp;nbsp;&amp;nbsp; = DATA_FRAME;

CAN_SendMsg(LPC_CAN1,&amp;amp;TXMsg);
}


int main (void) 
{
unsigned int i;
unsigned char myvar[30];
baudrate=986040;
CAN_Init(LPC_CAN1, baudrate);&amp;nbsp; //((int) 983040)
//Enable Interrupt
CAN_IRQCmd(LPC_CAN1, CANINT_RIE, ENABLE);
CAN_IRQCmd(LPC_CAN1, CANINT_DOIE, ENABLE);
CAN_ModeConfig(LPC_CAN1,CAN_OPERATING_MODE , ENABLE); //CAN_OPERATING_MODE CAN_MOD_STM
CAN_SetAFMode(LPC_CANAF,CAN_AccBP);
NVIC_EnableIRQ(CAN_IRQn);

while(1)
{
if(doProcess) //every 1 second is activated by timer 0
{
&amp;nbsp; doProcess=0;
sprintf(myvar,"GSR is %x&amp;nbsp; and SR is %x\r\n",LPC_CAN1-&amp;gt;GSR,LPC_CAN1-&amp;gt;SR);
SendString0(myvar);
sprintf(myvar,"RID is %d&amp;nbsp; and DATA is %x\r\n",LPC_CAN1-&amp;gt;RID,LPC_CAN1-&amp;gt;RDA);
LPC_CAN1-&amp;gt;CMR = CAN_CMR_AT | CAN_CMR_RRB | CAN_CMR_CDO;
SendString0(myvar);/**/
SendCANMsg();

}

}
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:56:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/CAN-ACK-and-etc-problem/m-p/522785#M5421</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: CAN ACK (and etc) problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/CAN-ACK-and-etc-problem/m-p/522786#M5422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by arw on Fri Aug 23 10:01:17 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;In my experience with this type of behavior, there is normally a mismatch in baud rate between the two nodes.&amp;nbsp; Check carefully that the baud rate and bit timings match on both nodes.&amp;nbsp; With the clock frequency you have defined above, I'm not sure if you can hit a typical bus baud rate like 250kHz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have a bus analyzer, it might also give you more information by auto-baud adaptating to the transmitter's baud rate.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:56:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/CAN-ACK-and-etc-problem/m-p/522786#M5422</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:56:47Z</dc:date>
    </item>
  </channel>
</rss>

