Forum: DSP TriCore MultiCAN Transmit FIFO Problem.

von gapsna (Guest)

Rate this post
0 useful
not useful
Hi everyone, I've ben trying to transmit a FIFO Structure via CAN with 
my TriCore DSP but I#ve been stuck for the past few days and can't find 
the problem.

I use a modified version of the CAN_ubWriteFIFO function generated with 
uint8 TRANSMIT_FIFO_V2(uint8 OB_FIFO, uint8 size, CAN_SWObj *pstObj)
  retrn = 2;
  //////////////////////// CONFIGURATION OF THE SLAVES
  uint8 i,j;
  uint32 tmp_u32;
  uint8 aubFIFOWritePtr[128], ubFIFOReadPtr[128];
  for(i=OB_FIFO+1; i<= OB_FIFO+size; i++)
    tmp_u32 = 0x1000000*PCAN_LIST_NR;
    tmp_u32 += (i << 16);
    tmp_u32 += 0x2;  //Command
    SetListCommand(tmp_u32); //////// ALOCATING EACH SLAVE TO THE SAME LIST
    CAN_HWOBJ[i].uwMOFCR = (3);//MMC = 0011
    CAN_HWOBJ[i].uwMOFGPR = (0x00FF0000)&(OB_FIFO<<16); // SLAVE CUR must point to BASE OBJ
    CAN_HWOBJ[i].uwMOCTR = (1<<27)|(1<<24)|(1<<25)|(1<<23)|(1<<21)|(1<<19)|(1<<19);// SET DIR, TXRQ, TXEN0, RXEN, MSGVAL, NEWDAT, RESET TXEN1
  //////////////////////// END CONFIGURATION OF THE SLAVES
  //////////////////////// BASE OBJECT CONFIGURATION
  CAN_HWOBJ[OB_FIFO].uwMOAMR = 0;// no mask
  CAN_HWOBJ[OB_FIFO].uwMOFCR = (2)|(1<<27);//MMC = 0010+ DCL=8
  CAN_HWOBJ[OB_FIFO].uwMOFGPR = ((OB_FIFO + size)<<24)|((OB_FIFO)<<16)|((OB_FIFO + size)<<8)|((OB_FIFO));// SEL + CUR + TOP + BOT
  CAN_HWOBJ[OB_FIFO].uwMOCTR = (1<<27)|(1<<26)|(1<<25)|(1<<23)|(1<<21)|(1<<19);// SET DIR, TXEN0, TXEN1, RXEN, MSGVAL, NEWDAT
  //////////////////////// END BASE OBJECT CONFIGURATION

  if((CAN_HWOBJ[OB_FIFO].uwMOFCR & 0x0000000F) == 0x00000002) // IF OB_FIFO IS A TX FIFO BASE OBJECT
    j = OB_FIFO;
    retrn = 0;
    if((CAN_HWOBJ[j].uwMOCTR & 0x00000100) == 0x00000000)// IF TXRQ == 0

        CAN_HWOBJ[j].uwMOCTR  = 0x01280000;// set TXRQ, NEWDAT, MSGVAL
        retrn = 1;

Before calling this function I save the 8 byte Data and the ID in every 
Slave Object and in the Base Object.
After calling the function, It only sends the Data that is saved in the 
Base Object (I also happens if the Base Object is not part of the FIFO) 
with it's ID. CUR pointer of the Base Object moves to the next slave (in 
this case 0x68, beeing the Base Object the 0x67) but the data in the 
next slave object won't be transmitted. MOCTR Register of every Slave 
object is in following state: 0xYYZZ8BA8 (beeing YY and ZZ bytes for 
last and next object on the same list).

Any help would be apreciated.

Thank you all.
Vielen Dank.


von gapsna (Guest)

Rate this post
0 useful
not useful

Problem was, that the PIR field in the MOAR Register of each slave had a 
value of 00b, I changed it to 01b and the FIFO works perfect!


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.