TXE0 flag in CANTFLG never set after CAN message sent and message send forever

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TXE0 flag in CANTFLG never set after CAN message sent and message send forever

2,509 Views
Peder
Contributor I
Code:
unsigned char CAN0SendFrame(unsigned long id, unsigned char priority, unsigned char length, unsigned char *txdata ){        unsigned char index;    unsigned char txbuffer = {0};    if (!CAN0TFLG)              /* Is Transmit Buffer full—– */        return ERR_BUFFER_FULL;    CAN0TBSEL = CAN0TFLG;       /* Select lowest empty buffer */    txbuffer = CAN0TBSEL;  /* Backup selected buffer */        /* Load Id to IDR Registers */    *((unsigned long *) ((unsigned long)(&CAN0TXIDR0)))= id;            for (index=0;index<length;index++) {        *(&CAN0TXDSR0 + index) = txdata[index];  /* Load data to Tx buffer                                                   * Data Segment Registers                                                  */    }    CAN0TXDLR = length;                          /* Set Data Length Code */    CAN0TXTBPR = priority;                       /* Set Priority */    CAN0TFLG = txbuffer;                      /* Start transmission */                    while ( (CAN0TFLG & txbuffer) != txbuffer);  /* Wait for Transmission                                                   * completion                                                   */    return NO_ERR; }

 When I try to send a CAN message using the CAN0SendFrame (APPNOTE AN3034), my message send not one time but the same message forever. And the TXE0 flag never set in the last while statment and the program never go further. How can the message be sent over and over again? What to do?
 
(using MC9S12XDT256)
Labels (1)
0 Kudos
4 Replies

638 Views
Nabla69
Contributor V
Hi,
 
Here is my stupid question of the day:
Do you have another node on the network to acknowledge the message sent ?
 
Alvin.
0 Kudos

638 Views
Peder
Contributor I
No :smileyvery-happy:
 
I just red in another topic here that I need a ack node. Not easy to know if you just read Freescales appnotes :smileymad:
 
Here are the solving topic:
0 Kudos

638 Views
Nabla69
Contributor V
This feature is linked to the protocol and not really to the MCU.
In CAN a message not acknowledged is not a message sent properly.
Read the CAN specification to learn this kind of things.
I advise bcanpsv2.0.rev3.pdf available from FSL external website. This doc both explain CAN specification and its msCAN implementation.
 
Alvin.
0 Kudos

638 Views
Peder
Contributor I
Thanx I will do that.
0 Kudos